org.apache.commons.math.analysis.integration

## Class UnivariateRealIntegratorImpl

- java.lang.Object
- - org.apache.commons.math.ConvergingAlgorithmImpl
  - - org.apache.commons.math.analysis.integration.UnivariateRealIntegratorImpl

- All Implemented Interfaces:
    UnivariateRealIntegrator, ConvergingAlgorithm
  Direct Known Subclasses:
    LegendreGaussIntegrator, RombergIntegrator, SimpsonIntegrator, TrapezoidIntegrator

      public abstract class UnivariateRealIntegratorImpl
      extends ConvergingAlgorithmImpl
      implements UnivariateRealIntegrator

  Provide a default implementation for several generic functions.
  Since:
    1.2
  Version:
    $Revision: 1072409 $ $Date: 2011-02-19 19:50:36 +0100 (sam. 19 févr. 2011) $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `defaultMinimalIterationCount` default minimum number of iterations
    `protected UnivariateRealFunction` | `f` Deprecated. as of 2.0 the integrand function is passed as an argument to the `UnivariateRealIntegrator.integrate(UnivariateRealFunction, double, double)`method.
    `protected int` | `minimalIterationCount` minimum number of iterations
    `protected double` | `result` the last computed integral
    `protected boolean` | `resultComputed` indicates whether an integral has been computed
    `private static long` | `serialVersionUID` Serializable version identifier.

    - ### Fields inherited from class org.apache.commons.math.ConvergingAlgorithmImpl

      `absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `UnivariateRealIntegratorImpl(int defaultMaximalIterationCount)` Construct an integrator with given iteration count and accuracy.
    `protected` | `UnivariateRealIntegratorImpl(UnivariateRealFunction f, int defaultMaximalIterationCount)` Deprecated. as of 2.0 the integrand function is passed as an argument to the `UnivariateRealIntegrator.integrate(UnivariateRealFunction, double, double)`method.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `clearResult()` Convenience function for implementations.
    `int` | `getMinimalIterationCount()` Get the lower limit for the number of iterations.
    `double` | `getResult()` Access the last computed integral.
    `void` | `resetMinimalIterationCount()` Reset the lower limit for the number of iterations to the default.
    `void` | `setMinimalIterationCount(int count)` Set the lower limit for the number of iterations.
    `protected void` | `setResult(double newResult, int iterationCount)` Convenience function for implementations.
    `protected void` | `verifyInterval(double lower, double upper)` Verifies that the endpoints specify an interval.
    `protected void` | `verifyIterationCount()` Verifies that the upper and lower limits of iterations are valid.

    - ### 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.analysis.integration.UnivariateRealIntegrator

      `integrate, integrate`

    - ### Methods inherited from interface org.apache.commons.math.ConvergingAlgorithm

      `getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy`

- - ### Field Detail

    - #### serialVersionUID

          private static final long serialVersionUID

      Serializable version identifier.
      See Also:
        Constant Field Values

    - #### minimalIterationCount

          protected int minimalIterationCount

      minimum number of iterations

    - #### defaultMinimalIterationCount

          protected int defaultMinimalIterationCount

      default minimum number of iterations

    - #### resultComputed

          protected boolean resultComputed

      indicates whether an integral has been computed

    - #### result

          protected double result

      the last computed integral

    - #### f

          @Deprecated
          protected UnivariateRealFunction f

      Deprecated. as of 2.0 the integrand function is passed as an argument to the `UnivariateRealIntegrator.integrate(UnivariateRealFunction, double, double)`method.
      The integrand function.

  - ### Constructor Detail

    - #### UnivariateRealIntegratorImpl

          @Deprecated
          protected UnivariateRealIntegratorImpl(UnivariateRealFunction f,
                                                 int defaultMaximalIterationCount)
                                          throws java.lang.IllegalArgumentException

      Deprecated. as of 2.0 the integrand function is passed as an argument to the `UnivariateRealIntegrator.integrate(UnivariateRealFunction, double, double)`method.
      Construct an integrator with given iteration count and accuracy.
      Parameters:
        `f` - the integrand function
        `defaultMaximalIterationCount` - maximum number of iterations
      Throws:
        `java.lang.IllegalArgumentException` - if f is null or the iteration limits are not valid

    - #### UnivariateRealIntegratorImpl

          protected UnivariateRealIntegratorImpl(int defaultMaximalIterationCount)
                                          throws java.lang.IllegalArgumentException

      Construct an integrator with given iteration count and accuracy.
      Parameters:
        `defaultMaximalIterationCount` - maximum number of iterations
      Throws:
        `java.lang.IllegalArgumentException` - if f is null or the iteration limits are not valid

  - ### Method Detail

    - #### getResult

          public double getResult()
                           throws java.lang.IllegalStateException

      Access the last computed integral.
      Specified by:
        `getResult` in interface `UnivariateRealIntegrator`
      Returns:
        the last computed integral
      Throws:
        `java.lang.IllegalStateException` - if no integral has been computed

    - #### setResult

          protected final void setResult(double newResult,
                       int iterationCount)

      Convenience function for implementations.
      Parameters:
        `newResult` - the result to set
        `iterationCount` - the iteration count to set

    - #### clearResult

          protected final void clearResult()

      Convenience function for implementations.

    - #### setMinimalIterationCount

          public void setMinimalIterationCount(int count)

      Set the lower limit for the number of iterations.

      Minimal iteration is needed to avoid false early convergence, e.g. the sample points happen to be zeroes of the function. Users can use the default value or choose one that they see as appropriate.

      A `ConvergenceException` will be thrown if this number is not met.

      Specified by:
        `setMinimalIterationCount` in interface `UnivariateRealIntegrator`
      Parameters:
        `count` - minimum number of iterations

    - #### getMinimalIterationCount

          public int getMinimalIterationCount()

      Get the lower limit for the number of iterations.
      Specified by:
        `getMinimalIterationCount` in interface `UnivariateRealIntegrator`
      Returns:
        the actual lower limit

    - #### resetMinimalIterationCount

          public void resetMinimalIterationCount()

      Reset the lower limit for the number of iterations to the default.

      The default value is supplied by the implementation.

      Specified by:
        `resetMinimalIterationCount` in interface `UnivariateRealIntegrator`
      See Also:
        `UnivariateRealIntegrator.setMinimalIterationCount(int)`

    - #### verifyInterval

          protected void verifyInterval(double lower,
                            double upper)
                                 throws java.lang.IllegalArgumentException

      Verifies that the endpoints specify an interval.
      Parameters:
        `lower` - lower endpoint
        `upper` - upper endpoint
      Throws:
        `java.lang.IllegalArgumentException` - if not interval

    - #### verifyIterationCount

          protected void verifyIterationCount()
                                       throws java.lang.IllegalArgumentException

      Verifies that the upper and lower limits of iterations are valid.
      Throws:
        `java.lang.IllegalArgumentException` - if not valid

Copyright (c) 2003-2013 Apache Software Foundation