drasys.or.nonlinear
Class Bisection

java.lang.Object
  |
  +--drasys.or.nonlinear.Bisection
Direct Known Subclasses:
EquationSolution

public class Bisection
extends java.lang.Object
implements EquationSolutionI, java.io.Serializable

An implementation of the bisection algorithm to solve single equations.

See Also:
Serialized Form

Constructor Summary
Bisection()
           
 
Method Summary
 double getAccuracy()
          Get the accuracy of the answer.
 int getMaxIterations()
          Get the maximum number of iterations.
 void setAccuracy(double accuracy)
          Set the accuracy of the answer.
 void setMaxIterations(int maxIterations)
          Set the maximum number of iterations.
 double solve(FunctionI function, double x1, double x2, double y)
          Find x between x1 and x2 where f(x) = y.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bisection

public Bisection()
Method Detail

setMaxIterations

public void setMaxIterations(int maxIterations)
Set the maximum number of iterations.
Specified by:
setMaxIterations in interface EquationSolutionI

getMaxIterations

public int getMaxIterations()
Get the maximum number of iterations.
Specified by:
getMaxIterations in interface EquationSolutionI

setAccuracy

public void setAccuracy(double accuracy)
Set the accuracy of the answer.
Specified by:
setAccuracy in interface EquationSolutionI

getAccuracy

public double getAccuracy()
Get the accuracy of the answer.
Specified by:
getAccuracy in interface EquationSolutionI

solve

public double solve(FunctionI function,
                    double x1,
                    double x2,
                    double y)
             throws NonlinearException,
                    AccuracyException
Find x between x1 and x2 where f(x) = y.
Specified by:
solve in interface EquationSolutionI
Throws:
AccuracyException - if the answer isn't found to the specified accuracy.
NonlinearException - if f(x1) and f(x2) don't bracket y.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com