Package Scientific :: Package Functions :: Module Romberg
[hide private]
[frames] | no frames]

Module Romberg



Numerical integration using the Romberg algorithm

Functions [hide private]
  _difftrap(function, interval, numtraps)
  _romberg_diff(b, c, k)
number romberg(function, interval, accuracy=9.9999999999999995e-08)
Numerical integration using the Romberg method
number trapezoid(function, interval, numtraps)
Numerical integration using the trapezoidal rule

Function Details [hide private]

_difftrap(function, interval, numtraps)

 

_romberg_diff(b, c, k)

 

romberg(function, interval, accuracy=9.9999999999999995e-08)

 

Numerical integration using the Romberg method

Example:
 >>>from Scientific.Functions.Romberg import romberg
 >>>from Numeric import pi, tan
 >>>romberg(tan, (0.0, pi/3.0))

 yields '0.693147180562'
Parameters:
  • function (callable) - a function of one variable
  • interval (sequence of two floats) - the lower and upper limit of the integration interval
  • accuracy (float) - convergence criterion (absolute error)
Returns: number
the numerical integral of the function over the interval

trapezoid(function, interval, numtraps)

 

Numerical integration using the trapezoidal rule

Example:
 >>>from Scientific.Functions.Romberg import trapezoid
 >>>from Numeric import pi, tan
 >>>trapezoid(tan, (0.0, pi/3.0), 100)

 yields 0.69317459482518262
Parameters:
  • function (callable) - a function of one variable
  • interval (sequence of two floats) - the lower and upper limit of the integration interval
  • numtraps (int) - the number of trapezoids
Returns: number
the numerical integral of the function over the interval