bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] [bug #39713] roots/secant.c "derivative value is not finite" f


From: Brian Gladman
Subject: [Bug-gsl] [bug #39713] roots/secant.c "derivative value is not finite" for a good guess
Date: Wed, 02 Oct 2013 10:17:00 +0000
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36

Follow-up Comment #3, bug #39713 (project gsl):

The section within secant.c in which the root position, the function value and
the derivative value are updated is:

  x_new = x - (f / df);

  f_new = GSL_FN_FDF_EVAL_F(fdf, x_new) ;
  df_new = (f_new - f) / (x_new - x) ;

  *root = x_new ;

Although it involves an additional multiplication, I think this may be safer:

  x_new = x - (f / df);

  f_new = GSL_FN_FDF_EVAL_F(fdf, x_new) ;
  df_new = df * (1.0 - f_new / f) ;

  *root = x_new;

since it avoids the potential problem of x_new and x being the same because (f
/ df) is too small to change x when it is subtracted.  Also, since the
algorithm shouldn't presumably be entered with f = 0, the division f_new / f
should not cause a divide by zero problem.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39713>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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