Class Integrals

java.lang.Object
org.jhotdraw8.geom.Integrals

public class Integrals extends Object
Provides algorithms for computing the integral of a function.
  • Method Details

    • rombergQuadrature

      public static double rombergQuadrature(ToDoubleFunction<Double> f, double t0, double t1)
      Romberg Quadrature.

      References:

      waruyama
      github.com
      Wikipedia. Romberg's method.
      wikipedia.org
      Parameters:
      f - the function
      t0 - the lower bound of the integral
      t1 - 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 function
      t0 - the lower bound of the integral
      t1 - the upper bound of the integral
      epsilon - the desired precision
      Returns:
      the estimated integral
    • simpson

      public static double simpson(@NonNull ToDoubleFunction<Double> func, double min, double max, double eps)
      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 function
      min - the lower bound of the interval
      max - the upper bound of the interval
      Returns:
      the area under the curve
    • gaussLegendre3

      public static double gaussLegendre3(@NonNull ToDoubleFunction<Double> func, double a, double b)
      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 function
      a - the lower bound of the interval
      b - the upper bound of the interval
      Returns:
      the area under the curve
    • gaussLegendre5

      public static double gaussLegendre5(@NonNull ToDoubleFunction<Double> func, double a, double b)
      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 function
      a - the lower bound of the interval
      b - the upper bound of the interval
      Returns:
      the area under the curve
    • gaussLegendre7

      public static double gaussLegendre7(@NonNull ToDoubleFunction<Double> func, double a, double b)
      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 function
      a - the lower bound of the interval
      b - the upper bound of the interval
      Returns:
      the area under the curve