scijit.integrate.tplquad¶
- scijit.integrate.tplquad(func, a, b, gfun, hfun, qfun, rfun, args=(), epsabs=1.49e-08, epsrel=1.49e-08, limit=50)¶
Triple integral of
func(z, y, x)over a curved region.int_a^b dx int_{gfun(x)}^{hfun(x)} dy int_{qfun(x,y)}^{rfun(x,y)} func(z, y, x) dz, annquadof depth three.- Parameters:
- func@njit function
func(z, y, x, *args) -> float Integrand, innermost variable first.
- a, bfloat
Outer (x) limits. Either may be infinite.
- gfun, hfunfloat, or @njit function
g(x) -> float Lower and upper y limits.
- qfun, rfunfloat, or @njit function
q(x, y) -> float Lower and upper z limits. As callbacks they take
(x, y), outermost variable first, the opposite order from the integrand. As withgfun/hfun, a form taking theargsentries after the coordinates is accepted as well.- argstuple, optional
Extra parameters, passed to
func. Each entry is a real number or an array of real numbers.- epsabs, epsrelfloat, optional
Accuracy request, applied at all three levels.
- limitint, optional
Subdivision cap, applied at all three levels. Default 50.
- func@njit function
- Returns:
- valuefloat
Approximation to the triple integral.
- abserrfloat
The LARGEST error estimate over the three levels.
- Raises:
- TypeError
funcor a limit callback is not a plain@njitfunction, a limit callback’s arity is neither its coordinate count nor that pluslen(args), orfuncreturns a complex value.TypingErrorinside@njitfor the first two, which are compile-time questions.- ValueError
An
argsentry is not a real number or an array of them, or QUADPACK refuses the settings of some level, which isquad()’s own set of conditions.
See also
scipy.integrate.tplquadThe scipy routine this mirrors.
Notes
limithas no scipy counterpart, and a limit callback taking theargsentries after its coordinates is additive. No scipy-shaped call reaches either.Examples
>>> import numpy as np >>> from numba import njit >>> import scijit.integrate as si >>> @njit ... def f(z, y, x): # innermost variable FIRST ... return x * y * y * z * z * z >>> @njit ... def run(): # box 0<x<1, 0<y<2, 0<z<3 ... return si.tplquad(f, 0.0, 1.0, 0.0, 2.0, 0.0, 3.0)[0] >>> run() 26.999999999999996