I wish to do the following integral in python using the tplquad function in scipy:
So far, I've used the syntax below:
def func(z, y, x):
return (x**(b1 + x1 - 1))*(y**(b2 + x2 - 1))*(z**(b3 + x3 - 1))*((1-x-y-z)**(x4+b4-1))
t1 = tplquad(func, 1/2, 1, lambda y: 0, lambda y: 1-y, lambda y, z: 0, lambda y, z: 1 - y - z)
where func is the function we want to integrate: f(p_1, p_2, p_3), z is p_3, y is p_2, x is p_1
Can anyone tell me what the correct syntax for using tplquad here should be?
EDIT: I'm having trouble with the limits - if the limits, if the limits of the inner most integral were 0 to p1, what would I use as the limits in terms of lambda functions?