<s>[INST] implicit equation for elliptical torus I just wondering what the implicit equation would be if an ellipse with major axis a and minor axis b, rotating about the Z axis with a distance of $R_0$. The $R_0$>a and $R_0$>b which means the rotation will result in a non-degenerate torus. 
My aim is to determine if some points are inside the toroidal surface. The surface is shown in the image found online. 
 
 [/INST] You can obtain this as follows.
If you start with a slice where $y = 0$, you begin with the equation
$$
\frac{z^2}{a^2} + \frac{(x - R_0)^2}{b^2} - 1 = 0
$$
However, this doesn't give you the rotated version; to rotate it about the $z$-axis, simply replace the $x$ by $\sqrt{x^2 + y^2}$, yielding
$$
\frac{z^2}{a^2} + \frac{\Big(\sqrt{x^2 + y^2} - R_0\Big)^2}{b^2} - 1 = 0
$$
This is a little unsatisfying though, since polynomials are much nicer than radicals. However, a little bit of manipulation yields
$$
\frac{z^2}{a^2} + \frac{x^2 + y^2 + R_0^2}{b^2} - \frac{2R_0}{b^2}\sqrt{x^2 + y^2} - 1 = 0
$$
which, if you isolate the radical and square both sides yields
$$
\bigg(\frac{z^2}{a^2} + \frac{x^2 + y^2 + R_0^2}{b^2} - 1\bigg)^2 - \frac{4R_0^2}{b^4}(x^2 + y^2) = 0
$$
Voila, a polynomial!
</s>