Vertical movement of an object with gravitational acceleration not constant I don't know how to start, but i will give you some context: Let's say that we have a body that we want to vertically propel at a distance of $h_f=10$ km of it's original spot considering that the altitude from which we trow it is $h_0=0$ and the radius of the earth is $R=6371$ km. So, we can obtain the initial gravitational acceleration experimented by the body of $g_0=9.81365 
\frac{m}{s^2}$ . If we consider this initial gravitational acceleration is constant while the distance
from the body to the center of gravity rises, then we can further calculate the initial velocity at which we have to throw the object to rise 10 km using the the law of conservation of energy obtaining: $$\frac{mv_0^2}{2}=m\cdot g_0 \cdot h_f \implies v_0\simeq{443}\frac{m}{s}$$
Now, the question comes: Let's say that we throw the same object with the same initial velocity, but consider that at the smallest time interval($\Delta t\to 0$) or at the most distance interval($\Delta d \to 0$), momentarily will stuck with the last, the gravitational acceleration changes because the body rises from its original spot and furthers from the earth, then what is the actual height that it reaches?
I made a program in which you establish the intended height to be reached with a constant gravitational acceleration from which to be calculated the initial speed of propulsion and a distance interval at which to take into account modifications in the gravitational acceleration to obtain the actual height reached with the same initial speed. Finally for the example I gave, I observed the smaller the distance at which the change in gravitational acceleration is taken into account, more specifically 0.1 m, the current height will tend to a value in our case to $10.015...$ km and something, $\approx 15$ m. I know that is insignificant for small speeds, but is there an actual formula for this case? I will let you some equations that i work with and if you want the code(c++) just ask me.
$$g \left( h_k \right) = g_0 \cdot \frac{\left( R+h_0 \right)^2}{{\left( R+h_k \right)^2}}= g_0 \cdot \frac{R^2}{\left( R+h_k \right)^2}$$
$$d_k = R + h_k$$
$$g_{average} = \frac{|v_f-v_0|}{t} = \frac{v_0}{t} \text{,} v_f = 0 \frac{m}{s} \text{(1)}$$
$$\left.
\begin{array}{l}
v_{average} = \frac{h_f - h_0}{t}\\
v_{average} = v_0 - g_{average} \cdot \frac{t}{2}
\end{array}
\right\}
\implies \frac{v_0}{2} = \frac{h_f - h_0}{t} \implies h_f = \frac{v_0 \cdot t}{2} + h_0$$
$$A_{average} = \frac{g_f -g_0}{t} = \frac{g_0 \cdot \frac{d_0^2}{d_f^2} - g_0}{t} = \frac{g_0 \cdot \left( d_0^2-d_f^2 \right)}{d_f^2 \cdot t} \text{(average supraacceleration of gravitational acceleration)}$$
$$g_{average} = g_0 + a_{average} \cdot \frac{t}{2} = \frac{g_0 \cdot \left( d_0^2+d_f^2 \right)}{2 \cdot d_f^2} \text{(2)}$$
$$\text{Consider } h_k = h_0 + k \cdot \Delta d \implies d_k = d_0 +  k \cdot \Delta d \text{ and } g_k = g_0 \cdot \frac{d_0^2}{d_k^2} \text{, where } n \cdot \Delta d = h_f \text{ .}$$
$$\frac{m \cdot v_0^2}{2} = m \cdot g_0 \cdot \Delta d + m \cdot g_1 \cdot \Delta d +\text{...}+ m \cdot g_{n-1} \cdot \Delta d \implies \frac{m \cdot v_0^2}{2} = m \cdot g_0 \cdot \Delta d \cdot d_0^2 \cdot \sum_{i=0}^{n-1} \frac{1}{\left( d_0 + i \cdot \Delta d \right)^2}$$
The problem is that I basically work with two unknowns, space and time and what i reach if I  equal the first $g_{average} \text{(1)}$ with the second $g_{average} \text{(2)}$ and replace $h_f \text{ with }\frac{v_0 \cdot t}{2} + h_0$ and further make calculus i reach a cubic equation with the single unknown, t.
Only, hope that it's not a stupid question! Also, what happens if instead of taking into account the smallest space interval($\Delta d \to 0$) we take the smallest interval of time($\Delta t \to 0$)?
 A: Lets start with the Newton gravitation law at the earth surface
$$m\,g_0=\frac{m\,M\,G}{R^2}\quad\Rightarrow\quad
g_0=\frac{M\,G}{R^2}$$
and at h meter above  the earth surface
$$g(h)=\frac{M\,G}{(R+h)^2}=\frac{M\,G}{\left[R(1+\frac hR)\right]^2}=
\frac{g_0}{(1+\frac hR)^2}$$
the equation of motion
$$\ddot h=-g\,(h)$$
with the initial condition $~h(0)=0~,\dot h(0)=v_0~$ you can solve (numerically)  the above differential equation   and obtain the solution h(t)

you can solve this problem also with the energy conservation
E=total energy= kinetic energy + potential energy = constant
$$ E=\frac 12 \dot h^2+U(h)\\
U(h)=-\int\,g(h)\,dh=-\frac {g_0\,R}{1+\frac hR}\quad\Rightarrow\\
E=\frac 12 \dot h^2-\frac {g_0\,R}{1+\frac hR}$$
at $~t=0,~E_0=E(h=0~,\dot h=v_0)$
$$E_0=\frac 12\,v_0^2+g_0\,R=\rm constant$$
the maximal height is achieved when the velocity  $~\dot h~=0~$
thus , solving the equation $~E(\dot h=0)=E_0~$ for h you obtain the maximal height.
$$h=\frac{v_0^2\,R}{2\,g_0\,R-v_0^2}\quad,v_0^2 > 2\,g_0\,R$$
this is the exact solution
