```   We have already seen, separately, the various types of conics (see, for example, here,
here, here, here, here). Now we try to unify them.  A conic is a curve obtained as the intersection of the surface of a cone with a plane.
If I look at the conicae from the top of the cone, they all seem circular.

That is why you can not distinguish the type of conic that you are observing if you
do not take into account the point of view (see).

a*x^2 + b*x*y + c*y^2 + d*x + e*y + f = 0, with at least one between a, b and c other
than 0, in the plane x,y is a conic (see).  Let Q = b^2-4*a*c;
if Q = 0 is a parabola, if Q > 0 is an hyperbola, if Q <0 is an ellipse.
Example:

F = function(x,y) 4/3*x^2+x*y/2+y^2-7*x-8*y-32
PLANE(-20,20, -20,20); CURVE(F, "blue")     # I change the scale ... It's an ellipse. And in fact (1/2)^2-4*4/3*1 = -5.083333 < 0

I can also study it using the Conic command:

conic()
#Use  Conic(w)  where w is c(a,b,c,d,e,f)  for  a*x^2+b*x*y+c*y^2+d*x+e*y+f = 0
#C1 and, as appropriate, xC,yC, xV,yV, xF,yF, xF1,yF1, xF2,yF2, FV, R are stored
#Use  fraction(xC),..,fraction(yF2)  if you want to try to find fractional forms
U = c(4/3,1/2,1,-7,-8,-32); Conic(U)
#C1=function(x,y)  1.333333 * x^2 + 0.5 * x*y + 1 * y^2 + -7 * x + -8 * y + -32
#ellipse  xC = 1.967213  yC = 3.508197
#dir.major ax: 298.155 °  dir.minor ax: 28.15497 °
#semi-major axis 7.816129  semi-minor axis 6.005756
#F1 4.327577 -0.9021841  F2 -0.3931511 7.918578  eccentr 0.6399942
#Then you have the length of the string that draws the Ellipse with
#StringE(xF1,yF1, xF2,yF2)   [which is = major axis = distance V1-V2]
#and the couple of hor/vert dist. from F1 (F2) to V1 (V2) with  FV  If you want you can look for a fractional forms
fraction( c(xC,yC) )
# 120/61  214/61

The picture on the right:

PLANE(-10,10, -5,15); CURVE(C1,"red")
l2p(xF1,yF1,xF2,yF2, "red")            # l2p is a thin line between the 2 points (see)
text(1.5,2,"C"); text(-1.5,7,"F1"); text(3,-2,"F2")
POINT(xF1,yF1,"blue"); POINT(xF2,yF2,"magenta"); POINT(xC,yC,"seagreen")
POINT(xF2-FV,yF2+FV,"black"); POINT(xF1+FV,yF1-FV,"brown")

# To have the sum of distances focus1-curve-focus2:
StringE(xF1,yF1,xF2,yF2)
# 15.63226       or  7.816129*2
PLANE(-10,10, -5,15); CURVE(C1,"blue"); POINT(xF1,yF1,"red"); POINT(xF2,yF2,"red")
# I trace one of the point with y=10:
K1 = function(x) F(x,10); solution(K1,0, 3,5)
# 3.842333
POINT(solution(K1,0, 3,5),10, "black")
polyl(c(xF1,solution(K1,0, 3,5),xF2), c(yF1,10,yF2), "black")
# Now, I can trace the ellipse even in this way:
K = function(x,y) point_point(xF1,yF1,x,y)+point_point(xF2,yF2,x,y)-StringE(xF1,yF1,xF2,yF2)
CUR(K,"red") # If you want to see how to study the Colosseum see here.

---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

Let's look at another example:
4/3*x^2-y^2+x*y/2-7*x-8*y-32 = 0

conic()
#Use  Conic(w)  where w is c(a,b,c,d,e,f)  for  a*x^2+b*x*y+c*y^2+d*x+e*y+f = 0
#C1 and, as appropriate, xC,yC, xV,yV, xF,yF, xF1,yF1, xF2,yF2, FV are stored
#Use  fraction(xC),..,fraction(yF2)  if you want to try to find fractional forms

V = c(4/3,1/2,-1,-7,-8,-32); Conic(V)
#C1=function(x,y)  1.333333 * x^2 + 0.5 * x*y + -1 * y^2 + -7 * x + -8 * y + -32
#hyperbola  xC = 3.223881  yC = -3.19403
#dir.trasv.ax 2.359818 0.25   dir.coniug.ax -0.25 2.359818
#V1  7.934077 -2.69503  V2  -1.486316 -3.69303
#F1 10.40555 -2.433201  F2 -3.957791 -3.954859  eccentr 1.524707
#In C2 there is the curve formed by the 2 asymptotes
fraction( c(xC,yC) )
# 216/67 -214/67 PLANE(-10,15, -15,10); CURVE(C1,"blue")
POINT(xC,yC,"seagreen"); CUR(C2,"red"); POINT(xC,yC,"seagreen")
POINT(xF1,yF1,"red"); POINT(xF2,yF2,"red")
l2p(xF1,yF1,xF2,yF2, "seagreen")  text(3,-1,"C",cex=0.8); text(-3.4,-2.5,"F2",cex=0.8); text(12,-3.8,"F2",cex=0.8)

It's a hyperbola. And in fact (1/2)^2+4*4/3*1 > 0

All the hyperbolae whose asymptotes are represented by the equation C2(x,y)=0 can be
represented by an equation of the form C2(x,y)=k. Fixed a point we can find the
hyperbola passing trough it. In this case I can find the hyperbola passin trough V1:

CC2 = function(x,y) C2(x,y)-Q
E = function(x) C2(xV1,yV1)-x; Q = solution(E,0, -100,100)
CUR(CC2, "cyan")                            # I see (above) that the curve is the same

---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

Let's look at another example:
x^2+y^2-2*x*y+4*x+4 = 0

conic()
#Use  Conic(w)  where w is c(a,b,c,d,e,f)  for  a*x^2+b*x*y+c*y^2+d*x+e*y+f = 0
#C1 and, as appropriate, xC,yC, xV,yV, xF,yF, xF1,yF1, xF2,yF2, FV are stored
#Use  fraction(xC),..,fraction(yF2)  if you want to try to find fractional forms

W = c(1,-2,1,4,0,4); Conic(W)
#C1=function(x,y)  1 * x^2 + -2 * x*y + 1 * y^2 + 4 * x + 0 * y + 4
#parabola  xV = -1.25  yV = -0.25   dir.ax.symm = -1 -1
#F -1.5 -0.5      In C2(x,y) there is the  directrix
PLANE(-4,1/2, -3,1.5); CURVE(C1, "blue")
CUR(C2, "red"); POINT(xV,yV, "brown"); POINT(xF,yF, "red")
l2p(xF,yF,xV,yV, "seagreen") eccentricity = 1

text(-1.03,-0.2,"V",cex=0.8); text(-1.65,-0.36,"F",cex=0.8)
text(-1.2,1.2,"directrix",cex=0.9)

It's a parabola. And in fact (-2)^2-4*1*1 = 0

---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
In the case where the conic is the empty set (eg  x^2 + y^2 + 1 = 0) or a point
(eg  x^2 + y^2 = 0) obviously no graph is obtained.
K = c(1,0,1,0,0,1); Conic(K)
# C1=function(x,y)  1 * x^2 + 0 * x*y + 1 * y^2 + 0 * x + 0 * y + 1
# the conic does not exist
K = c(1,0,1,0,0,0); Conic(K)
# C1=function(x,y)  1 * x^2 + 0 * x*y + 1 * y^2 + 0 * x + 0 * y + 0
# the conic is only the point 0 0

Also if the conic is a line no curve can be drawn:
w=c(1,-6,9,2,-6,1); Conic(w)
# C1=function(x,y)  1 * x^2 + -6 * x*y + 9 * y^2 + 2 * x + -6 * y + 1
# the conic is 1 or 2 lines
PLANE(-5,5, -5,5); CURVE(C1,"red")
# no curve is obtained, but we can use:
CURN(C1,1,"brown")
#  [ y = F(x) +/- 1e-04 ] See here for the use of CURN.

---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

If I want, I can study the ellipse more thoroughly with WolframAlpha
If I put   4/3*x^2+y^2+x*y/2-7*x-8*y-32 = 0   and click  [Properties]
I have the list of properties. To better use this list, go with the mouse under the
box and click [A Plaintext] to better copy the values:

ellipse
foci | (4.32758, -0.902184) | (-0.393151, 7.91858)
vertices | (5.65532, -3.38309) | (-1.72089, 10.3995)
center | (1.96721, 3.5082)
semimajor axis length | 7.81613
semiminor axis length | 6.00576
area | 147.472
perimeter | 43.6092
focal parameter | 7.21054
eccentricity | 0.639994

NOTE: you can get more detailed but less simple information using "focus ...." (see) When the eccentricity is 0 the ellipse is a circle, when it is 1 is reduced to a segment.
[The focal parameter of the ellipse - a little used parameter - is, referring to the figure,
QC^2/√(VC^2-QC^2) ]

Let's look at another way (always using WolframAlpha's information): I make a
scale transformation of a circle centered in the origin, taking into account
the relationship between the semi-axes; move it by taking into account the
center and rotate it by taking into account the coordinates of the foci.

PLANE(-10,10, -5,15)
C = c(1.96721, 3.5082); R = 7.81613
POINT(C,C, "green")
# The circle centered in the origin with radius = major semi-axis
K = function(x,y) x^2+y^2-R^2
# I crushed it so as to give it the shape of the ellipse
# ("-1" color does not trace the curve; then I copy the curve to U)
ratio = 6.00576/7.81613
multra(K, 1,ratio, 0,0, -1); U = ZZZ
# Then I rotate it, move it, carrying O to C, and draw it.
D=c(0,A)
rottra(U, angle(D,A,B),C,C,"seagreen")  # I can find the parametric equations of the ellipse. They are:
X = function(t) a*cos(t)*cos(A)-b*sin(t)*sin(A)+xC
Y = function(t) a*cos(t)*sin(A)+b*sin(t)*cos(A)+yC
# if it is rotated by an angle A (form the x axis) and a and b are the semiaxis
PLANE(-10,10, -5,15)
a=7.81613; b=6.00576
# We remember that
xF1=4.32758; yF1=-0.902184; xF2=-0.393151; yF2=7.91858; xC=120/61; yC=214/61
inclination(xF1,yF1, xF2,yF2); A=inclination(xF1,yF1, xF2,yF2)/180*pi
# -61.84503
param(X,Y, 0,2*pi, "seagreen")

# Then I can draw the tangent lines (see).  Some examples:
t = 90/180*pi; POINT(X(t),Y(t),"blue")
d = param_incl(X,Y,t); d
# -61.84503
point_inclina(X(t),Y(t),d, "blue")
t = 180/180*pi; POINT(X(t),Y(t),"red"); d = param_incl(X,Y,t); d
# 28.15497
point_inclina(X(t),Y(t),d, "red")
t = 30/180*pi; POINT(X(t),Y(t),"brown"); d = param_incl(X,Y,t); d
# 65.07567
point_inclina(X(t),Y(t),d, "brown") ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

As before, I can study the hyperbola 4/3*x^2-y^2+x*y/2-7*x-8*y-32=0  with WolframAlpha: hyperbola
foci | (-3.95779, -3.95486) | (10.4056, -2.4332)
vertices | (-1.48632, -3.69303) | (7.93408, -2.69503)
center | (3.22388, -3.19403)
semimajor axis length | 4.73655
semiminor axis length | 5.45163
focal parameter | 4.11533
eccentricity | 1.52471
asymptotes | y = 1.43145 x - 7.80887 | y = -0.931454 x - 0.191134

[The focal parameter of the hyperbola - a little used parameter - is, referring to the figure,
KV^2/√(KV^2+CV^2)= 5.45163^2/√(4.73655^2+5.45163^2) ]

If desired, I can find the angle formed by the asymptotes, using the inclination2
command, which associates inclination to the slope:

inclination2(1.43145)
#  55.06215    the inclination of a asymptote
inclination2(-0.931454)
#  -42.96746   the inclination of the other
inclination2(1.43145)-inclination2(-0.931454)
#  98.02961  an angle (in °) formed by two asymptotes (the one that contains
#                      two branches of the curve); the other one is 180° minus this value

Hyperboles have the characteristic of having a constant difference (in absolute value)
between the distances of their points from the foci. Let's verify this in two points: # foci:
A=c(-3.95779, -3.95486); B=c(10.4056, -2.4332)
POINT(A,A, "seagreen"); POINT(B,B, "seagreen")
u=8; h <- function(x) F(x,u); q=solution(h,0, 10,13); q; POINT(q,u, "red")
#  12.13707   x of the point with y=8 on the right
POINT(A,A, "seagreen"); POINT(B,B, "seagreen")
line(A,A,q,u, "seagreen"); line(B,B,q,u, "seagreen")
point_point(A,A,q,u)-point_point(B,B,q,u)
#  9.473119  the difference between AP and BP
u=-10; h <- function(x) F(x,u); q=solution(h,0, -5,-2.5); q; POINT(q,u, "red")
#  -3.197402   x of the point with y=10 on the left
line(A,A,q,u, "magenta"); line(B,B,q,u, "magenta")
point_point(A,A,q,u)-point_point(B,B,q,u)
#  -9.473119  the difference between AP and BP

To the right, the curve drawn as the set of the points whose distances from the foci have
difference that (in absolute value) is 9.473119:

K = function(x,y) abs(point_point(x,y,A,A)-point_point(x,y,B,B))-9.473119
PLANE(-10,15, -15,10); CURVE(K, "magenta")

---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------

With WolframAlpha, for the parabola x^2+y^2-2*x*y+4*x+4=0 we have:

parabola
focus | (-3/2, -1/2) = (-1.5, -1/2)
vertex | (-5/4, -1/4) = (-1.25, -1/4)
semi-axis length | 1/(2*sqrt(2)) = 0.353553  [ FV nella figura =
(distanza tra F e la direttrice)/2 [
focal parameter | 1/sqrt(2) = 0.707107
eccentricity | 1
directrix | y = -x - 1

[The focal parameter of the parabola - a little used parameter - is, referring to the figure,
2 * semi-axis ] The parables have equal distances of their points from the focus and the directrix.
Let's check it out (getting the chart below to the left). PLANE(-3,0, -3,0); CURVE(H, "brown")
V = c(-5/4, -1/4); F = c(-3/2,-1/2)
f = function(x) -x-1
POINT(F,F, "red"); graph1(f, -3,0, "red")
# I take a point of the parable, eg. the one of ordinate -2
u=-2; h <- function(x) H(x,u); q=solution(h,0, -2,-1.1); q; POINT(q,u, "red")
#  -1.171573   # x of the point with y = -2
# where the prependicula intersects the line
point_line2(q,u, -1,0,0,-1)
#  -0.08578644 -0.91421356
segm(q,u, -0.08578644, -0.91421356, "green")
segm(q,u, F,F, "green")
# The distances:
point_point(q,u, F,F)
#  1.535534
point_line(q,u, -1,0,0,-1)
#  1.535534
# OK

I can control the thing by  directly drawing (using this feature) the parable:

W = function(x,y) point_point(x,y,F,F)-point_line(x,y, -1,0,0,-1)
CURVE(W, "blue")

I got the blue figure above right. OK.

---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- Can you foresee that the following commands provide the
figure on the left? How do you do?

G1 = function(x,y) x-y-1; G2 = function(x,y) x+y-1
S = c( 1,-1, 1,
1, 1, 1 )
eqSystem(S)
# 1 0
BF=2.5; HF=2.5; PLANE(-1.5,3.5, -2.5,2.5)
CURV(G1,"blue"); CURV(G2,"blue"); POINT(1,0, "brown")
G = function(x,y) G1(x,y)^2+3*G2(x,y)^2-4
H = function(x,y) abs(G1(x,y))+3*abs(G2(x,y))-4
CURVE(H, "red"); CURVE(G, "seagreen")

Can you trace the figure on the right, if you know
that the equation of the curve is x^2-2*x*y=4*y?

[ use the command Conic( c(...) ) ]  Can you trace the figure on the left, if you know
that the equation of the curve is x^2+2*x*y+y^2+4*x=5?

[ use the command Conic( c(...) ) ]

Trace asymptotes and foci of the equilateral hyperbola
2*x^2+3*x*y-2*y^2-7*x+y = 0

[ use the command Conic( c(...) ) ]  Trace the parabola with focus (0.1, 1.2) and directrix
that passes through points (-1/2,0) and (0,-1/4)

[   Use distance point_point and point_line
Compare with 4*x^2-4*x*y+y^2-2*x-14*y+7 = 0  ]

Other examples of use

```