Documentation API of the 'jhplot.math.num.integration.RombergIntegrator' Java class
RombergIntegrator
jhplot.math.num.integration

## Class RombergIntegrator

• `public class RombergIntegratorextends IterativeMethod`

An implementation of Romberg Integration.

For example, to evaluate definite integrals for sine, first a `Function` is defined:

` Function sine = new Function() {    public double evaluate(double x) {        return Math.sin(x);    }} }; `

Then, a Romberg integrator is created with the above function:

` RombergIntegrator integrator = new RombergIntegrator(sine); `

Lastly, evaluating definite integrals is accomplished using the `integrate(double, double)` method:

` // integrate sine from 0 to Pi. double two = integrator.integrate(0.0, Math.PI);  // integrate sine from Pi/2 to 2 Pi. double one = integrator.integrate(Math.PI / 2.0, Math.PI); `

References:

1. Eric W. Weisstein. "Romberg Integration." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/RombergIntegration.html

• ### Nested classes/interfaces inherited from class jhplot.math.num.IterativeMethod

`IterativeMethod.IterativeState`
• ### Constructor Summary

Constructors
Constructor and Description
`RombergIntegrator(Function f)`
Create an integrator for the given function.
`RombergIntegrator(Function f, int iterations, double error)`
Create an integrator for the given function.
• ### Method Summary

All Methods
Modifier and TypeMethod and Description
`Function``getFunction()`
Access the target function.
`double``integrate(double a, double b)`
Evaluate the definite integral from a to b.
`void``setFunction(Function f)`
Modify the target function.
• ### Methods inherited from class jhplot.math.num.IterativeMethod

`getMaximumIterations, getMaximumRelativeError, iterate, setMaximumIterations, setMaximumRelativeError`
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### RombergIntegrator

`public RombergIntegrator(Function f)`
Create an integrator for the given function.
Parameters:
`f` - the target function.
• #### RombergIntegrator

`public RombergIntegrator(Function f,                         int iterations,                         double error)`
Create an integrator for the given function.
Parameters:
`f` - the target function.
`iterations` - maximum number of iterations.
`error` - maximum relative error.
• ### Method Detail

• #### getFunction

`public Function getFunction()`
Access the target function.
Returns:
the target function.
• #### integrate

`public double integrate(double a,                        double b)                 throws NumericException`
Evaluate the definite integral from a to b.
Parameters:
`a` - the lower limit of integration.
`b` - the upper limit of integration.
Returns:
the definite integral from a to b.
Throws:
`NumericException` - if the integral can not be evaluated.
• #### setFunction

`public void setFunction(Function f)`
Modify the target function.
Parameters:
`f` - the new target function.

DMelt 1.2 © DataMelt by jWork.ORG

RombergIntegrator
jhplot.math.num.integration

## Class RombergIntegrator

• `public class RombergIntegratorextends IterativeMethod`

An implementation of Romberg Integration.

For example, to evaluate definite integrals for sine, first a `Function` is defined:

` Function sine = new Function() {    public double evaluate(double x) {        return Math.sin(x);    }} }; `

Then, a Romberg integrator is created with the above function:

` RombergIntegrator integrator = new RombergIntegrator(sine); `

Lastly, evaluating definite integrals is accomplished using the `integrate(double, double)` method:

` // integrate sine from 0 to Pi. double two = integrator.integrate(0.0, Math.PI);  // integrate sine from Pi/2 to 2 Pi. double one = integrator.integrate(Math.PI / 2.0, Math.PI); `

References:

1. Eric W. Weisstein. "Romberg Integration." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/RombergIntegration.html

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.