|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.analysis.UnivariateRealIntegratorImpl
org.apache.commons.math.analysis.TrapezoidIntegrator
public class TrapezoidIntegrator
Implements the Trapezoidal Rule for integration of real univariate functions. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 3.
The function should be integrable.
Field Summary | |
---|---|
private double |
s
intermediate result |
private static long |
serialVersionUID
serializable version identifier |
Fields inherited from class org.apache.commons.math.analysis.UnivariateRealIntegratorImpl |
---|
defaultMaximalIterationCount, defaultMinimalIterationCount, defaultRelativeAccuracy, f, iterationCount, maximalIterationCount, minimalIterationCount, relativeAccuracy, result, resultComputed |
Constructor Summary | |
---|---|
TrapezoidIntegrator(UnivariateRealFunction f)
Construct an integrator for the given function. |
Method Summary | |
---|---|
double |
integrate(double min,
double max)
Integrate the function in the given interval. |
(package private) double |
stage(double min,
double max,
int n)
Compute the n-th stage integral of trapezoid rule. |
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 |
Field Detail |
---|
private static final long serialVersionUID
private double s
Constructor Detail |
---|
public TrapezoidIntegrator(UnivariateRealFunction f)
f
- function to integrateMethod Detail |
---|
double stage(double min, double max, int n) throws FunctionEvaluationException
integrate()
in the package.
To save time it does not verify arguments - caller does.
The interval is divided equally into 2^n sections rather than an arbitrary m sections because this configuration can best utilize the alrealy computed values.
min
- the lower bound for the intervalmax
- the upper bound for the intervaln
- the stage of 1/2 refinement, n = 0 is no refinement
FunctionEvaluationException
- if an error occurs evaluating the
functionpublic double integrate(double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException, java.lang.IllegalArgumentException
min
- the lower bound for the intervalmax
- the upper bound for the interval
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 invalidprotected void verifyIterationCount() throws java.lang.IllegalArgumentException
verifyIterationCount
in class UnivariateRealIntegratorImpl
java.lang.IllegalArgumentException
- if not
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |