Open with one click!
In [1]:
import sys sys.version
'3.6.9 (default, Nov 7 2019, 10:44:02) \n[GCC 8.3.0]'
In [2]:
from scipy.integrate import quad
In [3]:
import numpy as np def f(x): return 2 * x**2 - 5 * x + 1 def g(x): a = np.sin(f(x - 1)) b = f(x**2) return a * b
In [4]:
quad(g, -5, 5)
(-88.47259860602325, 6.792159306545877e-07)
In [5]:
xx = np.linspace(-5, 5, 1000) yy = g(xx)
In [6]:
import matplotlib.pyplot as plt plt.plot(xx, yy) plt.grid()
In [ ]:
In [ ]: