org.apache.commons.math.analysis
Class RombergIntegrator
java.lang.Object
org.apache.commons.math.analysis.UnivariateRealIntegratorImpl
org.apache.commons.math.analysis.RombergIntegrator
- All Implemented Interfaces:
- java.io.Serializable, UnivariateRealIntegrator
public class RombergIntegrator
- extends UnivariateRealIntegratorImpl
Implements the
Romberg Algorithm for integration of real univariate functions. For
reference, see Introduction to Numerical Analysis, ISBN 038795452X,
chapter 3.
Romberg integration employs k successvie refinements of the trapezoid
rule to remove error terms less than order O(N^(-2k)). Simpson's rule
is a special case of k = 2.
- Since:
- 1.2
- Version:
- $Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $
- See Also:
- Serialized Form
Field Summary |
private static long |
serialVersionUID
serializable version identifier |
Method Summary |
double |
integrate(double min,
double max)
Integrate the function in the given interval. |
protected void |
verifyIterationCount()
Verifies that the iteration limits are valid and within the range. |
Methods inherited from class org.apache.commons.math.analysis.UnivariateRealIntegratorImpl |
clearResult, getIterationCount, getMaximalIterationCount, getMinimalIterationCount, getRelativeAccuracy, getResult, isSequence, resetMaximalIterationCount, resetMinimalIterationCount, resetRelativeAccuracy, setMaximalIterationCount, setMinimalIterationCount, setRelativeAccuracy, setResult, verifyInterval |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- serializable version identifier
- See Also:
- Constant Field Values
RombergIntegrator
public RombergIntegrator(UnivariateRealFunction f)
- Construct an integrator for the given function.
- Parameters:
f
- function to integrate
integrate
public double integrate(double min,
double max)
throws MaxIterationsExceededException,
FunctionEvaluationException,
java.lang.IllegalArgumentException
- Integrate the function in the given interval.
- Parameters:
min
- the lower bound for the intervalmax
- the upper bound for the interval
- Returns:
- the value of integral
- Throws:
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the integrator detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the
function
java.lang.IllegalArgumentException
- if any parameters are invalid
verifyIterationCount
protected void verifyIterationCount()
throws java.lang.IllegalArgumentException
- Verifies that the iteration limits are valid and within the range.
- Overrides:
verifyIterationCount
in class UnivariateRealIntegratorImpl
- Throws:
java.lang.IllegalArgumentException
- if not