What is the best way to create a Sympy equation, do something like take the derivative, and then plot the results of that equation?
I have my symbolic equation, but can't figure out how to make an array of values for plotting. Here's my code:
from sympy import symbols
import matplotlib.pyplot as mpl
t = symbols('t')
x = 0.05*t + 0.2/((t - 5)**2 + 2)
nums = []
for i in range(1000):
nums.append(t)
t += 0.02
plotted = [x for t in nums]
mpl.plot(plotted)
mpl.ylabel("Speed")
mpl.show()
In my case I just calculated the derivative of that equation, and now I want to plot the speed x
, so this is fairly simplified.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…