I have a function, I want to get its integral function, something like this:

That is, instead of getting a single integration value at a point, xI need to get the values at multiple points.
For example:
Say I want a range in (-20.20)
def f(x):
return x**2
x_vals = np.arange(-20, 21, 1)
y_vals =[integrate.nquad(f, [[0, x_val]]) for x_val in x_vals ]
plt.plot(x_vals, y_vals,'-', color = 'r')

Problem
In the above code example, for each point, integration is performed from scratch . In my real code, it’s f(x)quite complicated and it’s multiple integration, so the runtime is just too slow ( Scipy: speed up integration by doing this for the whole surface? ).
I am wondering if there is a way to efficiently generate Phi(x)in a date range.
My notes:
Phi(20) - Phi(19), Phi(19) - Phi(18) .. , Phi(20), (-20,-19,-18,-17 ... 18,19,20). , .
, , , , save point, . 20 (-20,-19,-18,-17 ... 18,19,20)