SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.integration.univariate.riemann
Class Riemann

java.lang.Object
  extended by com.numericalmethod.suanshu.analysis.integration.univariate.riemann.Riemann
All Implemented Interfaces:
Integrator

public class Riemann
extends java.lang.Object
implements Integrator

This class uses an integrator together with Romberg's method. It tries to determine the appropriate integrator depending on the function and the integral interval.


Field Summary
 int maxIterations
          the maximum number of iterations
 double precision
          the convergence threshold
 
Constructor Summary
Riemann()
          Construct a default integrator.
Riemann(double precision, int maxIterations)
          Construct an integrator.
 
Method Summary
 double integrate(UnivariateRealFunction f, double a, double b)
          Integrate function f from a to b.
 double integrate(UnivariateRealFunction f, double a, double b, Substitution change)
          Riemann function f from a to b, using a Substitution rule.
 double precision()
          Get the convergence threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxIterations

public final int maxIterations
the maximum number of iterations


precision

public final double precision
the convergence threshold

Constructor Detail

Riemann

public Riemann()
Construct a default integrator.


Riemann

public Riemann(double precision,
               int maxIterations)
Construct an integrator.

Parameters:
precision - the convergence threshold
maxIterations - the maximum number of iterations
Method Detail

integrate

public double integrate(UnivariateRealFunction f,
                        double a,
                        double b)
Description copied from interface: Integrator
Integrate function f from a to b.
 / b
 |   f(x) dx
 / a
 

Specified by:
integrate in interface Integrator
Parameters:
f - a univariate function
a - lower limit
b - upper limit
Returns:
Σ(f(x))

integrate

public double integrate(UnivariateRealFunction f,
                        double a,
                        double b,
                        Substitution change)
Riemann function f from a to b, using a Substitution rule.
 / b
 |   f(x) dx
 / a
 

Parameters:
f - a univariate function
a - lower limit
b - upper limit
change - the substitution rule
Returns:
Σ(f(x))

precision

public double precision()
Description copied from interface: Integrator
Get the convergence threshold. The usage depends on the specific integrator.

For example, for an IterativeIntegrator, the integral is considered converged if the relative error of two successive sums is less than the threshold.

Specified by:
precision in interface Integrator
Returns:
the precision

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.