Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import math
- x = [0]
- y = [0]
- u = [1]
- h = 0.01
- i = 0
- while i <= 20000:
- x.append(x[i] + h)
- y.append(y[i] + h * u[i])
- u.append(u[i] + h * (- 0.64 * math.sin(y[i])))
- i += 1
- plt.plot(y, u)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement