def f(x):
    return x ** 2
x_vals = np.arange(-20, 21, 1)
pieces = [si.quad(f, x_vals[i], x_vals[i + 1])[0] for i in range(len(x_vals
    ) - 1)]
Scipy: efficiently generate a series of integration (integral function)