So I want to integrate a double integral with constants in it, like a, b, etc where the user can asign the value of this constants:
The limits of the integral are x[0,1] and y[-1,2]
import numpy as np
import scipy.integrate as integrate
def g(y,x,a):
return a*x*y
a = int(input('Insert a value --> '))
result = integrate.dblquad(g, 0, 1, lambda x: -1, lambda x: 2, args=(a))[0]
print(result)
But I get this error and I don't understant why:
TypeError: integrate() argument after * must be an iterable, not int
I don't understand it. Because when I do the same but with quad() Python does it correctly:
import numpy as np
import scipy.integrate as integrate
def g(x,a):
return a*x
a = int(input('Insert a value --> '))
result = integrate.quad(g, 0, 1, args=(a))[0]
print(result)
With the result:
0.5