I think usually FindRoot will give the root that's closer to the start point. But see the example below, where I try to find the root of $\cos x=0$. If I started from $x=0.1$, then I get $10.9956$, but if I started from 1, I get $1.5708$. What's wrong?
|
|
||||
|
Technically,
You can keep large steps from occurring by decreasing the
The damping factor multiplies the change in
That lands Of course, damping slows down convergence. In the following, it slows it down too much:
The regular method has no problem with it, though:
|
|||
|
|
|
This question has been asked in different context here and here.
As mentioned in the comments,
I adopted this idea from Bob Hanlons answer to same sort of question. |
|||||
|
|
To see what is happening, implement a quick Newton iteration algorithm. for instance:
Now see what happens when we have starting value as 0.1 and 1 and with say 5 iterations
I hope this helps. |
|||
|
|
|
When in doubt as to whether
where we use
where I have mercifully truncated the output, showing that damping gives better results at the cost of an increased number of iterations. One could choose to use Brent's method instead by specifying explicit brackets. The convergence is not as fast as Newton-Raphson, but it is certainly much safer:
If, like me, you like pictures to help with diagnostics, there is a function called
|
|||
|
|



![FindRootPlot[] result](https://web-archive.nli.org.il/National_Library/20160930123623im_/https://i.stack.imgur.com/1d8dG.png)
![FindRootPlot[] with "DampingFactor" result](https://web-archive.nli.org.il/National_Library/20160930123623im_/https://i.stack.imgur.com/M5HWY.png)
x == 0.1.FindRootis using Newton's method. – Michael E2 14 hours agoFindRoot[]uses Newton's Method. The tangent line hits further out. In general, Newtons method requires a good initial guess or you "can" get a root quite far away. – Michael McCain 14 hours agoFindRootusually returns the value of a root bracketed by the two guesses. For instance,FindRoot[Cos[x], {x, -1, 4}]. – bbgodfrey 13 hours ago