Package tools.singlevariable
Class NumericalIntegration
Object
NumericalIntegration
public class NumericalIntegration
extends Object
The
NumericalIntegration
class computes definite integrals using Simpson's rule and can also return a maximum possible error for the calculation.-
Constructor Summary
Constructors Constructor Description NumericalIntegration()
-
Method Summary
Modifier and Type Method Description static double
simpsonsError(GeneralFunction function, double lowerBound, double upperBound)
Returns the maximum error associated with the definite integral of aGeneralFunction
function on a rangestatic double
simpsonsRule(GeneralFunction function, double lowerBound, double upperBound)
Returns the approximate definite integral of aGeneralFunction
function on a rangestatic double[]
simpsonsRuleWithError(GeneralFunction function, double lowerBound, double upperBound)
Returns the approximate definite integral of aGeneralFunction
function on a range with an error range
-
Constructor Details
-
NumericalIntegration
public NumericalIntegration()
-
-
Method Details
-
simpsonsRule
Returns the approximate definite integral of aGeneralFunction
function on a range- Parameters:
function
- TheGeneralFunction
whose integral is being foundlowerBound
- The lower bound of the rangeupperBound
- The upper bound of the range- Returns:
- the approximate definite integral of the function on a range
-
simpsonsError
Returns the maximum error associated with the definite integral of aGeneralFunction
function on a range- Parameters:
function
- TheGeneralFunction
whose integral is being foundlowerBound
- The lower bound of the rangeupperBound
- The upper bound of the range- Returns:
- the maximum error associated with the definite integral of the function on a range
-
simpsonsRuleWithError
public static double[] simpsonsRuleWithError(GeneralFunction function, double lowerBound, double upperBound)Returns the approximate definite integral of aGeneralFunction
function on a range with an error range- Parameters:
function
- TheGeneralFunction
whose integral is being foundlowerBound
- The lower bound of the rangeupperBound
- The upper bound of the range- Returns:
- a
double[]
comprised of the approximate definite integral of the function on a range and its maximum error range
-