I am writing a computer program that needs to be able to find positions in parabolic arcs.
I need to calculate the position of a projectile after traveling a given distance. I have $X_0, Y_0, X_1, Y_1$, and $Y_{max}$. What is the equation I would use to find $Y$ at a given $X$ value?
Since this is for a computer program, the answer should be in the form of a single equation. It may be assumed that the initial variables are valid.
$\endgroup$ 63 Answers
$\begingroup$Use the equation
$y=a(x-h)^2+k$
for a parabola with turning point (vertex) $(h,k)$
Substituting $Y_{max}$ for k gives
$$y=a(x-h)^2+Y_{max}$$
Now, substituting the pairs of points $(X_0,Y_0)$ and $(X_1,Y_1)$ gives the simultaneous equations
$$\begin{cases} Y_0=a(X_0-h)^2+Y_{max} \\ Y_1=a(X_1-h)^2+Y_{max} \end{cases}$$
Solving this simultaneous should give you the values of $h$ and $a$ in terms of $X_0,Y_0,X_1,Y_1$ and $Y_{max}$, which can then be plugged into the turning point equation to give the equation of the parabola. This equation can then be used to calculate any $Y$ for a given $X$ value.
Update: Rearranging the equation $$Y_0=a(X_0-h)^2+Y_{max}$$ gives $$\frac{Y_0-Y_{max}}{a}=(X_0-h)^2$$ Since the right hand side of this equation is positive, if
$Y_0-Y_{max}<0$ , then $a<0$.
On the other hand, if
$Y_0-Y_{max}>0$, then $a>0$.
This should eliminate one of the two solutions to the simultaneous equation.
$\endgroup$ 2 $\begingroup$There is an article on wikipedia that may help you:
and
They take the basic points and velocities(even though you don't have those) and find all other factors of parabolic path.
I don't know if this will answer everything, but I'm sure it might help.
$\endgroup$ $\begingroup$Let parabola pass through points $Q(X_0, Y_0), V(v, Y_{\text{max}}), R(X_1, Y_1)$, where $v$ is unknown.
Translate parabola so that it touches the $x-$axis by subtracting all $y-$coordinates by $Y_\text{max}$, to give $Q'(X_0, y_0), V'(v, 0), R'(X_1, y_1)$ where $y_i=Y_i-Y_\text{max} (i=0,1)$.
Equation of translated parabola $$y=A(x-v)^2$$
Substitute coordinates of $Q', R'$to find $A, v$. After some algebraic manipulation, we have $$A=\left(\frac {\sqrt{y_0}\pm\sqrt{y_1}}{X_0-X_1}\right)^2\\ v=\frac {\sqrt{y_0}\;X_1\pm\sqrt{y_1}\;X_0}{\sqrt{y_0}\pm\sqrt{y_1}}$$
See desmos implementation here.
Add back $Y_\text{max}$ to get equation of original parabola $$y=A(x-V)^2+Y_\text{max}$$
$\endgroup$