I am trying to find the equation of a parabola with the two tangent equations to two points.
I found this post (Find the equation of the parabola given the tangent to a point and another point.) but it did not really help me so I tried to do the math on my own.
First:
- I have two points whose coordinates I know,
- I have two lines passing through these points whose slope I know because of their angles of inclination.
Let's say that these lines are tangents to a parabola in these two points.
How can I find the equation of this parabola given the two tangent equations and the two points ?
Here is a picture of my calculations:
According to the picture I drew I am suppose to get the following equation:
$f(x) =\dfrac{\tan(\alpha)-\tan(\beta)}{2 \cdot x_1}\cdot x^2 + \tan(\beta)\cdot x + y_2$
When I plot $f(x) =\dfrac{\tan(60)-\tan(30)}{-2 \cdot 10}\cdot x^2 + \tan(30)\cdot x + 10$ I get the following graph:
As you can see I do not get the graphic drawn in the first picture, and if I set the window to $x\in\left[x_1,0\right]$ and $y\in\left[0,y_2\right]$ I get an empty window:
What am I doing wrong ?
I hope my explanations are good enough. Please tell me if I was not clear so that I can modify my post for you and others.
Your solution is correct assuming that that parabola’s axis is parallel to the $y$-axis. This is not the case for arbitrary point-tangent pairs, though. In particular, with $x_1=-10$, $\alpha=60°$, $y_2=10$, $\beta=30°$, the parabola’s axis is tilted 45° from the $y$-axis, so can’t be represented by an equation of the form $y=ax^2+bx+c$.
You need to start with a more general equation of a parabola, such as $(Ax+By)^2+Dx+Ey+F=0$. Another approach is to use a quadratic Bézier parameterization, for which you have enough information, and eliminate the parameter to get an implicit Cartesian equation for the parabola.
Using the latter method with your example, the third control point is the intersection of the two tangent lines, which you can find to be $\left(-15+5\sqrt3,15-5\sqrt3\right)$, which produces the parameterization $$x = -10(1-t)^2+10(\sqrt3-3)(1-t)t \\ y = -10(\sqrt3-3)(1-t)t+10t^2.$$ Eliminating $t$ yields the equation $$x^2+2xy+y^2-20(2+\sqrt3)x+20(2+\sqrt3)y-500-200\sqrt3=0.$$