A conic section is the intersection of an extended cone and a plane. Mathematically, conic sections are curves in a Cartesian plane described by second-degree equations in x and y. The type of conic section depends on the angle the cone makes with its axis and how the plane intersects the cone. There are four standard types:
There are several degenerate types:
A circle is the locus of all points such that distance to the origin is constant. It can be written in the standard form:
where r is the radius of the circle. The center of a circle is its focus; it always has an eccentricity of 0.x2/r2 + y2/r2 = 1
An ellipse is the locus of all points such that sum of distances to each focus is constant. It has two standard forms:
The length of major radius = a; the length of the minor radius = b; with a > b. The foci are located at ±c units from the center where:x2/a2 + y2/b2 = 1; foci on x-axis (major axis) y2/a2 + x2/b2 = 1; foci on y-axis (major axis)
The eccentricity of an ellipse is e = c/a and takes values between 0 (circle) and 1 (parabola).a2 - b2 = c2
A parabola is the locus of all points such that distance to the focus equals the distance to the directrix, which is a straight line perpendicular to the axis of symmetry (on which the focus is located). It also has two standard forms:
In which the distance from vertex to focus (or directrix) = p; it has an eccentricity of 1.4·p·x = y2; focus on x-axis 4·p·y = x2; focus on y-axis
A hyperbola is the locus of all points such that difference between distances to each focus is constant. Its two standard forms are:
where a > b. Like the ellipse, the foci are located at ±c units from the center, but in this conic:x2/a2 - y2/b2 = 1; foci on x-axis y2/a2 - x2/b2 = 1; foci on y-axis
The eccentricity of a hyperbola is e = c/a and takes values greater than 1 (parabola).a2 + b2 = c2
The general form of the equation of a conic section is:
The type of section can be found by evaluating the determinant and two of the minors of the symmetric matrix:A·x2 + B·x·y + C·y2 + D·x + E·y + F = 0
| F D/2 E/2 |
M = | D/2 A B/2 |
| E/2 B/2 C |
We can compute the determinant |M| and minors M11 and M23
as follows:
Then the type of conic can be determined using the following logical steps:|M| = A·C·F + (B·D·E - B·B·F - C·D·D - A·E·E)/4 M11 = A·C - B·B/4 M23 = D·E/4 - B·F/2
if |M| = 0 then
if M11 > 0 then
"a point"
elsif M11 < 0 then
if A + C = 0 then
"two perpendicular lines"
else
"two intersecting lines"
end if
else
if M23 = 0 then
"a single line"
else
"two parallel lines"
end if
end if
else
if M11 > 0 then
if A·|M| > 0 then
"nothing"
else
if (A = C) and (B = 0) then
"a circle"
else
"an ellipse"
end if
end if
elsif M11 < 0 then
"a hyperbola"
else
"a parabola"
end if
end if
The general conic equation may represent a standard conic section that has been translated and rotated. To convert the general equation to a standard form, a rotation and a translation are applied to give a new set of coefficients for the equation the conic section that does not change its shape.
When the coefficient B of the general conic equation is non-zero; a rotational transformation to remove the x·y term will align the axes of the conic with the axes of the Cartesian plane giving a new equation:
From this new equation, a coordinate translation can be found by completing the squares in x and y that will convert the general equation into a standard form. The rotation angle is determined from:A'·x2 + C'·y2 + D'·x + E'·y + F' = 0
The rotation by angle θ around the coordinate origin is applied by replacing x and y using the equations below:θ = π/4 if A = C θ = 0.5·tan-1 B/(A - C) otherwise
and then collecting common terms to obtain new values for the coefficients:x := x·cos(θ) + y·sin(θ) y := -x·sin(θ) + y·cos(θ)
For example, the equationA' = A·cos(θ)·cos(θ) + B·sin(θ)·cos(θ) + C·sin(θ)·sin(θ) C' = A·sin(θ)·sin(θ) - B·sin(θ)·cos(θ) + C·cos(θ)·cos(θ) D' = D·cos(θ) + E·sin(θ) E' = -D·sin(θ) + E·cos(θ) F' = F
represents a hyperbola that has been rotated by 45°. By applying rotation, the standard form is obtained:x·y = 1
0.5000·x² - 0.5000·y² = 1.0000
When the equation for a conic section in this form:
It can be changed by a translation that moves the center from the point {xo, yo} to the origin. The origin depends on the form of the standard conic equation. For a circle, ellipse, or hyperbola; the standard form isA'·x2 + C'·y2 + D'·x + E'·y + F' = 0
In these cases, the center is computed fromA"·x2 ± C"·y2 - 1 = 0
Then the coefficients for the standard conic can be calculated using:xo = -D'/(2·A') yo = -E'/(2·C')
For a parabola, there are two standard forms:A" = A'/(A'·xo2 + C'·yo2 - F') C" = C'/(A'·xo2 + C'·yo2 - F')
If C' is zero, the center and coefficient E" are computed using:x² + E"·y = 0 y² + D"·x = 0
Similarly, if A' is zero, the center and coefficient D" are computed using:xo = D'/(2·A') yo = [F' - D'2/(4·A')]/E' E" = E'/A'
xo = [F' - E'2/(4·C')]/D' yo = E'/(2·C') D" = D'/C'
If the conic section is determined to be a circle the focus is the center at {0, 0} and the eccentricity = 0; there is no need to calculate these.
If the conic is a parabola, then the eccentricity = 1 so this does not need to be calculated. The form of the parabola is determined by the values of A' and C'. The table below indicates how the location of the focus is calculated.
condition form focus
|A'| > 0 and C' = 0 4·p·y = x2 { 0, -E"/4}
|C'| > 0 and A' = 0 4·p·x = y2 {-D"/4, 0}
If the conic is either an ellipse or a hyperbola the orientation of the major axis is determined by the values of A" and C". The table below indicates how the location of the foci and the eccentricity are calculated for the ellipse.
condition form foci
|A"| < |C"| x2/a2 + y2/b2 = 1 {±c, 0}
|C"| < |A"| y2/a2 + x2/b2 = 1 { 0, ±c}
where c2 = a2 - b2 with
so that a2 > b2. The eccentricity = c/a which is always less than 1.a2 = 1 / min( |A"|, |C"| ) b2 = 1 / max( |A"|, |C"| )
The location of foci are similar for the hyperbola:
condition form foci
|A"| < |C"| x2/a2 - y2/b2 = 1 {±c, 0}
|C"| < |A"| y2/a2 - x2/b2 = 1 { 0, ±c}
where c2 = a2 + b2. The eccentricity = c/a which is
always greater than 1.
A computer program that performs these computations is given below.
Zeno 1.2 is an interpreter for the Zeno programming language. It is an easy to learn and is suitable for educational purposes.
type conic : array[6] of real
const PI : real := 2*arcsin( 1 )
const EP : real := 1e-15 % approximate zero
program
var t : int
var r, c : conic
% A B C D E F
set_conic( c, 14, -4, 11, -44, -58, 71 )
put_conic( c )
t := conic_type( c )
if t ~= 0 then
standard_conic( r, c, t )
put_conic( r )
end if
end program
% set values of conic coefficient array
procedure set_conic( var coef : conic, a, b, c, d, e, f : real )
coef[1] := a
coef[2] := b
coef[3] := c
coef[4] := d
coef[5] := e
coef[6] := f
end procedure
% determines the type of conic section and returns a type code
%
% 0 - degenerate
% 1 - circle,
% 2 - ellipse
% 3 - hyperbola
% 4 - parabola
%
function conic_type( var x : conic ) : int
var str : string := "conic is "
var t : int := 0
var A : real := x[1]
var B : real := x[2]
var C : real := x[3]
var D : real := x[4]
var E : real := x[5]
var F : real := x[6]
% | F D/2 E/2 |
% M = | D/2 A B/2 |
% | E/2 B/2 C |
var M11 : real := A*C - B*B/4
var M23 : real := D*E/4 - B*F/2
var det : real := A*C*F + (B*D*E - B*B*F - C*D*D - A*E*E)/4
if det = 0 then % conic is degenerate
t := 0
if M11 > EP then
str := str & "point"
elsif M11 < -EP then
if A + C = 0 then
str := str & "two perpendicular lines"
else
str := str & "two intersecting lines"
end if
else
if M23 = 0 then
str := str & "a single line"
else
str := str & "two parallel lines"
end if
end if
else % conic is ellipse, parabola, or hyperbola
if M11 > EP then
if A*det > 0 then % no solution
t := 0
str := str & "nothing"
else
if (A = C) and (B = 0) then
str := str & "a circle"
t := 1
else
str := str & "an ellipse"
t := 2
end if
end if
elsif M11 < -EP then
str := str & "a hyperbola"
t := 3
else
str := str & "a parabola"
t := 4
end if
end if
put str
return t
end function
% find standard conic equation corresponding to general equation
% by removing rotation and then translation
procedure standard_conic( var r, x : conic, t : int )
var A : real := x[1]
var B : real := x[2]
var C : real := x[3]
var D : real := x[4]
var E : real := x[5]
var F : real := x[6]
% compute rotation for coordinate frame of standard conic
% and coefficients of rotated conic
var theta : real
if A = C then
theta := PI/4
else
theta := 0.5*arctan( B / (A - C) )
end if
var Sa : real := sin(theta)
var Ca : real := cos(theta)
var Ar : real := A*Ca*Ca + B*Sa*Ca + C*Sa*Sa
var Cr : real := A*Sa*Sa - B*Sa*Ca + C*Ca*Ca
var Dr : real := D*Ca + E*Sa
var Er : real := -D*Sa + E*Ca
var Fr : real := F
put "rotation = ", (180*theta/PI):5:4, '°'
% compute offset of coordinate frame of standard conic
% and coefficients of translated conic
var Xo, Yo, a2, b2, c, p : real
var i : int
for i := 1...6 do % init coefficients to zero
r[i] := 0
end for
if (t = 1) or (t = 2) or (t = 3) then
% circle, ellipse, or hyperbola
Xo := -Dr/(2*Ar)
Yo := -Er/(2*Cr)
put "translation = {", Xo:5:4, ", ", Yo:5:4, "}"
r[1] := Ar/(Ar*Xo*Xo + Cr*Yo*Yo - Fr)
r[3] := Cr/(Ar*Xo*Xo + Cr*Yo*Yo - Fr)
r[6] := -1.0
if abs(r[1]) < abs(r[3]) then % foci on x-axis
a2 := abs(1 / r[1])
b2 := abs(1 / r[3])
if t = 2 then % ellipse
c := sqrt( a2 - b2 )
put "foci = {±", c:5:4, ", 0.0000}"
put "eccentricity = ", c / sqrt(a2)
elsif t = 3 then % hyperbola
c := sqrt( a2 + b2 )
put "foci = {±", c:5:4, ", 0.0000}"
put "eccentricity = ", c / sqrt(a2)
end if
else % foci on y-axis
a2 := abs(1 / r[3])
b2 := abs(1 / r[1])
if t = 2 then % ellipse
c := sqrt( a2 - b2 )
put "foci = {0.0000, ±", c:5:4, "}"
put "eccentricity = ", c / sqrt(a2)
elsif t = 3 then % hyperbola
c := sqrt( a2 + b2 )
put "foci = {0.0000, ±", c:5:4, "}"
put "eccentricity = ", c / sqrt(a2)
end if
end if
elsif t = 4 then % parabola
if abs(Ar) > abs(Cr) then % form: x² - 4·p·y = 0
Xo := Dr/(2*Ar)
Yo := (Fr - Dr*Dr/(4*Ar))/Er
put "translation = {", Xo:5:4, ", ", Yo:5:4, "}"
r[1] := 1
r[5] := Er / Ar
p := -r[5]/4
put "focus = {0, ", p:5:4, "}"
else % form: y² - 4·p·x = 0
Xo := (Fr - Er*Er/(4*Cr))/Dr
Yo := Er/(2*Cr)
put "translation = {", Xo:5:4, ", ", Yo:5:4, "}"
r[3] := 1
r[4] := Dr / Cr
p := -r[4]/4
put "focus = {", p:5:4, ", 0}"
end if
end if
end procedure
% display a general conic equation
procedure put_conic( var x : conic )
var i : int
var s : boolean := false
for i := 1...6 do
continue when x[i] = 0
if x[i] < 0 then
put " - "...
elsif (i > 1) and s then
put " + "...
end if
s := true
if (abs(x[i]) ~= 1) or (i = 6) then
put abs(x[i]):5:4...
if i ~= 6 then
put '·'...
end if
end if
case i of
value 1: put "x²"...
value 2: put "x·y"...
value 3: put "y²"...
value 4: put "x"...
value 5: put "y"...
end case
end for
put " = 0"
end procedure
% return the absolute value of argument
function abs( x : real ) : real
if x < 0 then
x := -x
end if
return x
end function
14.0000·x2 - 4.0000·x·y + 11.0000·y2 - 44.0000·x - 58.0000·y + 71.0000 = 0
conic is an ellipse
rotation = -26.5651°
translation = {0.4472, 3.5777}
foci = {0.0000, ±1.4142}
eccentricity = 0.57735
0.2500·x2 + 0.1667·y2 - 1.0000 = 0
AbCd Classics - free on-line books