apache_muller
- sherpa.utils.apache_muller(fcn, xa, xb, fa=None, fb=None, args=(), maxfev=32, tol=1e-06)[source] [edit on github]
An alternative implementation of Muller’s method for root finding.
Unlike the rest of Sherpa, this method is available the Apache Software Foundation (ASF) licence - see code for this method for details.
- Parameters:
fcn (callable) – The function with a root. The function signature is
fcn(x, *args)
.xa (float) – Muller’s method requires three initial values.
xb (float) – Muller’s method requires three initial values.
fa (float or None) – Function values at
xa
andxb
. These parameters are optional and can be passed to save time in cases wherefcn(xa, *args)
is already known and function evaluation takes a long time. IfNone
, they will be calculated.fb (float or None) – Function values at
xa
andxb
. These parameters are optional and can be passed to save time in cases wherefcn(xa, *args)
is already known and function evaluation takes a long time. IfNone
, they will be calculated.args (tuple) – Additional parameters that will be passed through to
fcn
.maxfev (int) – Maximal number of function evaluations
tol (float) – The root finding algorthm stops if the function value a value x with
abs(fcn(x)) < tol
is found.
- Returns:
out – The output has the form of a list:
[[x, fcn(x)], [x1, fcn(x1)], [x2, fcn(x2)], nfev]
wherex
is the location of the root, andx1
andx2
are the previous steps. The function value for those steps is returned as well.nfev
is the total number of function evaluations. If any of those values is not available,None
will be returned instead.- Return type: