With pyplot you can plot a function with
x = np.linspace(-10, 10, num=100) #start x, end x, number of points on line
fx = []
for i in range(len(x)):
fx.append(-2*x[i]**3 - 35*x[i]**2 + 39*x[i] + 70) #creates function f(x)
plt.plot(x, fx) #plots function f(x)
plt.grid() #adds grid
plt.axvline() #adds line at x=0
plt.axhline() #adds line at y=0
plt.show() #actually makes graph appear
this will plot the function f(x) = -2x3-35x2+39x+70, but how do you make it so it will graph a function that you input?
I've tried just feeding in a string that follows the same format as what it is normally with
foo = "4*x[i]**3"
fx.append(foo)