# SuanShu, a Java numerical and statistical library

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

## Class Riemann

• java.lang.Object
• com.numericalmethod.suanshu.analysis.integration.univariate.riemann.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).
Wikipedia: Riemann integral
• ### Constructor Summary

Constructors
Constructor and Description
Riemann()
Construct an integrator.
Riemann(double precision, int maxIterations)
Construct an integrator.
• ### Method Summary

All Methods
Modifier and Type Method and Description
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$
double integrate(UnivariateRealFunction f, double a, double b, SubstitutionRule change)
Integrate a function, f, from a to b possibly using change of variable.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### 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