from scipy.integrate import quad
result = quad(my_function, a, b)
"""
quad 1-Dim function
dblquad, tplquad, nquad 2, 3, N-Dim respectively
my_function is a Python-def function
a special function from scipy (check documentation)
or a lambda function
a, b: integration interval
"""
from scipy import integrate
>>> x2 = lambda x: x**2
>>> integrate.quad(x2, 0, 4)
(21.333333333333332, 2.3684757858670003e-13)
>>> print(4**3 / 3.) # analytical result
21.3333333333