Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- def run(n):
- # euler integratie
- u = [
- 1
- ]
- t = 1
- for h in range(0, n):
- u.append(u[h] + ((u[h] / t) * t))
- plt.plot(u)
- print(u)
- for h in range(0, n):
- # heuns integratie?
- p = ((u[h] / 1) + (u[h + 1] / 2))
- u[h + 1] = u[h] + (0.5 * p) * t
- print(u)
- plt.plot(u)
- plt.show()
- run(5)
- run(10)
- run(20)
- run(100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement