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

Class SimpsonsIntegrator

  • public class SimpsonsIntegratorextends IterativeMethod

    The extended Simpson's rule for numerically integrating functions.

    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 Simpson's integrator is created with the above function:

     SimpsonsIntegrator integrator = new SimpsonsIntegrator(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); 


    1. Eric W. Weisstein. "Newton-Cotes Formulas." From MathWorld--A Wolfram Web Resource.
    2. Eric W. Weisstein. "Simpson's Rule." From MathWorld--A Wolfram Web Resource.

    • Constructor Detail

      • SimpsonsIntegrator

        public SimpsonsIntegrator(Function f)
        Create an integrator for the given function.
        f - the target function.
      • SimpsonsIntegrator

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

      • getFunction

        public Function getFunction()
        Access the target function.
        the target function.
      • integrate

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

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

DataMelt 1.1 © jWork.ORG

Warning: You see this message because an access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To enable the description of all Java classes of dataMelt, please request the full DataMelt membership.

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