SuanShu, a Java numerical and statistical library

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

Class ChangeOfVariable

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

public class ChangeOfVariable
extends 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, x, to another variable, t, so that the "new" integral is easier to compute.

We set /[ x = x(t) t = x^{-1}(x) = t(x) /] such that, /[ \int_{a}^{b} f(x)\,dx = \int_{t(a)}^{t(b)} f(x)x'(t)\, dt /]

Wikipedia: Integration by substitution
• Constructor Summary

Constructors
Constructor and Description
ChangeOfVariable(SubstitutionRule change, Integrator integrator)
Construct an integrator that uses change of variable to do integration.
• Method Summary

All Methods
Modifier and Type Method and Description
UnivariateRealFunction fdx(UnivariateRealFunction f)
Get the integrand in the "transformed" integral, g(t) = f(x(t)) * x'(t).
double getPrecision()
Get the convergence threshold.
double integrate(UnivariateRealFunction f, double a, double b)
Integrate function f from a to b, $\int_a^b\! f(x)\, dx$
• Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• Constructor Detail

• ChangeOfVariable

public ChangeOfVariable(SubstitutionRule change,
Integrator 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 such as Trapezoidal.
• Method Detail

• integrate

public double integrate(UnivariateRealFunction f,
double a,
double b)
Description copied from interface: Integrator
Integrate function f from a to b, $\int_a^b\! f(x)\, dx$
Specified by:
integrate in interface Integrator
Parameters:
f - a univariate function
a - the lower limit
b - the upper limit
Returns:
$$\int_a^b\! f(x)\, dx$$
• 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
• getPrecision

public double getPrecision()
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:
getPrecision in interface Integrator
Returns:
the precision