scijit.integrate.dblquad¶
- scijit.integrate.dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-08, epsrel=1.49e-08, limit=50)¶
Double integral of
func(y, x)over a curved region.int_a^b dx int_{gfun(x)}^{hfun(x)} func(y, x) dy, annquadof depth two.- Parameters:
- func@njit function
func(y, x, *args) -> float Integrand, with the inner variable first.
- a, bfloat
Outer (x) limits. Either may be infinite.
- gfun, hfunfloat, or @njit function
g(x) -> float Lower and upper inner (y) limits. Either may be a constant or a callback, in any combination. A callback receives the outer coordinate alone; a form taking the
argsentries after it 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 both levels.
- limitint, optional
Subdivision cap, applied at both levels. Default 50.
- func@njit function
- Returns:
- valuefloat
Approximation to the double integral.
- abserrfloat
The LARGEST error estimate over both levels.
- Raises:
- TypeError
funcor a limit callback is not a plain@njitfunction, a limit callback’s arity is neither1nor1 + len(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 either level, which isquad()’s own set of conditions.
See also
scipy.integrate.dblquadThe scipy routine this mirrors.
Notes
limithas no scipy counterpart, and a limit callback taking theargsentries after its coordinate 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(y, x): # inner variable FIRST ... return x * y * y >>> @njit ... def hfun(x): ... return 1.0 - x >>> @njit ... def run(): ... return si.dblquad(f, 0.0, 1.0, 0.0, hfun)[0] >>> run() 0.016666666666666666