java.lang.Object
org.jhotdraw8.geom.Integrals
Provides algorithms for computing the integral of a function.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublegaussLegendre3(ToDoubleFunction<Double> func, double a, double b) Gauss-Legendre quadrature integration from a to b with n=3.static doublegaussLegendre5(ToDoubleFunction<Double> func, double a, double b) Gauss-Legendre quadrature integration from a to b with n=5.static doublegaussLegendre7(ToDoubleFunction<Double> func, double a, double b) Gauss-Legendre quadrature integration from a to b with n=7.static doublerombergQuadrature(ToDoubleFunction<Double> f, double t0, double t1) Romberg Quadrature.static doublerombergQuadrature(ToDoubleFunction<Double> f, double t0, double t1, double epsilon) Romberg Quadrature.static doublesimpson(ToDoubleFunction<Double> func, double min, double max, double eps) Estimates the integral of the given function in the given interval using Simpsons's rule.
-
Method Details
-
rombergQuadrature
Romberg Quadrature.References:
- waruyama
- github.com
- Wikipedia. Romberg's method.
- wikipedia.org
- Parameters:
f- the functiont0- the lower bound of the integralt1- the upper bound of the integral- Returns:
- the estimated integral
-
rombergQuadrature
public static double rombergQuadrature(ToDoubleFunction<Double> f, double t0, double t1, double epsilon) Romberg Quadrature.References:
- waruyama
- github.com
- Wikipedia. Romberg's method.
- wikipedia.org
- Parameters:
f- the functiont0- the lower bound of the integralt1- the upper bound of the integralepsilon- the desired precision- Returns:
- the estimated integral
-
simpson
Estimates the integral of the given function in the given interval using Simpsons's rule.simpson Based on trapzd in "Numerical Recipes in C", page 139
- Parameters:
func- the functionmin- the lower bound of the intervalmax- the upper bound of the interval- Returns:
- the area under the curve
-
gaussLegendre3
Gauss-Legendre quadrature integration from a to b with n=3.See pomax for more values.
References:
- Canvas. Copyright (c) 2015 Taco de Wolff, MIT License.
- github.com
- Parameters:
func- the functiona- the lower bound of the intervalb- the upper bound of the interval- Returns:
- the area under the curve
-
gaussLegendre5
Gauss-Legendre quadrature integration from a to b with n=5.References:
- Canvas. Copyright (c) 2015 Taco de Wolff, MIT License.
- github.com
- Parameters:
func- the functiona- the lower bound of the intervalb- the upper bound of the interval- Returns:
- the area under the curve
-
gaussLegendre7
Gauss-Legendre quadrature integration from a to b with n=7.References:
- Canvas. Copyright (c) 2015 Taco de Wolff, MIT License.
- github.com
- Parameters:
func- the functiona- the lower bound of the intervalb- the upper bound of the interval- Returns:
- the area under the curve
-