The full mathematical problem is here.
Briefly I want to integrate a function with a double integral. The inner integral has boundaries 20
and x-2
, while the outer has boundaries 22
and 30
.
I know that with Scipy I can compute the double integral with scipy.integrate.nquad
. I would like to do something like this:
def f(x, y):
return (x ** 2 + y ** 2)
res = sp.integrate.nquad(f, [[22, 30], [20, x-2]])
Is it possible? Maybe using also sympy
?
I solved with
sympy
:Basically
sympy.integrate
is able to deal with multiple integrations, also with variable boundaries.