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:
  1. Create a subclass of it. At a minimum, this subclass needs a constructor and an implementation of the calcfOfX abstract method.
  2. 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).
  3. 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

Constructor Index

 o Bisection()

Method Index

 o calcfOfX(double)
This is the function to be solved.
 o root(double, double)
Implements the bisection algorithm.

Constructors

 o Bisection
  public Bisection()

Methods

 o 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
 o 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