Class ChangeOfVariable
- java.lang.Object
-
- dev.nm.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 /]- See Also:
- Wikipedia: Integration by substitution
-
-
Constructor Summary
Constructors Constructor Description ChangeOfVariable(SubstitutionRule change, Integrator integrator)
Construct an integrator that uses change of variable to do integration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 \]
-
-
-
Constructor Detail
-
ChangeOfVariable
public ChangeOfVariable(SubstitutionRule change, Integrator integrator)
Construct an integrator that uses change of variable to do integration.- Parameters:
change
- the substitution formulaintegrator
- the integrator. If there is a singularity at an endpoint, the integrator should use an open formula such asMidpoint
; otherwise, use an integrator with a closed formula such asTrapezoidal
.
-
-
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 interfaceIntegrator
- Parameters:
f
- a univariate functiona
- the lower limitb
- 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 anIterativeIntegrator
, the integral is considered converged if the relative error of two successive sums is less than the threshold.- Specified by:
getPrecision
in interfaceIntegrator
- Returns:
- the precision
-
-