Class rootsolvers.Bisection
All Packages Class Hierarchy This Package Previous Next Index
Class rootsolvers.Bisection
java.lang.Object
|
+----rootsolvers.Bisection
- public class Bisection
- extends Object
- implements RootSolver
An implementation of the solution algorithm in the RootSolver
interface. If one can bracket the root, the bisection algorithm
can be used and will find one root with virtual certainty.
For more information, see W. H. Press, B. P. Flannery,
S. A. Teukolsky and W. T. Vetterling, Numerical Recipes
(Cambridge Univ., New York, 1988
To use this class:
- Create a subclass of it. At a minimum, this subclass needs a
constructor and an implementation of the calcfOfX abstract
method.
- As noted below, calcfOfX takes as an argument the variable being
solved for, X, and returns the value of the function being solved,
f(X).
- Once bounds on the root have been determined, the root method
given below can be invoked to actually solve the equation.
- Version:
- 1.0 02-13-97
- Author:
- Daren Stotler
- See Also:
- RootSolver, RootSolverException, BisectionTest
-
Bisection()
-
-
calcfOfX(double)
- This is the function to be solved.
-
root(double, double)
- Implements the bisection algorithm.
Bisection
public Bisection()
root
public void root(double x1,
double x2) throws RootSolverException
- Implements the bisection algorithm.
- Parameters:
- x1 - one bound on the range of the root
- x2 - other bound
- Throws: RootSolverException
- thrown when a root isn't found
calcfOfX
public abstract double calcfOfX(double x)
- This is the function to be solved.
- Parameters:
- x - point at which function is to be evaluated; on return, this
is the root
- Returns:
- function value for use in solution algorithm
All Packages Class Hierarchy This Package Previous Next Index