# Calculating position of a particle at time $t$ in a gravitational field

I'm working on a piece of code that is supposed to visualize a particle bouncing up and down from the ground (somehow magically we can give it velocity upwards when it is on the ground). I figured that I'd try to remember my high school physics and find the formula myself.

So, I have a particle on the ground ($distance = 0$) at $t_0 = 0$. It's given an initial velocity $v_0$. The task is to calculate the distance from the ground at $t = t_1$

Force due to gravity is $F_g = a*m = {-GMm}/{d^2}$, giving that $a = M/d^2$ (I drop $G$ since it has no use in my application).

Then, onto integrating. Integral of acceleration is velocity, and integral of velocity is distance. Bingo!

Given that $t_0 = 0$ $$v = v_0 - \int_{t_0}^{t_1} \frac{M}{d^2}dt = v_0 - \frac{Mt_1}{d^2}\\ d = \int_{t_0}^{t_1}vdt = v_0t_1 - \frac{Mt_1^2}{2d^2}$$

Manipulating this a bit, I get $2d^3 - 2d^2*v_0t_1 + Mt_1^2 = 0$

Ok, time to test this. Let's see what I get if I set the initial velocity to $10$, $t_1$ to $1$, and $M$ to $100$.

$$2d^3 - 2d^2*(10)(1) + (100)(1)^2 = 0$$

Running this through R

z <- c(100, 0, -20, 2)
polyroot(z)
# returns
# [1]  2.599243+0i -2.038016+0i  9.438772-0i


There are 3 roots! What?

Where did I go wrong?

• You can't just drop $G$ (or the minus sign!) because you 'have no use for it'! Also, $a=\frac{d^2 r}{dt^2}$. Your equations make very little sense and you freely mix up $d$ and $r$. You also might want to decide whether you're bouncing from a great height or a small one: the latter case is easier to derive. – Gert Nov 7 '15 at 16:59
• I'm not bouncing from a great or small height. The particle (magically) gets upward velocity when it's on the ground – Anton Nov 7 '15 at 17:13
• If your lower bound is the floor at $d=0$, you can drop the negative root, no? – Kyle Kanos Nov 7 '15 at 17:14
• @KyleKanos Yes I can. You're right. But, that still leaves me with $2.59$ and $9.44$. – Anton Nov 7 '15 at 17:15
• Though if you're trying to model this, I'd suggest that you're going about it the wrong way. You are more likely going to want to use the leapfrog method (or something similar). – Kyle Kanos Nov 7 '15 at 17:17

So the first problem for you to meditate on is: $\int dt~ r \ne r t,$ because $r = r(t)$ is going to be depending on time. For example, if something is purely falling up/down radially towards/away from the Earth, then the proper expression is instead:$$m \ddot r = -\frac{GM}{r^2},$$and the proper way to solve this is to multiply both sides by $\dot r$ to find:$$m\ddot r\dot r = -\frac{GM}{r^2}~\dot r,$$ which is helpful because both sides are the result of the chain rule:$$m~\frac {d}{dt}\left(\frac{\dot r^2}2\right) = GM \frac{d}{dt}\left(\frac{1}r\right).$$In other words,$$v = \sqrt{v_0^2 + \frac{2GM}{m}\left(\frac1{r} - \frac1{r_0}\right)}.$$
As long as you're concerned with distances in the air that are less than, say, the distance from the ground to the clouds, you can make the following simplification: the radius is some big $R$ due to Earth's size plus some tiny $y$ due to the particle's vertical motion. This means that the force is:$$\frac {GM}{(R + y)^2} = \frac{GM}{R^2}\left(1 - \frac{2y}{R} + \frac{3y^2}{R^2} - \dots\right).$$ If $y$ is less than $1\text{ km}$ then the term $2y/R$ will be at most one part in 3,000 and the term $3y^2/R^2$ will be at mose one part in 10,000,000. If you don't care about that accuracy, just ignore them!
Then you have the constant acceleration problem $\ddot y = a$ for constant $a = -GM/R^2,$ and this you can solve by your method, getting the ubiquitous expression $$y = \frac12 a t^2+ v_0 t + y_0.$$