[SciPy-user] about integrate.tplquad

guillem at torroja.dmt.upm.es guillem at torroja.dmt.upm.es
Mon Jul 11 19:13:17 CDT 2005


hi

I was trying to solve the following integral

          / / /          dx dy dz
          | | |    -------------------
          / / /    SQRT(z + y + x + 2)

         I(x,y,z) = [0,2]x[0,1]x[-1,4]

with the following script

from scipy_base import *
from scipy.integrate import tplquad

lower_bound_z= lambda x,y : -1.
upper_bound_z= lambda x,y : 4.

lower_bound_y= lambda x: 0.
upper_bound_y= lambda x: 1.

lower_bound_x = 0.
upper_bound_x = 2.

func = lambda x,y,z: 1./sqrt(x+y+z+2.)

B=tplquad(func,
          lower_bound_x,
          upper_bound_x,
          lower_bound_y,
          upper_bound_y,
          lower_bound_z,
          upper_bound_z
print B
print 1688/15-B[0]

The result should be 1688/15 (112.53) but I get (4.6750890836723107,
5.1903915428667244e-14) and I really can't find anything wrong.

Can anyone give me a clue?

thanks in advance

-----
Guillem Borrell Nogueras
ETSIA CFD lab.
guillem at torroja.dmt.upm.es
guillemborrell at gmail.com



More information about the SciPy-user mailing list