How to change support of multivariate integral to [0,1]^k using scipy.integrate.quad?
问题 The following k-dimension integral has dependent limits (a support dependent on gamma ): from scipy.integrate import nquad import numpy as np def func(*args): gamma = args[-1] var = np.array(args[:-1]) return (1-1/(1+gamma-np.sum(var)))*np.prod(((1+var)**-2)) def range_func(*args): gamma = args[-1] return (0, gamma-sum(args[:-1])) gamma, k = 10, 2 print(nquad(func, [range_func]*k, args=(gamma,) )) The limits are defined inside the function range_func above return (0, gamma-sum(args[:-1])) How