help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: info = 3?


From: John W. Eaton
Subject: Re: info = 3?
Date: Sat, 6 Jan 2007 17:27:20 -0500

On  6-Jan-2007, David Bateman wrote:

| huub wrote:
| > Hi,
| > 
| > I wrote a function which with fsolve returns info = 3. What does that 
| > indicate?
| > 
| > function y = wiskunde(x)
| >       y(1) = 2*x(1) + 2;
| >       y(2) = 2*x(1).^2 + 3*x(1) + 5;
| > endfunction
| > 
| > octave:26> [x, info] = fsolve ("wiskunde", [-5;5])
| > x =
| > 
| >      -0.76792
| >     712.10156
| > 
| > info = 3
| > 
| > Thank you,
| > 
| > Huub
| 
| 
| Note fsolve maps minpack info=3,4,5 all to info = 3. From hybrd.f in
| minpack (which fsolve uses)
| 
| C         INFO = 3   XTOL IS TOO SMALL. NO FURTHER IMPROVEMENT IN
| C                    THE APPROXIMATE SOLUTION X IS POSSIBLE.
| C
| C         INFO = 4   ITERATION IS NOT MAKING GOOD PROGRESS, AS
| C                    MEASURED BY THE IMPROVEMENT FROM THE LAST
| C                    FIVE JACOBIAN EVALUATIONS.
| C
| C         INFO = 5   ITERATION IS NOT MAKING GOOD PROGRESS, AS
| C                    MEASURED BY THE IMPROVEMENT FROM THE LAST
| C                    TEN ITERATIONS.
| C
| 
| 
| So take your pick, all mean that the solution is approximative only...

I happened to be looking at this yesterday.  Octave's fsolve can
return the following values for info:

  -1: improper input parameters
   1: successful termination
   3: no further improvement possible (tolerance may be too small)
   4: number of function calls exceeded limit

I think this was originally true for Matlab's as well (though it may
have also been possible for it to return 2 and some other values for
conditions that are just not detected by MINPACK).  The reason I think
Octave used to be compatible is there would really have been no other
reason to convert the values returned from MINPACK to some other
values, and especially not to map several MINPACK status values to one
value that is returned from fsolve.

Anyway, Matlab's fsolve is now documented to return the following
values:

   1  FSOLVE converged to a solution X.
   2  Change in X smaller than the specified tolerance.
   3  Change in the residual smaller than the specified tolerance.
   4  Magnitude of search direction smaller than the specified tolerance.
   0  Maximum number of function evaluations or iterations reached.
  -1  Algorithm terminated by the output function.
  -2  Algorithm seems to be converging to a point that is not a root.
  -3  Trust region radius became too small.
  -4  Line search cannot sufficiently decrease the residual along the current   
       search direction.

So I guess we need to update this.

I added a preliminary version of optimset to the CVS archive
yesterday, so maybe now is the time to fix the fsolve compatibility
problems, have it accept an options structure, etc.?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]