I am programming a ball falling down from a cliff and bouncing back. The physics can be ignored and I want to use a simple $y = ax^2$ parabola to draw the falling ball.
I have given two points, the edge of the cliff at $C(-0.9; 0.8)$ and the point where the ball hits the bottom $B(0.1; -1.05)$. Due to its symmetry we know there is another point at $A(-1.9; -1.05)$. So that are 3 points I could work with. $C$ is the vertex.
I've tried this approach but my parabola is not as exact as I need it to estimate for example the intersects with the x- or y-axis.
As the legs of the parabola are down, all I can tell is that $a$ is negative:
$$
y = ax^2 + bx +c; a < 0
$$
I tried drawing it in Excel which allows to add an polynomial trendline. This is the best approximation I could do so far (dotted line).
But I need the function. Is it somehow possible to calculate the equation somehow?
Best Answer
Linear equation is the way to go. If you work it all out you'll get formulas for coefficients below: $$ a = \frac{y_2(x_3 - x_1) - y_1(x_3 - x_2) - y_3(x_2 - x_1)}{x_1^2(x_2 - x_3)-x_3^2(x_2-x_1)-x_2^2(x_1-x_3)} $$ $$ b = \frac{y_2 - y_1 + a(x_1^2 - x_2^2)}{x_2 - x_1} $$ $$ c = -ax_1^2 - bx_1 + y_1 $$