87 lines
5.1 KiB
XML
87 lines
5.1 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet type="text/xsl" href="./xdoc.xsl"?>
|
|
<!-- $Revision: 1.5 $ $Date: 2003/11/15 18:38:16 $ -->
|
|
<document url="analysis.html">
|
|
<properties>
|
|
<title>The Commons Math User Guide - Numerical Analysis</title>
|
|
<author email="phil@steitz.com">Phil Steitz</author>
|
|
</properties>
|
|
<body>
|
|
<section name="4 Numerical Analysis">
|
|
<subsection name="4.1 Overview" href="overview">
|
|
<p>This is yet to be written. Any contributions will be gratefully
|
|
accepted!</p>
|
|
</subsection>
|
|
<subsection name="4.2 Root-finding" href="rootfinding">
|
|
<p>
|
|
<code>org.apache.commons.math.analysis.UnivariateRealSolver</code> provides the means to
|
|
find roots of univariate, real valued, functions. Commons-Math supports various
|
|
implementations of <code>UnivariateRealSolver</code> to solve functions with differing
|
|
characteristics.
|
|
</p>
|
|
<p>
|
|
In order to use the root-finding features, first a solver object must be created. It is
|
|
encouraged that all solver object creation occurs via the <code>org.apache.commons.math.analysis.UnivariateRealSolverFactory</code>
|
|
class. <code>UnivariateRealSolverFactory</code> is a simple factory used to create all
|
|
of the solver objects supported by Commons-Math. The typical usage of <code>UnivariateRealSolverFactory</code>
|
|
to create a solver object would be:</p>
|
|
<source>UnivariateRealFunction function = // some user defined function object
|
|
UnivariateRealSolverFactory factory = UnivariateRealSolverFactory.newInstance();
|
|
UnivariateRealSolver solver = factory.newDefaultSolver(function);</source>
|
|
<p>
|
|
The solvers that can be instantiated via the <code>UnivariateRealSolverFactory</code> are detailed below:
|
|
<table>
|
|
<tr><th>Solver</th><th>Factory Method</th><th>Notes on Use</th></tr>
|
|
<tr><td>Bisection</td><td>newBisectionSolver</td><td><div>Root must be bracketted.</div><div>Linear, guaranteed convergence</div></td></tr>
|
|
<tr><td>Brent</td><td>newBrentSolver</td><td><div>Root must be bracketted.</div><div>Super-linear, guaranteed convergence</div></td></tr>
|
|
<tr><td>Secant</td><td>newSecantSolver</td><td><div>Root must be bracketted.</div><div>Super-linear, non-guaranteed convergence</div></td></tr>
|
|
</table>
|
|
</p>
|
|
<p>
|
|
Using a solver object, roots of functions are easily found using the <code>solve</code>
|
|
methods. For a function <code>f</code>, and two domain values, <code>min</code> and
|
|
<code>max</code>, <code>solve</code> computes the value <code>c</code> such that:
|
|
<ul>
|
|
<li><code>f(c) = 0.0</code></li>
|
|
<li><code>min <= c <= max</code></li>
|
|
</ul>
|
|
</p>
|
|
<source>UnivariateRealFunction function = // some user defined function object
|
|
UnivariateRealSolverFactory factory = UnivariateRealSolverFactory.newInstance();
|
|
UnivariateRealSolver solver = factory.newBisectionSolver(function);
|
|
double c = solver.solve(1.0, 5.0);</source>
|
|
<p>
|
|
Along with the <code>solve</code> methods, the <code>UnivariateRealSolver</code>
|
|
interface provides many properties to control the convergence of a solver. For the most
|
|
part, these properties should not have to change from their default values to produce
|
|
quality results. In the circumstances where changing these property values is needed, it
|
|
is easily done through getter and setter methods on <code>UnivariateRealSolver</code>:
|
|
<table>
|
|
<tr><th>Property</th><th>Methods</th><th>Purpose</th></tr>
|
|
<tr><td>Absolute accuracy</td><td>
|
|
<div>getAbsoluteAccuracy</div>
|
|
<div>resetAbsoluteAccuracy</div>
|
|
<div>setAbsoluteAccuracy</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
|
<tr><td>Function value accuracy</td><td>
|
|
<div>getFunctionValueAccuracy</div>
|
|
<div>resetFunctionValueAccuracy</div>
|
|
<div>setFunctionValueAccuracy</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
|
<tr><td>Maximum iteration count</td><td>
|
|
<div>getMaximumIterationCount</div>
|
|
<div>resetMaximumIterationCount</div>
|
|
<div>setMaximumIterationCount</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
|
<tr><td>Relative accuracy</td><td>
|
|
<div>getRelativeAccuracy</div>
|
|
<div>resetRelativeAccuracy</div>
|
|
<div>setRelativeAccuracy</div></td><td>This is yet to be written. Any contributions will be greatfully accepted!</td></tr>
|
|
</table>
|
|
</p>
|
|
</subsection>
|
|
<subsection name="4.3 Interpolation" href="interpolation">
|
|
<p>This is yet to be written. Any contributions will be gratefully
|
|
accepted!</p>
|
|
</subsection>
|
|
</section>
|
|
</body>
|
|
</document>
|