Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fun(x,y):
- return a*x
- def rk4(x,y,h):
- K1 = fun(x,y)
- K2 = fun(x+1/2*h, y+1/2*K1*h)
- K3 = fun(x+1/2*h, y+1/2*K2*h)
- K4 = fun(x+h, y+K3*h)
- y1 = y - 1/6*(K1+K2+K3+K4)*h
- return y1
- def updateSphere(part, dt):
- # tutaj trzeba dodać obsługę sił, w tym grawitacji
- global t
- t += dt
- h = dt
- y = part.v[1]
- x = t
- y1= rk4(x,y,h)
- part.v[1] = y1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement