Class Riemann

  • All Implemented Interfaces:
    Integrator

    public class Riemann
    extends Object
    implements Integrator
    This is a wrapper class that integrates a function by using an appropriate integrator together with Romberg's method. The integral can be definite or indefinite. For an indefinite integral, it requires the specification of a substitution rule (change of variable).
    See Also:
    Wikipedia: Riemann integral
    • Constructor Detail

      • Riemann

        public Riemann​(double precision,
                       int maxIterations)
        Construct an integrator.
        Parameters:
        precision - the convergence threshold
        maxIterations - the maximum number of iterations
      • Riemann

        public Riemann()
        Construct an integrator.
    • 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\)
      • integrate

        public double integrate​(UnivariateRealFunction f,
                                double a,
                                double b,
                                SubstitutionRule change)
        Integrate a function, f, from a to b possibly using change of variable.
        Parameters:
        f - a univariate function
        a - the lower limit
        b - the upper limit
        change - the substitution rule; null for a definite integral (no singularity)
        Returns:
        \(\int_a^b\! f(x)\, dx\)
      • 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