[SciPy-user] Triple integral with Gaussian quadrature
Robert Kern
rkern at ucsd.edu
Thu Oct 6 04:46:34 CDT 2005
Nils Wagner wrote:
> Hi all,
>
> Is there a way to compute a triple integral via Gaussian quadrature in
> scipy ?
> A small example would be appreciated.
>
> What integration method is used in
> tplquad(func, a, b, gfun, hfun, qfun, rfun, args=(),
> epsabs=1.4899999999999999e-08, epsrel=1.4899999999999999e-08) ?
It's just quad() run over the function defined by doing the double
integral over the remaining dimensions (and the double integral is also
implemented with quad() by integrating over the function defined by
doing the integral using quad() to finally integrate over the last
dimension). quad() comes from QUADPACK. Exactly which QUADPACK function
is called depends on the inputs; infinite bounds require one function,
weighted integrals require others, explicit breakpoints require yet
another. You can figure which by looking at the source code in
Lib/integrate/quadpack.py, and then you can read the documentation in
Lib/integrate/quadpack/readme to learn about the algorithms used by
those functions.
In order to do triple integrals with Gaussian quadrature, you can
probably do a similar recursive scheme like tplquad() does. You can read
the source for details.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the SciPy-user
mailing list