Assume that I have four points $P_1, P_2, P_3, P_4$. These points lie on the 2d plane and take the form $P_i = (x_i, y_i)$
Assume that I define line $L_{ij}$ as the line passing through $P_i$ and $P_j$.
How do I find the coefficients $a$ and $b$ in the equation for an ellipse $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$ such that the ellipse passes through points $P_2$ and $P_3$ AND has both tangent lines $L_{12}$ and $L_{34}$?
EDIT: I am using this formula to smooth a graph I'm drawing in python's matplotlib.pyplot. I have two line segments $L_{12}$ and $L_{34}$ that I need to draw a smooth connection through, and an ellipse seems like a good shape for this.


The slop of lines $L_{12}$ and $L_{34}$ are easily computed and we know that the slop of $L_{12}$ is the value of derivation $y\prime$ in $$\frac{x_2}{a^2}+\frac{y_2y'}{b^2}=0 $$ and similarly for the slope of $L_{34}$ the same argument holds, this time $y\prime$ being the slop of $L_{34}$.
There fore we have two linear equations with unknowns $a^2$ and $b^2$. This system of linear equations can easily be solved and also we may decide if any 4-tuple $(P_1,P_2,P_3,P_4)$ makes such ellipse.