Skip to content
Rugen Heidbuchel edited this page Apr 30, 2015 · 6 revisions

The Integration class currently support single variable function integration. Several methods are implemented, but the general integrate function still has to be written.

Constants

Two constants define the basic behaviour of the Integration class:

  • INTEGRATION_ACCURACY: defines the allowed error on the integration, standard is 10^-7
  • INTEGRATION_MAX_TIME: defines the allowed time for the integration, standard set on 10 seconds Both constants can be altered, so that the values don't have to be passed to every function call.

Methods

midpoint

Uses the simple iterative midpoint rule.

parameters:

  • a: Double: The beginpoint of the interval.
  • _ b: Double: The endpoint of the interval.
  • error err: Double: The accuracy, standard set on INTEGRATION_ACCURACY.
  • k_max: Double: The maximum number of iterations, standard set on 100.
  • maxTime t_m: Double: The maximum allowed time in seconds, standard set on INTEGRATION_MAX_TIME.
  • _ f: (Double) -> Double: The function.

trapezoid

Uses the simple iterative trapezoid rule.

parameters:

  • a: Double: The beginpoint of the interval.
  • _ b: Double: The endpoint of the interval.
  • error err: Double: The accuracy, standard set on INTEGRATION_ACCURACY.
  • k_max: Double: The maximum number of iterations, standard set on 100.
  • maxTime t_m: Double: The maximum allowed time in seconds, standard set on INTEGRATION_MAX_TIME.
  • _ f: (Double) -> Double: The function.

simpson

Uses the simple iterative Simpson rule.

parameters:

  • a: Double: The beginpoint of the interval.
  • _ b: Double: The endpoint of the interval.
  • error err: Double: The accuracy, standard set on INTEGRATION_ACCURACY.
  • k_max: Double: The maximum number of iterations, standard set on 100.
  • maxTime t_m: Double: The maximum allowed time in seconds, standard set on INTEGRATION_MAX_TIME.
  • _ f: (Double) -> Double: The function.

adaptiveSimpson

Uses the adaptive Simpson rule.

parameters:

  • a: Double: The beginpoint of the interval.
  • _ b: Double: The endpoint of the interval.
  • error err: Double: The accuracy, standard set on INTEGRATION_ACCURACY.
  • k_max: Double: The maximum number of iterations, standard set on 100.
  • maxTime t_m: Double: The maximum allowed time in seconds, standard set on INTEGRATION_MAX_TIME.
  • _ f: (Double) -> Double: The function.

To Do

  • Implement general integrate function.
  • Implement Gauss-Kronrod Adaptive Quadrature
  • Implement Clenshaw-Curtis Adaptive Quadrature
  • Implement Multi-parameter integration
Clone this wiki locally