Class SimpsonIntegrator
- java.lang.Object
-
- org.apache.commons.math.ConvergingAlgorithmImpl
-
- org.apache.commons.math.analysis.integration.UnivariateRealIntegratorImpl
-
- org.apache.commons.math.analysis.integration.SimpsonIntegrator
-
- All Implemented Interfaces:
UnivariateRealIntegrator
,ConvergingAlgorithm
public class SimpsonIntegrator extends UnivariateRealIntegratorImpl
Implements the Simpson's Rule for integration of real univariate functions. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 3.This implementation employs basic trapezoid rule as building blocks to calculate the Simpson's rule of alternating 2/3 and 4/3.
- Since:
- 1.2
- Version:
- $Revision: 1070725 $ $Date: 2011-02-15 02:31:12 +0100 (mar. 15 févr. 2011) $
-
-
Field Summary
-
Fields inherited from class org.apache.commons.math.analysis.integration.UnivariateRealIntegratorImpl
defaultMinimalIterationCount, f, minimalIterationCount, result, resultComputed
-
Fields inherited from class org.apache.commons.math.ConvergingAlgorithmImpl
absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy
-
-
Constructor Summary
Constructors Constructor Description SimpsonIntegrator()
Construct an integrator.SimpsonIntegrator(UnivariateRealFunction f)
Deprecated.as of 2.0 the integrand function is passed as an argument to theintegrate(UnivariateRealFunction, double, double)
method.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description double
integrate(double min, double max)
Deprecated.double
integrate(UnivariateRealFunction f, double min, double max)
Integrate the function in the given interval.protected void
verifyIterationCount()
Verifies that the upper and lower limits of iterations are valid.-
Methods inherited from class org.apache.commons.math.analysis.integration.UnivariateRealIntegratorImpl
clearResult, getMinimalIterationCount, getResult, resetMinimalIterationCount, setMinimalIterationCount, setResult, verifyInterval
-
Methods inherited from class org.apache.commons.math.ConvergingAlgorithmImpl
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, incrementIterationsCounter, resetAbsoluteAccuracy, resetIterationsCounter, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.math.ConvergingAlgorithm
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
-
-
-
-
Constructor Detail
-
SimpsonIntegrator
@Deprecated public SimpsonIntegrator(UnivariateRealFunction f)
Deprecated.as of 2.0 the integrand function is passed as an argument to theintegrate(UnivariateRealFunction, double, double)
method.Construct an integrator for the given function.- Parameters:
f
- function to integrate
-
SimpsonIntegrator
public SimpsonIntegrator()
Construct an integrator.
-
-
Method Detail
-
integrate
@Deprecated public double integrate(double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException, java.lang.IllegalArgumentException
Deprecated.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:
FunctionEvaluationException
- if an error occurs evaluating the functionjava.lang.IllegalArgumentException
- if min > max or the endpoints do not satisfy the requirements specified by the integratorMaxIterationsExceededException
-
integrate
public double integrate(UnivariateRealFunction f, double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException, java.lang.IllegalArgumentException
Integrate the function in the given interval.- Parameters:
f
- the integrand functionmin
- the lower bound for the intervalmax
- the upper bound for the interval- Returns:
- the value of integral
- Throws:
FunctionEvaluationException
- if an error occurs evaluating the functionjava.lang.IllegalArgumentException
- if min > max or the endpoints do not satisfy the requirements specified by the integratorMaxIterationsExceededException
-
verifyIterationCount
protected void verifyIterationCount() throws java.lang.IllegalArgumentException
Verifies that the upper and lower limits of iterations are valid.- Overrides:
verifyIterationCount
in classUnivariateRealIntegratorImpl
- Throws:
java.lang.IllegalArgumentException
- if not valid
-
-