public class NewtonRootFinder extends java.lang.Object implements RootFinder
Constructor and Description |
---|
NewtonRootFinder(int maxIterations,
boolean additiveBoundarySearch) |
public NewtonRootFinder(int maxIterations, boolean additiveBoundarySearch)
maxIterations
- Maximum search iterations to attempt before returning an erroradditiveBoundarySearch
- If true, when low and high boundaries need to be widened, a proportion
of their difference is added/substracted. If false, they are multiplied/divided by a constant.
False is a good idea for boundaries that should not cross zero.public float findRoot(Function function, float startLow, float startHigh, float tolerance)
findRoot
in interface RootFinder
function
- Function f(x) to find root ofstartLow
- Low-valued x from which to start searchstartHigh
- High-valued x from which to start. You typically give startLow and startHigh so that
you expect the signs of the functions at these values to be different.tolerance
- Max acceptable |f(x)| for which to return xRootFinder.findRoot(ca.nengo.math.Function, float, float, float)