MATLAB's fsolve: which equation-solving algorithm to choose?
    9 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
Hello,
I would like to ask a few questions regarding the choice of equation-solving algorithms in MATLAB's fsolve function. I know the default is the 'trust-region-dogleg' (henceforth TRD) algorithm: does this mean this is preferable / 'superior' to others in some way? I am asking because I am attempting to solve a system of 554 simultaneous non-linear equations (a 'square' system, which TRD can handle); fsolve however takes a very long time to solve under TRD (assuming it ever does). I stopped it after the 10,000th iteration and the residual seems still quite high: please find the last few lines of the output below for your reference.
                                           Norm of      First-order   Trust-region
Iteration  Func-count          f(x)          step         optimality    radius
 .
 . (output omitted)
 .
  9996      5548335          181727    1.32714e-05            490               1
  9997      5548890          181727    1.35706e-05            512               1
  9998      5549445          181727    1.32713e-05            490               1
  9999      5550000          181727    1.35705e-05            512               1
 10000      5550555          181727    1.32711e-05            490               1
I thus decided to try an alternative algorithm, namely the Levenberg-Marquardt, by specifying 'Algorithm','levenberg-marquardt' in 'optimoptions'. The system was then solved much more efficiently: after 'only' 143 iterations (see last few lines below), the output stated:
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the value of the function tolerance, and
the problem appears regular as measured by the gradient.
                                       First-Order                    Norm of 
Iteration  Func-count    Residual       optimality      Lambda           step
   .
   . (output omitted)
   .
   140       78322     3.59762e-06          0.0252        1e-08        3.90698
   141       78877     1.28284e-06          0.0877        1e-09        7.29042
   142       79432     3.06443e-09         0.00444        1e-10        1.63511
   143       79987     1.16041e-15        2.33e-06        1e-11      0.0374313
So I am wondering:
A) Am I safe picking Levenberg-Marquardt over TRD, or should the fact that TRD failed to solve effectively worry me? 
B) What might be causing such a huge difference in outcomes? 
I had a look at MATLAB documentation, which according to my understanding states that the choice of algorithms can ultimately be a matter of preference. However, it also suggests that one use TRD first, and that TRD "is the only algorithm that is specially designed to solve nonlinear equations". So I was wondering if I should try to make it solve more efficiently under TRD, or else if I should make do with Levenberg-Marquardt. Any ideas? Thank you very much! 
0 Kommentare
Akzeptierte Antwort
  Matt J
      
      
 am 12 Aug. 2021
        
      Bearbeitet: Matt J
      
      
 am 12 Aug. 2021
  
      or should the fact that TRD failed to solve effectively worry me? 
No. Some algorithms are simply better suited to certain problems. If TRD worked well for everything, there would be no reason for fsolve to even provide Levenberg-Marquardt as an option. 
I vaguely wonder if TRD's performance suffered because of your initial guess and whether it performs better if you initialize closer to the solution. You could test that by initializing near the solution given by Levenberg-Marquardt.
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

