SuanShu, a Java numerical and statistical library

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

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

public class ChangeOfVariable
extends java.lang.Object
implements Integrator

Change of variable can easy the computation of some integrals, such as improper integrals. The idea is to transform a dependent variable to another so that the "new" integral is easier to compute.

We set

 x = x(t)
 t = x-1(x) = t(x)
 
 / b           /t(b)
 |   f(x) dx = | f(x(t)) * x'(t) dt
 / a           /t(a)
 

This implementation does not assume any particular integrator, other than that the integrator is an IterativeIntegrator. The user may combine a substitution rule with his favorite iterative integrator.

See Also:
Wikipedia: Integration by substitution

Constructor Summary
ChangeOfVariable(Substitution change, IterativeIntegrator integrator)
          Construct an integrator that uses change of variable to do integration.
 
Method Summary
 UnivariateRealFunction fdx(UnivariateRealFunction f)
          Get the integrand in the "transformed" integral.
 double integrate(UnivariateRealFunction f, double a, double b)
          Integrate function f from a to b.
 double precision()
          Get the convergence threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeOfVariable

public ChangeOfVariable(Substitution change,
                        IterativeIntegrator integrator)
Construct an integrator that uses change of variable to do integration.

Parameters:
change - the substitution formula
integrator - the integrator. If there is a singularity at an endpoint, the integrator should use an OPEN formula such as Midpoint; otherwise, use an integrator with a CLOSED formula.
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))

fdx

public UnivariateRealFunction fdx(UnivariateRealFunction f)
Get the integrand in the "transformed" integral.
g(t) = f(x(t)) * x'(t)

Parameters:
f - the integrand in the original integral
Returns:
the integrand in the "transformed" integral

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.