SimpsonIntegrator (Apache Commons Math 3.3 API)

org.apache.commons.math3.analysis.integration

## Class SimpsonIntegrator

- java.lang.Object
- - org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator
  - - org.apache.commons.math3.analysis.integration.SimpsonIntegrator

- All Implemented Interfaces:
    UnivariateIntegrator

      public class SimpsonIntegrator
      extends BaseAbstractUnivariateIntegrator

  Implements Simpson's Rule for integration of real univariate functions. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 3.

  This implementation employs the basic trapezoid rule to calculate Simpson's rule.

  Since:
    1.2
  Version:
    $Id: SimpsonIntegrator.java 1364387 2012-07-22 18:14:11Z tn $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `SIMPSON_MAX_ITERATIONS_COUNT` Maximal number of iterations for Simpson.

    - ### Fields inherited from class org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator

      `DEFAULT_ABSOLUTE_ACCURACY, DEFAULT_MAX_ITERATIONS_COUNT, DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_RELATIVE_ACCURACY, iterations`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpsonIntegrator()` Construct an integrator with default settings.
    `SimpsonIntegrator(double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount)` Build a Simpson integrator with given accuracies and iterations counts.
    `SimpsonIntegrator(int minimalIterationCount, int maximalIterationCount)` Build a Simpson integrator with given iteration counts.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected double` | `doIntegrate()` Method for implementing actual integration algorithms in derived classes.

    - ### Methods inherited from class org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator

      `computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getIterations, getMax, getMaximalIterationCount, getMin, getMinimalIterationCount, getRelativeAccuracy, integrate, setup`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SIMPSON_MAX_ITERATIONS_COUNT

          public static final int SIMPSON_MAX_ITERATIONS_COUNT

      Maximal number of iterations for Simpson.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SimpsonIntegrator

          public SimpsonIntegrator(double relativeAccuracy,
                           double absoluteAccuracy,
                           int minimalIterationCount,
                           int maximalIterationCount)
                            throws NotStrictlyPositiveException,
                                   NumberIsTooSmallException,
                                   NumberIsTooLargeException

      Build a Simpson integrator with given accuracies and iterations counts.
      Parameters:
        `relativeAccuracy` - relative accuracy of the result
        `absoluteAccuracy` - absolute accuracy of the result
        `minimalIterationCount` - minimum number of iterations
        `maximalIterationCount` - maximum number of iterations (must be less than or equal to `SIMPSON_MAX_ITERATIONS_COUNT`)
      Throws:
        `NotStrictlyPositiveException` - if minimal number of iterations is not strictly positive
        `NumberIsTooSmallException` - if maximal number of iterations is lesser than or equal to the minimal number of iterations
        `NumberIsTooLargeException` - if maximal number of iterations is greater than `SIMPSON_MAX_ITERATIONS_COUNT`

    - #### SimpsonIntegrator

          public SimpsonIntegrator(int minimalIterationCount,
                           int maximalIterationCount)
                            throws NotStrictlyPositiveException,
                                   NumberIsTooSmallException,
                                   NumberIsTooLargeException

      Build a Simpson integrator with given iteration counts.
      Parameters:
        `minimalIterationCount` - minimum number of iterations
        `maximalIterationCount` - maximum number of iterations (must be less than or equal to `SIMPSON_MAX_ITERATIONS_COUNT`)
      Throws:
        `NotStrictlyPositiveException` - if minimal number of iterations is not strictly positive
        `NumberIsTooSmallException` - if maximal number of iterations is lesser than or equal to the minimal number of iterations
        `NumberIsTooLargeException` - if maximal number of iterations is greater than `SIMPSON_MAX_ITERATIONS_COUNT`

    - #### SimpsonIntegrator

          public SimpsonIntegrator()

      Construct an integrator with default settings. (max iteration count set to `SIMPSON_MAX_ITERATIONS_COUNT`)

  - ### Method Detail

    - #### doIntegrate

          protected double doIntegrate()
                                throws TooManyEvaluationsException,
                                       MaxCountExceededException

      Method for implementing actual integration algorithms in derived classes.
      Specified by:
        `doIntegrate` in class `BaseAbstractUnivariateIntegrator`
      Returns:
        the root.
      Throws:
        `TooManyEvaluationsException` - if the maximal number of evaluations is exceeded.
        `MaxCountExceededException` - if the maximum iteration count is exceeded or the integrator detects convergence problems otherwise

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.