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 doublesimpsonsError(GeneralFunction function, double lowerBound, double upperBound)Returns the maximum error associated with the definite integral of aGeneralFunctionfunction on a rangestatic doublesimpsonsRule(GeneralFunction function, double lowerBound, double upperBound)Returns the approximate definite integral of aGeneralFunctionfunction on a rangestatic double[]simpsonsRuleWithError(GeneralFunction function, double lowerBound, double upperBound)Returns the approximate definite integral of aGeneralFunctionfunction on a range with an error range
-
Constructor Details
-
NumericalIntegration
public NumericalIntegration()
-
-
Method Details
-
simpsonsRule
Returns the approximate definite integral of aGeneralFunctionfunction on a range- Parameters:
function- TheGeneralFunctionwhose 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 aGeneralFunctionfunction on a range- Parameters:
function- TheGeneralFunctionwhose 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 aGeneralFunctionfunction on a range with an error range- Parameters:
function- TheGeneralFunctionwhose 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
-