All Packages Class Hierarchy This Package Previous Next Index
Class rootsolvers.Solvers
java.lang.Object
|
+----rootsolvers.Solvers
- public class Solvers
- extends Object
This class is intended to contain a variety of root-solving algorithms,
each with possibly distinct interfaces. The function to be solved is
made available through the Solved interface with its calcf)OfX method.
Hence, each algorithm method will take as a first argument a Solved object.
Done in this manner, these algorithm methods can all be static.
It is also sensible to have the algorithm methods return the root as a
double. The rest of the arguments may vary with the algorithm. Use of
this class and the Solved interface is demonstrated in the SolversTest
application. This approach to using an interface closely follows the
examples in Core Java 1.1, Volume 1 by Horstmann & Cornell.
- Version:
- $Revision: 1.1.1.1 $, $Date: 1999/11/15 20:37:49 $.
- Author:
- Daren Stotler
- See Also:
- Solvers, Solved, RootSolverException, SolversTest
-
Solvers()
-
-
bisection(Solved, double, double)
- If one can bracket the root, the bisection algorithm can be used and
will find one root with virtual certainty.
Solvers
public Solvers()
bisection
public static double bisection(Solved s,
double x1,
double x2) throws RootSolverException
- 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).
- Parameters:
- s - Solved object containing the function to be solved
- x1 - one bound on the range of the root
- x2 - other bound
- Returns:
- root of the function
- Throws: RootSolverException
- thrown when a root isn't found
All Packages Class Hierarchy This Package Previous Next Index