Class 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 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