[Top][All Lists]

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

Use of fsolve

From: Daniel Tourde
Subject: Use of fsolve
Date: Thu, 01 Oct 1998 18:08:46 +0200


I would like to use the fsolve solution for solving non-linear equations
where sometimes, solutions or constant are very small:

  y(1) = 12*((x(3)*x(1))/2)/E - nlcoef(3);
  y(2) = 12*((x(3)*x(2)+x(1)*x(4))/6)/E - nlcoef(4);
  y(3) = 12*((P*x(3)/2+x(4)*x(2)+x(1)*x(5))/12)/E - nlcoef(5);
  y(4) = 12*((P*x(4)/2+x(5)*x(2))/20)/E - nlcoef(6); 
  y(5) = 12*((P*x(5))/60)/E - nlcoef(7);

Where some of my nlcoef values are very small (between 1e-7 and 1e-10).
It happens that the solutions given by fsolve can be wrong due to
rounding and precision errors. 

It is possible to increase the tolerance of fsolve by using the

octave:1> fsolve_options 

  *** fsolve_options:

  fsolve_options (KEYWORD, VALUE)

  Set or show options for fsolve.  Keywords may be abbreviated
  to the shortest match.

  Options for fsolve include:

    keyword                                  value
    -------                                  -----

    tolerance                                1.49012e-08

  octave:2> fsolve_options ("tol", 1e-12)
  octave:3> fsolve_options ("tol")
  ans =  1.0000e-12

I know the existence of some flags provided by fsolve:

Valid values and their meanings are:

  -2:  input error
  -1:  error encountered in user-supplied function
   1:  solution converged to requested tolerance
   4:  iteration limit exceeded
   3:  iteration is not making good progress

It happens during my computation that sometimes flag 3 or flag 4 are
raised. And of course, this is when I got wrong results.

Then my question is the following: How can I change the iteration limit
within fsolve. How can I improve the precision of Octave in its
globality ? In a word, what is the best way to get rid of flag 4 and
flag 3 ?

Thanks in advance

                                Daniel Tourde

Daniel TOURDE                                   E-mail : address@hidden
The Aeronautical Research Institute of Sweden   Tel : +46 8 634 13 44
P.O. Box 11021 S-161 11 BROMMA, Sweden          Fax : +46 8  25 34 81

reply via email to

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