Given an ellipse:
$ax^2 + 2xy + by^2 = 1$
how can I calculate the length of the shorter and longer axis?
Given an ellipse:
$ax^2 + 2xy + by^2 = 1$
how can I calculate the length of the shorter and longer axis?
The polar equation of the ellipse is $$ar^2\cos^2\theta+2cr^2\cos\theta\sin\theta+br^2\sin^2\theta=r^2\left(\frac{a-b}2\cos2\theta+\frac{a+b}2+c\sin2\theta\right)=1.$$
The amplitude of that sinusoid is $\sqrt{\left(\dfrac{a-b}2\right)^2+c^2}$ so that the extrema of $r$ are
$$\frac2{\sqrt{a+b\pm\sqrt{(a-b)^2+4c^2}}}.$$
You have to rotate the coordinates to get rid of the $xy$ coefficient first and then bring it to the form $$ \left( \frac{x'}{r_1} \right)^2 + \left( \frac{y'}{r_2} \right)^2 = 1 $$
then $r_1$ and $r_2$ are the semi-major and semi-minor axes.
For the general equation $$ a x^2 + b y^2 + 2 c x y = 1 $$ the rotation needs to be by an angle $$\theta = \frac{1}{2} \tan^{-1} \left( \frac{2 c}{a-b} \right) $$
and the substitution $(x,y) = (x' \cos\theta - y' \sin \theta, x'\sin \theta + y' \cos \theta)$ leads to
$$\left( \frac{a+b+\sqrt{ (a-b)^2+(2 c)^2}}{2}\right) x'^2 +\left( \frac{a+b-\sqrt{ (a-b)^2+(2 c)^2}}{2}\right) y'^2 = 1 $$
or
$$ \begin{aligned} r_1 &= \sqrt{ \frac{2}{a+b+\sqrt{ (a-b)^2+(2 c)^2}} } \\ r_2 &= \sqrt{ \frac{2}{a+b-\sqrt{ (a-b)^2+(2 c)^2}} } \end{aligned}$$