Let's say I have a set of points, and I want to check if this set defines circle or ellipse or parabola or hyperbola. Is there a way I can to it?
I've found that it takes three points to define a circle. If I have the fourth point, then I can check if the point is on the circle. Specifically, if I have points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$, then I can use these formulas in my computer code:
$$\begin{align} k&:=\frac{(x_1-x_2)(x_2^2-x_3^2+y_2^2-y_3^2)-(x_2-x_3)(x_1^2-x_2^2+y_1^2-y_2^2)}{2\left(\;(y_2-y_3)(x_1-x_2)-(y_1-y_2)(x_2-x_3)\;\right)} \\[4pt] h&:=\frac{(y_1-y_2)(y_1+y_2-2k)}{2(x_1-x_2)}+\frac12(x_1+x_2) \\[4pt] r&:=\sqrt{(x_3-h)^2+(y_3-k)^2} \end{align}$$
Then, to determine where the fourth point, $(x,y)$, lies relative to the circle, I can compute $$v :=(x-h)^2+(y-k)^2-r^2$$ so that $$\begin{align} v&=\phantom{-}0 \implies \text{lies on the circle} \\ v&=\phantom{-}1 \implies \text{lies outside the circle} \\ v&=-1 \implies \text{lies inside the circle} \end{align}$$
Is there a way to do something like this for ellipse or parabola or hyperbola? Any help would be appreciated.
Assuming your set of points to be in the form of an equation,
The general equation of a conic section is a second-degree equation in two independent variables (say x,y) which can be written as
$$ \mathrm{ax^2 + 2hxy + by^2 + 2gx + 2fy + c =0} $$
There are several ways of classifying conic sections using the above general equation with the help of the discriminant $\Delta$ of this equation:
$$ \Delta = \mathrm{abc + 2fgh -af^2 -bg^2 -ch^2 }$$
If $\Delta$ not equal to 0,
If $\Delta = 0$ and $\mathrm{b^2-ab>=0}$ , the equation represents a pair of lines.