hello, so I have run into a little bit of trouble. I was creating newtons cannon in excel and it dose not work as supposed to. What happens is a very powerful slingshot effect. It will stay on orbit for a while, but eventually it will fly away.

my code looks like that. maa - earth ; kuul-bullet ; v-velocity
Because it is still in a test phase, I have left out some constants that do not change the orbits shape.

//setting centre
x0 = maa.Left + maa.Width / 2
y0 = maa.Top + maa.Height / 2
//mass
m = Sheets("nwkahur").Range("a2").Value
// input speed
vx = Sheets("nwkahur").Range("A1").Value
vy = 0

//movement
Do
x = x0 - kuul.Left + kuul.Width / 2
y = y0 - kuul.Top + kuul.Height / 2
r = (x ^ 2 + y ^ 2) ^ (1 / 2)

//new position

kuul.Left = kuul.Left + vx
kuul.Top = kuul.Top + vy
//new velocity
vx = vx + m / (r ^ 3) * x
vy = vy + m / (r ^ 3) * y

pause 0.0001

loop



I can understand that the problem is in calculations but, I cant but my finger on it. I would be very grateful, if you could help.


Kristjan Vilgo