|
From: | Nicholas Jankowski |
Subject: | Re: fsolve shows repeated results |
Date: | Fri, 16 Oct 2015 18:04:48 -0400 |
On Fri, Oct 16, 2015 at 4:56 PM, Fausto Arinos de A. Barbuto <address@hidden> wrote:Doug,Right, but I'm still lost as for how fsolve() goes back to root x = 4.603...after root x = 7.673... had been found. Notice that the last element in list/vector xi = [0.1:0.5:5.0] is 4.6. Then it is reasonable that root 4.603... befound for the 6th and last time right before the for-loop (and the executionas well) ends. But why 7.673... is found and then 4.603... once again?FaustoSo, you understand how your code is calling the functions, but the question is why does fsolve lock onto that particular root given that particular initial guess?I don't know exactly what's going on inside fsolve, rootfinding can be a nontrivial process. throwing darts in the dark, and hoping you hear the sound of cork and not breaking glass...
but assuming it's similar to functions like fzero, the performance of the function will change depending on how close you are to a root. in zero-finding techniques that require an interval, you're usually fairly certain to find the minimum or zero within that interval. but given just one starting point, the algorithm has to guess at a direction and trajectory for its next guess. if the local slope of the curve is low, it may take a very large jump to try and get closer to zero. this may cause it to skip over one zero and latch onto another one.Plot the curve and mark the points you were starting from. look at the tangent lines at each of those points. It may provide a clue as to why it's doing what it's doing.I just went through a nonlinear zero-finding exercise myself, and wound up going with complex-domain solutions so I could guarantee finding all the zeros.Nick J.
[Prev in Thread] | Current Thread | [Next in Thread] |