MATLAB Answers

1

What does this "fsolve" message tell me?

Asked by Ismael on 14 Jun 2019
Latest activity Edited by Matt J
on 15 Jun 2019
I used fsolve for solving a set of AEs system, but at some points, there was a message (below) and I want to make sure that the solution is correct. Does a function evaulation error of (5.95853e-15 ) is not enough for the solution to be correct? if yes, why then there is a possibality of inaccuracy? Is there any site that gives an example and clarifies the answer (the solution correct or not)?
Thank you for your reply.
Equation solved, inaccuracy possible.
The vector of function values is near zero, as measured by the selected value
of the function tolerance. However, the last step was ineffective.
<stopping criteria details>
Norm of First-order
Iteration Func-count f(x) step optimality
0 25 283.369 889
1 50 17.5264 1.69221 115
2 75 0.919449 5.70997 14.9
3 100 0.031813 0.655703 1.82
4 125 0.000288599 0.469084 0.138
5 150 5.08518e-06 0.0216549 0.00152
6 175 1.26756e-08 0.0215894 0.000155
7 200 2.40321e-10 0.000338267 1.54e-06
8 225 4.66879e-13 0.000144072 1.54e-06
9 250 5.95853e-15 1.48907e-06 2e-08

  0 Comments

Sign in to comment.

1 Answer

Answer by Matt J
on 15 Jun 2019
Edited by Matt J
on 15 Jun 2019
 Accepted Answer

Does a function evaulation error of (5.95853e-15 ) is not enough for the solution to be correct?
Only you can know the answer to that. How close to the ideal solution do you need to be? And how sensitive is your equation function f(x) to deviations from the ideal solution.
Consider, for example, the simplest equation
1e-15*x-1e-15=0
The ideal solution to this is x=1, but x=2 provides a solution with error of only f(x)=1e-15. Is x=2 close enough?
Now consider an equivalent equation
x-1=0
Here again, the solution is x=1, but x=2 provides a much bigger error, f(x)=1. Again, does f(x) tell you it is close enough, or still too far away?

  2 Comments

Thank you Matt. 1e-15 accuracy as I set is more than enough for my problem. Why inaccuracy is possible while it met the tolerance setting? What does “last step was ineffective” mean? Matlab says equation solved. It does say no solution found as I had this case. Thank you once again.
Matt J
on 15 Jun 2019
Equation solved, inaccuracy possible.
I assume this is supposed to warn you of the same issue as in my example above. fsolve succeeded in making f(x) very small, as measured by the FunctionTolerance you selected. However, as my example showed, just because f(x) is very small that doesn't automatically mean that is very small. It depends on the scaling and sensitivity of f(x) to changes in x.
What does “last step was ineffective” mean?
I don't know, but in this similar post, Mathworks staff described it as innocuous.

Sign in to comment.