Termination tolerance in fsolve

8 visualizzazioni (ultimi 30 giorni)
Andre Ged
Andre Ged il 27 Apr 2022
Commentato: Andre Ged il 29 Apr 2022
Hello!
I am a student in engineering, and I'm using fsolve to solve a system of three non-linear equations in three unknowns. I'm using a non-default value of 1e-20 for the function tolerance (TolFun for optimset options). This is the output of the code:
%---------------------------------------------------------------------------------------------------------
Norm of First-order Trust-region
Iteration Func-count f(x) step optimality radius
0 4 5.15835e-11 5.66e-05 1
1 8 3.52966e-11 1.13575e-05 8.44e-06 1
2 12 1.54608e-13 3.25853e-06 6.07e-07 1
3 13 1.54608e-13 1.07169e-05 6.07e-07 1
4 14 1.54608e-13 2.67923e-06 6.07e-07 2.68e-06
5 15 1.54608e-13 6.69807e-07 6.07e-07 6.7e-07
6 19 4.96366e-14 1.67452e-07 3.23e-07 1.67e-07
7 20 4.96366e-14 1.67452e-07 3.23e-07 1.67e-07
8 24 1.06467e-14 4.18629e-08 9.78e-08 4.19e-08
9 25 1.06467e-14 1.04657e-07 9.78e-08 1.05e-07
10 29 7.30661e-15 2.61643e-08 4.46e-08 2.62e-08
11 33 6.5418e-15 2.61643e-08 3.66e-09 2.62e-08
12 34 6.5418e-15 6.54108e-08 3.66e-09 6.54e-08
13 38 6.51553e-15 1.63527e-08 2.09e-08 1.64e-08
14 39 6.51553e-15 1.63527e-08 2.09e-08 1.64e-08
15 43 6.37946e-15 4.08818e-09 5.59e-09 4.09e-09
Equation solved, inaccuracy possible.
The vector of function values is near zero, as measured by the value
of the function tolerance. However, the last step was ineffective.
%---------------------------------------------------------------------------------------------------------
From the final exit message it seems that the algorithm was able to find a solution that satisfies the enforced tolerance value. However, the final function value (which should be sum(equations.^2)) is 6.37946e-15, which is higher than 1e-20. Moreover no one of the three equations is satisfied with an error lower than 1e-20. So why is the final message 'The vector of function values is near zero, as measured by the value of the function tolerance'? Probably I haven't understood what TolFun actually is.

Risposta accettata

Steven Lord
Steven Lord il 27 Apr 2022
See the Tip at the top of this documentation page. I suggest you increase your tolerance value to something greater than eps.
  2 Commenti
Andre Ged
Andre Ged il 29 Apr 2022
Thank you very much for your help
Andre Ged
Andre Ged il 29 Apr 2022
Thank you very much for your help

Accedi per commentare.

Più risposte (1)

Massimiliano Zanoli
Massimiliano Zanoli il 27 Apr 2022
You might have hit the numerical accuracy depending on what values the variables in your set of equations take. Check the eps at those values, stepping less than that will produce no change in the solution.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by