Conic sections

Conic sections are curves created by the intersection of a plane and a cone. There are six types of conic section: the circle, ellipse, hyperbola, parabola, a pair of intersecting straight lines and a single point.

All conics (as they are known) have at least two foci, although the two may coincide or one may be at infinity. They may also be defined as the locus of a point moving between a point and a line, a directrix, such that the ratio between the distances is constant. This ratio is known as "e", or eccentricity.

## Ellipses

[edit | edit source]

Main resource: Ellipse

Animation showing distance from the foci of an ellipse to several different points on the ellipse.

An ellipse is a locus where the sum of the distances to two foci is kept constant. This sum is also equivalent to the major axis of the ellipse - the major axis being longer of the two lines of symmetry of the ellipse, running through both foci. The eccentricity of an ellipse is less than one.

In Cartesian coordinates, if an ellipse is centered at (h,k), the equation for the ellipse is

( x − h ) 2 a 2 + ( y − k ) 2 b 2 = 1 {\displaystyle {\frac {(x-h)^{2}}{a^{2}}}+{\frac {(y-k)^{2}}{b^{2}}}=1} (equation 1)

The lengths of the major and minor axes (also known as the conjugate and transverse) are "a" and "b" respectively.

Exercise 1. Derive equation 1.  (hint)

A circle circumscribed about the ellipse, touching at the two end points of the major axis, is known as the auxiliary circle. The latus rectum of an ellipse passes through the foci and is perpendicular to the major axis.

From a point P( x 1 {\displaystyle x_{1}} ,  y 1 {\displaystyle y_{1}} ) tangents will have the equation:

x x 1 a 2 + y y 1 b 2 = 1 {\displaystyle {\frac {xx_{1}}{a^{2}}}+{\frac {yy_{1}}{b^{2}}}=1}

And normals:

x a 2 x 1 − y b 2 y 1 = a 2 − b 2 {\displaystyle {\frac {xa^{2}}{x_{1}}}-{\frac {yb^{2}}{y_{1}}}=a^{2}-b^{2}}

Likewise for the parametric coordinates of P, (a  cos ⁡ α {\displaystyle \cos \alpha } , b  sin ⁡ α {\displaystyle \sin \alpha } ),

x cos ⁡ α a + y sin ⁡ α b = 1 {\displaystyle {\frac {x\cos \alpha }{a}}+{\frac {y\sin \alpha }{b}}=1}

## Properties of Ellipses

[edit | edit source]

S and S' are typically regarded as the two foci of the ellipse. Where  a > b {\displaystyle a>b} , these become (ae, 0) and (-ae, 0) respectively. Where  a < b {\displaystyle a<b} these become (0, be) and (0, -be) respectively.

A point P on the ellipse will move about these two foci ut | P S + P S ′ | = 2 a {\displaystyle |PS+PS'|=2a}

Where a > b, which is to say the Ellipse will have a major-axes parallel to the x-axis:

b 2 = a 2 ( 1 − e 2 ) {\displaystyle b^{2}=a^{2}(1-e^{2})}

The directrix will be:  x = ± a e {\displaystyle x=\pm {\frac {a}{e}}}

## Circles

[edit | edit source]

A circle is a special type of the ellipse where the foci are the same point.

Hence, the equation becomes:

x 2 + y 2 = r 2 {\displaystyle x^{2}+y^{2}=r^{2}}

Where 'r' represents the radius. And the circle is centered at the origin (0,0)

## Hyperbolas

[edit | edit source]

A special case where the eccentricity of the conic shape is greater than one.

Centered at the origin, Hyperbolas have the general equation:

x 2 a 2 − y 2 b 2 = 1 {\displaystyle {\frac {x^{2}}{a^{2}}}-{\frac {y^{2}}{b^{2}}}=1}

A point P on will move about the two foci ut  | P S − P S ′ | = 2 a {\displaystyle |PS-PS'|=2a}

The equations for the tangent and normal to the hyperbola closely resemble that of the ellipse.

From a point P( x 1 {\displaystyle x_{1}} ,  y 1 {\displaystyle y_{1}} ) tangents will have the equation:

x x 1 a 2 − y y 1 b 2 = 1 {\displaystyle {\frac {xx_{1}}{a^{2}}}-{\frac {yy_{1}}{b^{2}}}=1}

And normals:

x a 2 x 1 + y b 2 y 1 = a 2 + b 2 {\displaystyle {\frac {xa^{2}}{x_{1}}}+{\frac {yb^{2}}{y_{1}}}=a^{2}+b^{2}}

The directrixes (singular directrix) and foci of hyperbolas are the same as those of ellipses, namely directrixes of  x = ± a e {\displaystyle x=\pm {\frac {a}{e}}} and foci of  ( ± a e , 0 ) {\displaystyle (\pm ae,0)}

The asymptotes of a hyperbola lie at  y = ± b a x {\displaystyle y=\pm {\frac {b}{a}}x}

Figure 1: Hyperbola at origin with transverse axis horizontal.

Origin at point  O {\displaystyle O} : ( 0 , 0 ) {\displaystyle :(0,0)} .
Foci are points  F 1 ( − c , 0 ) , F 2 ( c , 0 ) . O F 1 = O F 2 = c . {\displaystyle F_{1}(-c,0),\ F_{2}(c,0).OF_{1}=OF_{2}=c.}
Vertices are points  V 1 ( − a , 0 ) , V 2 ( a , 0 ) . O V 1 = O V 2 = a . {\displaystyle V_{1}(-a,0),\ V_{2}(a,0).OV_{1}=OV_{2}=a.}
Line segment  V 1 O V 2 {\displaystyle V_{1}OV_{2}} is the  t r a n s v e r s e a x i s . {\displaystyle transverse\ axis.}
P F 1 − P F 2 = 2 a . {\displaystyle PF_{1}-PF_{2}=2a.}

In cartesian geometry in two dimensions hyperbola is locus of a point  P {\displaystyle P} that moves relative to two fixed points called  f o c i {\displaystyle foci} : F 1 , F 2 . {\displaystyle :F_{1},F_{2}.} The distance  F 1 F 2 {\displaystyle F_{1}F_{2}} from one  f o c u s ( F 1 ) {\displaystyle focus\ (F_{1})} to the other  f o c u s ( F 2 ) {\displaystyle focus\ (F_{2})} is non-zero. The absolute difference of the distances  ( P F 1 , P F 2 ) {\displaystyle (PF_{1},PF_{2})} from point to foci is constant.

P F 1 − P F 2 = K . {\displaystyle PF_{1}-PF_{2}=K.} See figure 1.

Center of hyperbola is located at the origin  O ( 0 , 0 ) {\displaystyle O(0,0)} and the foci  ( F 1 , F 2 ) {\displaystyle (F_{1},F_{2})} are on the  X a x i s {\displaystyle X\ axis} at distance  c {\displaystyle c} from  O . {\displaystyle O.}

F 1 {\displaystyle F_{1}} has coordinates  ( − c , 0 ) . F 2 {\displaystyle (-c,0).F_{2}} has coordinates  ( c , 0 ) {\displaystyle (c,0)} . Line segments  O F 1 = O F 2 = c . {\displaystyle OF_{1}=OF_{2}=c.}

Each point  ( V 1 , V 2 ) {\displaystyle (V_{1},V_{2})} where the curve intersects the transverse axis is called a  v e r t e x . V 1 , V 2 {\displaystyle vertex.\ V_{1},V_{2}} are the vertices of the ellipse.

By definition  P F 1 − P F 2 = V 2 F 1 − V 2 F 2 = V 1 F 2 − V 1 F 1 = K . {\displaystyle PF_{1}-PF_{2}=V_{2}F_{1}-V_{2}F_{2}=V_{1}F_{2}-V_{1}F_{1}=K.}

∴ V 2 F 1 − V 2 F 2 = V 2 F 1 − V 1 F 1 = V 1 V 2 = K = 2 a , {\displaystyle \therefore V_{2}F_{1}-V_{2}F_{2}=V_{2}F_{1}-V_{1}F_{1}=V_{1}V_{2}=K=2a,} the length of the  t r a n s v e r s e a x i s ( V 1 V 2 ) . {\displaystyle transverse\ axis\ (V_{1}V_{2}).} O V 1 = O V 2 = a . {\displaystyle OV_{1}=OV_{2}=a.}

### Equation of hyperbola at origin

[edit | edit source]

#### Transverse axis horizontal

[edit | edit source]

* * *

Figure 1: Hyperbola at origin with transverse axis horizontal.

a , c = 5 , 6.25 {\displaystyle a,c=5,6.25}
Origin at point  O {\displaystyle O} : ( 0 , 0 ) {\displaystyle :(0,0)} .
Foci are points  F 1 ( − 6.25 , 0 ) , F 2 ( 6.25 , 0 ) . O F 1 = O F 2 = 6.25. {\displaystyle F_{1}(-6.25,0),\ F_{2}(6.25,0).OF_{1}=OF_{2}=6.25.}
Vertices are points  V 1 ( − 5 , 0 ) , V 2 ( 5 , 0 ) . O V 1 = O V 2 = 5. {\displaystyle V_{1}(-5,0),\ V_{2}(5,0).OV_{1}=OV_{2}=5.}
P F 1 − P F 2 = 2 a = 10. {\displaystyle PF_{1}-PF_{2}=2a=10.}

P F 1 − P F 2 = 2 a {\displaystyle PF_{1}-PF_{2}=2a}

Let point  P {\displaystyle P} have coordinates  ( x , y ) . {\displaystyle (x,y).}

P F 1 = ( x − ( − c ) ) 2 + ( y − 0 ) 2 = ( x + c ) 2 + y 2 = m {\displaystyle PF_{1}={\sqrt {(x-(-c))^{2}+(y-0)^{2}}}={\sqrt {(x+c)^{2}+y^{2}}}=m}

P F 2 = ( x − c ) 2 + y 2 = n {\displaystyle PF_{2}={\sqrt {(x-c)^{2}+y^{2}}}=n}

m 2 = M = ( x + c ) 2 + y 2 ; n 2 = N = ( x − c ) 2 + y 2 . {\displaystyle m^{2}=M=(x+c)^{2}+y^{2};\ n^{2}=N=(x-c)^{2}+y^{2}.}

( x + c ) 2 + y 2 − ( x − c ) 2 + y 2 = 2 a {\displaystyle {\sqrt {(x+c)^{2}+y^{2}}}-{\sqrt {(x-c)^{2}+y^{2}}}=2a}

m − n = 2 a {\displaystyle m-n=2a}

m 2 − 2 m n + n 2 = M − 2 m n + N = 4 a a {\displaystyle m^{2}-2mn+n^{2}=M-2mn+N=4aa}

− 2 m n = 4 a a − M − N {\displaystyle -2mn=4aa-M-N}

4 m 2 n 2 = ( 4 a a − M − N ) 2 {\displaystyle 4m^{2}n^{2}=(4aa-M-N)^{2}}

4 M N − ( 4 a a − M − N ) 2 = 0 {\displaystyle 4MN-(4aa-M-N)^{2}=0}

Make appropriate substitutions, expand and result is:

16 a a x x − 16 c c x x + 16 a a y y − 16 a a a a + 16 a a c c = 0 {\displaystyle 16aaxx-16ccxx+16aayy-16aaaa+16aacc=0}

Simplify, gather like terms and recall that, for hyperbola,  c > a . {\displaystyle c>a.}

( a a − c c ) x x + a a y y − a a ( a a − c c ) = 0 {\displaystyle (aa-cc)xx+aayy-aa(aa-cc)=0}

( c c − a a ) x x − a a y y − a a ( c c − a a ) = 0 {\displaystyle (cc-aa)xx-aayy-aa(cc-aa)=0}

Let  b 2 = c 2 − a 2 {\displaystyle b^{2}=c^{2}-a^{2}}

b 2 x 2 − a 2 y 2 = a 2 b 2 {\displaystyle b^{2}x^{2}-a^{2}y^{2}=a^{2}b^{2}}

b 2 x 2 a 2 b 2 − a 2 y 2 a 2 b 2 = a 2 b 2 a 2 b 2 {\displaystyle {\frac {b^{2}x^{2}}{a^{2}b^{2}}}-{\frac {a^{2}y^{2}}{a^{2}b^{2}}}={\frac {a^{2}b^{2}}{a^{2}b^{2}}}}

x 2 a 2 − y 2 b 2 = 1 {\displaystyle {\frac {x^{2}}{a^{2}}}-{\frac {y^{2}}{b^{2}}}=1}

Curve in diagram has:

a = 5 , c = 6.25 {\displaystyle a=5,c=6.25}

b 2 = c 2 − a 2 = 14.0625 {\displaystyle b^{2}=c^{2}-a^{2}=14.0625}

equation  ( 14.0625 ) x 2 − ( 25 ) y 2 = 351.5625 {\displaystyle (14.0625)x^{2}-(25)y^{2}=351.5625} or  x 2 a 2 − y 2 b 2 = x 2 5 2 − y 2 3.75 2 = 1 {\displaystyle {\frac {x^{2}}{a^{2}}}-{\frac {y^{2}}{b^{2}}}={\frac {x^{2}}{5^{2}}}-{\frac {y^{2}}{3.75^{2}}}=1}

where  a 2 = 5 2 , b 2 = 3.75 2 . {\displaystyle a^{2}=5^{2},b^{2}=3.75^{2}.}

#### Transverse axis vertical

[edit | edit source]

* * *

Figure 1: Hyperbola at origin with transverse axis vertical.

a , c = 4 , 5 {\displaystyle a,c=4,5}
Origin at point  O {\displaystyle O} : ( 0 , 0 ) {\displaystyle :(0,0)} .
Foci are points  F 1 ( 0 , − 5 ) , F 2 ( 0 , 5 ) . O F 1 = O F 2 = 5. {\displaystyle F_{1}(0,-5),\ F_{2}(0,5).OF_{1}=OF_{2}=5.}
Vertices are points  V 1 ( 0 , − 4 ) , V 2 ( 0 , 4 ) . O V 1 = O V 2 = 4. {\displaystyle V_{1}(0,-4),\ V_{2}(0,4).OV_{1}=OV_{2}=4.}
P F 1 − P F 2 = 2 a = 8. {\displaystyle PF_{1}-PF_{2}=2a=8.}

P F 1 − P F 2 = 2 a {\displaystyle PF_{1}-PF_{2}=2a}

Let point  P {\displaystyle P} have coordinates  ( x , y ) . {\displaystyle (x,y).}

Let Focus 1,  F 1 {\displaystyle F_{1}} have coordinates  ( 0 , − c ) . {\displaystyle (0,-c).}

Let Focus 2,  F 2 {\displaystyle F_{2}} have coordinates  ( 0 , c ) . {\displaystyle (0,c).}

P F 1 = ( x ) 2 + ( y − ( − c ) ) 2 = x 2 + ( y + c ) 2 = m {\displaystyle PF_{1}={\sqrt {(x)^{2}+(y-(-c))^{2}}}={\sqrt {x^{2}+(y+c)^{2}}}=m}

P F 2 = x 2 + ( y − c ) 2 = n {\displaystyle PF_{2}={\sqrt {x^{2}+(y-c)^{2}}}=n}

m 2 = M = x 2 + ( y + c ) 2 ; n 2 = N = x 2 + ( y − c ) 2 . {\displaystyle m^{2}=M=x^{2}+(y+c)^{2};\ n^{2}=N=x^{2}+(y-c)^{2}.}

Make substitutions as above, expand and result is:

a a y y − c c y y + a a x x + a a c c − a a a a = 0 {\displaystyle aayy-ccyy+aaxx+aacc-aaaa=0}

Simplify, gather like terms and recall that, for hyperbola,  c > a . {\displaystyle c>a.}

( a a − c c ) y y + a a x x + a a ( c c − a a ) = 0 {\displaystyle (aa-cc)yy+aaxx+aa(cc-aa)=0}

( c c − a a ) y y − a a x x − a a ( c c − a a ) = 0 {\displaystyle (cc-aa)yy-aaxx-aa(cc-aa)=0}

Let  b 2 = c 2 − a 2 {\displaystyle b^{2}=c^{2}-a^{2}}

b 2 y 2 − a 2 x 2 = a 2 b 2 {\displaystyle b^{2}y^{2}-a^{2}x^{2}=a^{2}b^{2}}

b 2 y 2 a 2 b 2 − a 2 x 2 a 2 b 2 = a 2 b 2 a 2 b 2 {\displaystyle {\frac {b^{2}y^{2}}{a^{2}b^{2}}}-{\frac {a^{2}x^{2}}{a^{2}b^{2}}}={\frac {a^{2}b^{2}}{a^{2}b^{2}}}}

y 2 a 2 − x 2 b 2 = 1 {\displaystyle {\frac {y^{2}}{a^{2}}}-{\frac {x^{2}}{b^{2}}}=1}

Curve in diagram has:

a = 4 , c = 5 {\displaystyle a=4,c=5}

b 2 = 5 2 − 4 2 = 3 2 = 9 {\displaystyle b^{2}=5^{2}-4^{2}=3^{2}=9}

equation  ( 9 ) y 2 − ( 16 ) x 2 = ( 9 ) ( 16 ) {\displaystyle (9)y^{2}-(16)x^{2}=(9)(16)} or  y 2 a 2 − x 2 b 2 = y 2 4 2 − x 2 3 2 = 1 {\displaystyle {\frac {y^{2}}{a^{2}}}-{\frac {x^{2}}{b^{2}}}={\frac {y^{2}}{4^{2}}}-{\frac {x^{2}}{3^{2}}}=1}

where  a 2 = 4 2 , b 2 = 3 2 . {\displaystyle a^{2}=4^{2},b^{2}=3^{2}.}

#### Transverse axis oblique

[edit | edit source]

* * *

Figure 1: Hyperbola at origin with transverse axis oblique.

p , q = 24 , 7 {\displaystyle p,q=24,7}
Center of hyperbola is at origin,  ( 0 , 0 ) . {\displaystyle (0,0).}
Foci are points  F 1 ( − p , − q ) , F 2 ( p , q ) . O F 1 = O F 2 = c = 25. {\displaystyle F_{1}(-p,-q),\ F_{2}(p,q).OF_{1}=OF_{2}=c=25.}
2 a = 40. {\displaystyle 2a=40.}

With transverse axis oblique the two foci are defined as:

F 1 : ( p , q ) {\displaystyle F_{1}:\ (p,q)}

F 2 : ( − p , − q ) {\displaystyle F_{2}:\ (-p,-q)}

where both  ( p , q ) {\displaystyle (p,q)} are non-zero.

Distance from center to focus  = c = p 2 + q 2 , {\displaystyle =c={\sqrt {p^{2}+q^{2}}},} and  c > a . {\displaystyle c>a.}

Let  m = ( x − p ) 2 + ( y − q ) 2 {\displaystyle m={\sqrt {(x-p)^{2}+(y-q)^{2}}}}

Let  n = ( x − ( − p ) ) 2 + ( y − ( − q ) ) 2 {\displaystyle n={\sqrt {(x-(-p))^{2}+(y-(-q))^{2}}}}

By definition:  m − n = 2 a {\displaystyle m-n=2a}

If you make the substitutions as before, result is:

A x 2 + B y 2 + C x y + F = 0 {\displaystyle Ax^{2}+By^{2}+Cxy+F=0} where:

A = a 2 − p 2 {\displaystyle A=a^{2}-p^{2}}

B = a 2 − q 2 {\displaystyle B=a^{2}-q^{2}}

C = − 2 p q {\displaystyle C=-2pq}

F = a 2 ( p 2 + q 2 − a 2 ) {\displaystyle F=a^{2}(p^{2}+q^{2}-a^{2})}

Curve in diagram has:

* Foci at (24,7), (-24,-7)

* a = 20

* equation  ( − 176 ) x 2 + ( 351 ) y 2 + ( − 336 ) x y + ( 90000 ) = 0. {\displaystyle (-176)x^{2}+(351)y^{2}+(-336)xy+(90000)=0.}

#### Implementation

[edit | edit source]

# python code

import decimal
dD = decimal.Decimal                        # Decimal object is like float with (almost) infinite precision.
dgt = decimal.getcontext()
Precision = dgt.prec = 28                   # Adjust as necessary.
Tolerance = dD("1e-" + str(Precision-2))    # Adjust as necessary.

# sum_zero(input) is function that calculates sum of all values in input.
# However, if sum is non-zero but very close to 0 and Tolerance permits,
# sum is returned as 0.
# For example sum of (2, -1.99999_99999_99999_99999_99999_99) is
# returned as 0.

def hyperbola_ABCF(a,pq, flag = 0) :
'''
Ax^2 + By^2 + Cxy + Dx + Ey + F = 0
for hyperbola at origin, D = E = 0.
ABCF = hyperbola_ABCF( a, pq [, flag] )
(2)a is length of transverse axis.
(p,q) are one focus. Other focus is (-p,-q)
'''
thisName = 'hyperbola_ABCF(a,pq, {}) :'.format(bool(flag))
p,q = pq
a,p,q = [ dD(str(v)) for v in (a,p,q) ]
if a == 0 :
print (thisName)
print ('  For hyperbola, a must be non-zero.')
return None
aa,pp,qq = a**2, p**2, q**2
cc = pp + qq
# c = cc.sqrt() and (2)c is distance between foci.
if cc > aa : pass
else :
print (thisName)
print ('  For hyperbola, c must be > a.')
return None
A = aa - pp
B = aa - qq
C = -2*p*q
# F = aa*( pp + qq - aa )
F = aa*( cc - aa ) # F = aa*bb
if flag :
# Print results:
str1 = '({})x^2 + ({})y^2 + ({})xy + ({}) = 0'
str2 = str1.format(A,B,C,F)
print (str2)

# Equation of small circle, used to display points on grapher.
str3 = '({},{})    (x - ({}))^2 + (y - ({}))^2 = 1'
print ('    F1:', str3.format(p,q, p,q))
print ('    F2:', str3.format(-p,-q, -p,-q))
print ('    axis: ({})y = ({})x'.format(p,q))

print ('    aa,a =', aa,a)
bb = cc-aa ; b = bb.sqrt()
print ('    bb,b =', bb,b)
c = cc.sqrt()
print ('    cc,c =', cc,c)
if C == 0 :
# Display intercept form of equation.
if F > 0 : A,B,C,F = [ -v for v in (A,B,C,F) ]
str1a = '({})x^2 + ({})y^2 + ({}) = 0'
str4 = str1a.format(A,B,F)
print ('   ', str4)

if (A == bb) and (B == -aa) :
# (225)x^2 + (-400)y^2 + (-90000) = 0
str5 = 'xx/(({})^2) - yy/(({})^2) = 1'
top1_ = 'x^2' ; top2_ = 'y^2'
elif (A == -aa) and (B == bb) :
# (-400)x^2 + (225)y^2 + (-90000) = 0
str5 = 'yy/(({})^2) - xx/(({})^2) = 1'
top1_ = 'y^2' ; top2_ = 'x^2'
else : ({}[2])
str6 = str5.format(a, b)
print ('   ',str6)

str5 = '\\frac{{ {} }}{{ {}^2 }} - \\frac{{ {} }}{{ {}^2 }} = 1'
print('   ','<math>', str5.format(top1_,a, top2_,b), '</math>')

bottom1,bottom2 = [ '({})^2'.format(v) for v in (a,b) ]
len1,len2 = [ len(v) for v in (bottom1,bottom2) ]
len1a = (len1-3) >> 1 ; len1b = (len1-3)-len1a
len2a = (len2-3) >> 1 ; len2b = (len2-3)-len2a
top1 = '{}{}{}'.format( ' '*len1a,top1_, ' '*len1b )
top2 = '{}{}'.format( ' '*len2a,top2_ )
print ( '   ', top1, ' ', top2 )
print ( '   ', '-'*len1,'-', '-'*len2, '= 1' )
print ( '   ', bottom1, ' ', bottom2 )
return A,B,C,F

#### Examples

[edit | edit source]

* Hyperbola of low eccentricity.

* Hyperbola of medium eccentricity.

* Hyperbola of high eccentricity.

#### Reversing the process

[edit | edit source]

The expression "reversing the process" means calculating the values of  a , p , q {\displaystyle a,p,q} when given equation of hyperbola at origin, the familiar values  A , B , C , F . {\displaystyle A,B,C,F.}

Consider the equation of a hyperbola at origin:  351 x 2 − 176 y 2 + 336 x y + 90000 = 0. {\displaystyle 351x^{2}-176y^{2}+336xy+90000=0.} This is a hyperbola where  A , B , C , F = 351 , − 176 , 336 , 90000. {\displaystyle A,B,C,F=351,-176,336,90000.}

This hyperbola may be expressed as  35.1 x 2 − 17.6 y 2 + 33.6 x y + 9000.0 = 0 {\displaystyle 35.1x^{2}-17.6y^{2}+33.6xy+9000.0=0} or  3510 x 2 − 1760 y 2 + 3360 x y + 900000 = 0 {\displaystyle 3510x^{2}-1760y^{2}+3360xy+900000=0} or  ( K ) 351 x 2 − ( K ) 176 y 2 + ( K ) 336 x y + ( K ) 90000 = 0 {\displaystyle (K)351x^{2}-(K)176y^{2}+(K)336xy+(K)90000=0} where  K {\displaystyle K} is any real, non-zero number.

However, when this hyperbola is expressed as  351 x 2 − 176 y 2 + 336 x y + 90000 = 0 , {\displaystyle 351x^{2}-176y^{2}+336xy+90000=0,} this format is the hyperbola expressed in "standard form," a notation that greatly simplifies the calculation of  a , p , q . {\displaystyle a,p,q.}

Modify the equations for  A , B , C , F {\displaystyle A,B,C,F} slightly:

K A = a 2 − p 2 {\displaystyle KA=a^{2}-p^{2}}

K B = a 2 − q 2 {\displaystyle KB=a^{2}-q^{2}}

K C = − 2 p q {\displaystyle KC=-2pq}

K F = a 2 ( p 2 + q 2 − a 2 ) {\displaystyle KF=a^{2}(p^{2}+q^{2}-a^{2})}

There are four simultaneous equations with four known values  A , B , C , F {\displaystyle A,B,C,F} and four unknown:  K , a , p , q . {\displaystyle K,a,p,q.}

K = 4 F C 2 − 4 A B . {\displaystyle K={\frac {4F}{C^{2}-4AB}}.}

For  A , B , C , F = 35.1 , − 17.6 , 33.6 , 9000.0 , K = 10. {\displaystyle A,B,C,F=35.1,-17.6,33.6,9000.0,\ K=10.}

For  A , B , C , F = 351 , − 176 , 336 , 90000 , K = 1 , {\displaystyle A,B,C,F=351,-176,336,90000,\ K=1,} the ideal condition.

##### Implementation

[edit | edit source]

# python code

def hyperbola_a_pq (ABCF, flag = 0) :
'''
Ax^2 + By^2 + Cxy + Dx + Ey + F = 0
Here D = E = 0.
a,(p,q) = hyperbola_a_pq (ABCF [, flag])
ABCF implies hyperbola with center at origin (0,0).
if flag : print info about hyperbola.
'''
thisName = 'hyperbola_a_pq (ABCF, {}) :'.format(bool(flag))
A1,B1,C1,F1 = [ dD(str(v)) for v in ABCF ]
K = 4*F1/(C1**2 - 4*A1*B1)
A,B,C,F = [ K*v for v in (A1,B1,C1,F1) ] # Standard form.

# A = aa - pp ; pp = aa-A
# B = aa - qq ; qq = aa - B
# F = aa(pp + qq - aa)
# F = aa((aa-A) + (aa-B) - aa)
# F = aaaa-aaA + aaaa-aaB - aaaa
# F = aaaa - aaA - aaB
# aaaa - aaA - aaB - F = 0
# aaaa -(A + B)aa - F = 0

# We have a quadratic function in aa.
# (a_)(aa)(aa) + (b_)(aa) + (c_) = 0
# Coefficients of quadratic function:
a_,b_,c_ = 1, -(A+B), -F
discr = b_**2 - 4*a_*c_
root = discr.sqrt()
aa,X = (-b_ + root)/2, (-b_ - root)/2
# X positive: ellipse
# X negative: hyperbola
if X < 0 : pass
else :
print (thisName)
print ('    For hyperbola, X must be < 0. ',)
return None

a = aa.sqrt() ; pp = aa - A ; p = pp.sqrt()
if p : q = -C/(2*p)
else :
qq = aa - B ; q = qq.sqrt()

if flag :
# Print results.
print ()
print (thisName)
str1 = '({})x^2 + ({})y^2 + ({})xy + ({}) = 0'
str2 = str1.format(A1,B1,C1,F1)
print (str2)
if K != 1 :
str2a = str1.format(A,B,C,F)
print (str2a, 'Standard form.')

str3 = '({}, {})    (x - ({}))^2 + (y - ({}))^2 = 1'
print ('    F1:', str3.format(p,q, p,q))
print ('    F2:', str3.format(-p,-q, -p,-q))
cc = pp + q**2 ; c = cc.sqrt()
bb = cc - aa ; b = bb.sqrt()
for x in 'K A B C F X a b c'.split() :
print ('   ', x, '=', eval(x))

return a,(p,q)

### Second definition of hyperbola

[edit | edit source]

* * *

Graph of hyperbola  x 2 a 2 − y 2 b 2 = 1 {\displaystyle {\frac {x^{2}}{a^{2}}}-{\frac {y^{2}}{b^{2}}}=1} where  a , b = 20 , 15 {\displaystyle a,b=20,15} .
At vertex  V 2 , v u = e . {\displaystyle V_{2},\ {\frac {v}{u}}=e.}
At point  P 1 distance to Focus2 distance to Directrix2 = e . {\displaystyle P_{1}\ {\frac {\text{distance to Focus2}}{\text{distance to Directrix2}}}=e.}

Hyperbola is path of point that moves so that ratio of distance to fixed point and distance to fixed line is constant.

Let  c a = e {\displaystyle {\frac {c}{a}}=e} where:

* a {\displaystyle a} is non-zero,

* c > a , {\displaystyle c>a,}

* c = a + v . {\displaystyle c=a+v.}

Therefore,  e > 1. {\displaystyle e>1.}

Let directrix have equation  x = d {\displaystyle x=d} where  a d = e . {\displaystyle {\frac {a}{d}}=e.}

At vertex  V 2 : {\displaystyle V_{2}:}

distance to focus distance to directrix {\displaystyle {\frac {\text{distance to focus}}{\text{distance to directrix}}}} = v u = c − a a − d {\displaystyle ={\frac {v}{u}}={\frac {c-a}{a-d}}} = a e − a a − a / e = a e − a ( a e − a ) / e {\displaystyle ={\frac {ae-a}{a-a/e}}={\frac {ae-a}{(ae-a)/e}}} = ( a e − a ) e a e − a = e . {\displaystyle ={\frac {(ae-a)e}{ae-a}}=e.}

At point  P : {\displaystyle P:}

b 2 x 2 − a 2 y 2 = a 2 b 2 {\displaystyle b^{2}x^{2}-a^{2}y^{2}=a^{2}b^{2}}

a 2 y 2 = b 2 x 2 − a 2 b 2 {\displaystyle a^{2}y^{2}=b^{2}x^{2}-a^{2}b^{2}}

y 2 = b 2 x 2 − a 2 b 2 a 2 {\displaystyle y^{2}={\frac {b^{2}x^{2}-a^{2}b^{2}}{a^{2}}}} = ( c 2 − a 2 ) x 2 − a 2 ( c 2 − a 2 ) a 2 {\displaystyle ={\frac {(c^{2}-a^{2})x^{2}-a^{2}(c^{2}-a^{2})}{a^{2}}}} = ( a 2 e 2 − a 2 ) x 2 − a 2 ( c 2 − a 2 ) a 2 {\displaystyle ={\frac {(a^{2}e^{2}-a^{2})x^{2}-a^{2}(c^{2}-a^{2})}{a^{2}}}} = ( e 2 − 1 ) x 2 − ( a 2 e 2 − a 2 ) {\displaystyle =(e^{2}-1)x^{2}-(a^{2}e^{2}-a^{2})} = e 2 x 2 − x 2 − a 2 e 2 + a 2 {\displaystyle =e^{2}x^{2}-x^{2}-a^{2}e^{2}+a^{2}}

At point  P 1 x = c : {\displaystyle P_{1}\ x=c:}

y 2 = e 2 c 2 − c 2 − a 2 e 2 + a 2 {\displaystyle y^{2}=e^{2}c^{2}-c^{2}-a^{2}e^{2}+a^{2}} = e 2 a 2 e 2 − a 2 e 2 − a 2 e 2 + a 2 {\displaystyle =e^{2}a^{2}e^{2}-a^{2}e^{2}-a^{2}e^{2}+a^{2}} = a 2 ( e 4 − 2 e 2 + 1 ) {\displaystyle =a^{2}(e^{4}-2e^{2}+1)} = a 2 ( e 2 − 1 ) 2 {\displaystyle =a^{2}(e^{2}-1)^{2}}

y = a ( e 2 − 1 ) . {\displaystyle y=a(e^{2}-1).}

distance to directrix = c − d {\displaystyle {\text{distance to directrix}}=c-d} = a e − a / e {\displaystyle =ae-a/e} = ( a e e − a ) / e {\displaystyle =(aee-a)/e} = a ( e 2 − 1 ) / e {\displaystyle =a(e^{2}-1)/e}

distance to focus distance to directrix {\displaystyle {\frac {\text{distance to focus}}{\text{distance to directrix}}}} = a ( e 2 − 1 ) a ( e 2 − 1 ) / e {\displaystyle ={\frac {a(e^{2}-1)}{a(e^{2}-1)/e}}} = a ( e 2 − 1 ) e a ( e 2 − 1 ) = e . {\displaystyle ={\frac {a(e^{2}-1)e}{a(e^{2}-1)}}=e.}

Aim of this section is to prove that :  distance to focus distance to directrix = e … ( 3 ) {\displaystyle {\frac {\text{distance to focus}}{\text{distance to directrix}}}=e\ \dots \ (3)}

Statement  ( 3 ) {\displaystyle (3)} has been proved for two specific points, vertex  V 2 {\displaystyle V_{2}} and point  P 1 . {\displaystyle P_{1}.}

Section under "Proof" below proves that statement (3) is true for any point  P {\displaystyle P} on hyperbola.

#### Proof

[edit | edit source]

Proving that  distance from point to focus distance from point to directrix = e {\displaystyle {\frac {\text{distance from point to focus}}{\text{distance from point to directrix}}}=e} .
Graph is part of curve  x 2 a 2 − y 2 b 2 = 1. {\displaystyle {\frac {x^{2}}{a^{2}}}-{\frac {y^{2}}{b^{2}}}=1.}
At point  P : {\displaystyle P:}
distance to Directrix2  = x − d = x − a e = e x − a e . {\displaystyle =x-d=x-{\frac {a}{e}}={\frac {ex-a}{e}}.}
base =  x − c = x − a e {\displaystyle x-c=x-ae}
(distance to Focus2) 2 = base 2 + y 2 . {\displaystyle {\text{(distance to Focus2)}}^{2}={\text{base}}^{2}+y^{2}.}

As expressed above in statement  3 , {\displaystyle 3,} second definition of hyperbola states that hyperbola is path of point that moves so that ratio of distance to fixed point and distance to fixed line is constant.

This section proves that this definition is true for any point  P {\displaystyle P} on hyperbola.

At point  P : {\displaystyle P:}

y 2 = e 2 x 2 − x 2 + a 2 − a 2 e 2 {\displaystyle y^{2}=e^{2}x^{2}-x^{2}+a^{2}-a^{2}e^{2}}

base  = x − c = x − a e {\displaystyle =x-c=x-ae}

( distance F 2 P ) 2 = y 2 + base 2 = y 2 + ( x − a e ) 2 {\displaystyle ({\text{distance}}\ F_{2}P)^{2}=y^{2}+{\text{base}}^{2}=y^{2}+(x-ae)^{2}} = a 2 − 2 a e x + e 2 x 2 {\displaystyle =a^{2}-2aex+e^{2}x^{2}} = ( e x − a ) 2 {\displaystyle =(ex-a)^{2}}

distance to Focus2 = distance F 2 P = e x − a {\displaystyle {\text{distance to Focus2}}={\text{distance}}\ F_{2}P=ex-a}

distance to Directrix2 = x − d = x − a e = e x − a e {\displaystyle {\text{distance to Directrix2}}=x-d=x-{\frac {a}{e}}={\frac {ex-a}{e}}}

distance to Focus2 distance to Directrix2 {\displaystyle {\frac {\text{distance to Focus2}}{\text{distance to Directrix2}}}} = ( e x − a ) e ( e x − a ) {\displaystyle =(ex-a){\frac {e}{(ex-a)}}} = e {\displaystyle =e}

Similar calculations can be used to prove the case for Focus1  ( − c , 0 ) {\displaystyle (-c,0)} and Directrix1  ( x = − d ) {\displaystyle (x=-d)} in which case:

distance to Focus1 distance to Directrix1 {\displaystyle {\frac {\text{distance to Focus1}}{\text{distance to Directrix1}}}} = e {\displaystyle =e}

Therefore:  distance to focus distance to directrix = e {\displaystyle {\frac {\text{distance to focus}}{\text{distance to directrix}}}=e} where  e > 1. {\displaystyle e>1.}

Second definition of hyperbola has been proven valid:

Hyperbola is path of point that moves so that ratio of distance to fixed point and distance to fixed line is constant, called eccentricity  e . {\displaystyle e.}

### The general hyperbola

[edit | edit source]

In the two dimensional space of Cartesian Coordinate Geometry the hyperbola may be located anywhere and with any orientation.

To keep the calculation of the general hyperbola as simple as possible, there are two functions that will become very useful:

# python code

def move_section_relative (ABCDEF, gh, flag = 0) :
'''
Ax^2 + By^2 + Cxy + Dx + Ey + F = 0
A,B,C,D1,E1,F1 = move_section_relative ( (A,B,C,D,E,F), (g,h) [, flag])
This function moves conic section from its present position to a new
position (g,h) relative to present position.
'''
A,B,C,D,E,F = [ dD(str(v)) for v in ABCDEF ]
g,h = [ dD(str(v)) for v in gh ]

# After move, equation of hyperbola becomes:
# A(x-g)^2 + B(y-h)^2 + C(x-g)(y-h) + D(x-g) + E(y-h) + F = 0
# or
# Ax^2 + By^2 + Cxy + (D1)x + (E1)y + (F1) = 0 where:
D1 = D - C*h - 2*A*g
E1 = E - C*g - 2*B*h
F1 = A*g*g + C*g*h + B*h*h + F - D*g - E*h
if flag :
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'
str2 = str1.format(A,B,C,D,E,F)
print ('from:', str2)
str3 = str1.format(A,B,C,D1,E1,F1)
print ('to  :',str3)
return A,B,C,D1,E1,F1

# python code

def center_of_hyperbola (ABCDEF) :
'''
Ax^2 + By^2 + Cxy + Dx + Ey + F = 0
G,H = center_of_hyperbola (ABCDEF)
'''
A,B,C,D,E,F = [ dD(str(v)) for v in ABCDEF ]

# If center of hyperbola (G,H) is known then:
# move_section_relative (ABCDEF, (-G,-H))
# will move hyperbola to origin and D1 = E1 = 0.
# Equations for D1,E1 become:

# D - C*(-H) - 2*A*(-G) = 0
# E - C*(-G) - 2*B*(-H) = 0

# Two simultaneous equations in G,H:
# 2AG +  CH + D = 0
#  CG + 2BH + E = 0

# C2AG +   CCH +  CD = 0
# 2ACG + 2A2BH + 2AE = 0
#        (CC-4AB)H + (CD - 2AE) = 0
#        (CC-4AB)H = (2AE - CD)

#     (2AE - CD)
# H = 

-
#     (CC - 4AB)

H = (2*A*E - C*D)/(C*C - 4*A*B)
if A :
G = -(C*H + D)/(2*A)
return G,H
if C :
G = -(2*B*H + E)/C
return G,H
({}[11])

Compare the two simultaneous equations for  G , H {\displaystyle G,H} with those derived from calculus under Slope of curve.

#### Deriving equation

[edit | edit source]

To calculate the general equation three values must be known:

* Focus1  ( F 1 ) {\displaystyle (F_{1})}

* Focus2  ( F 2 ) {\displaystyle (F_{2})}

* Length of transverse axis  ( a ∗ 2 ) {\displaystyle (a*2)} or `two_a.`

Calculate center of hyperbola  ( G , H ) {\displaystyle (G,H)}

Calculate  a , ( p , q ) . {\displaystyle a,(p,q).}

Calculate equation of hyperbola at origin  A x 2 + B y 2 + C x y + F = 0. {\displaystyle Ax^{2}+By^{2}+Cxy+F=0.}

Move hyperbola from origin to point  ( G , H ) . {\displaystyle (G,H).}

# python code

def hyperbola_ABCDEF (two_a, F1, F2, flag = 0) :
'''
Ax^2 + By^2 + Cxy + Dx + Ey + F = 0

A,B,C,D,E,F = hyperbola_ABCDEF (two_a, F1, F2  [, flag])
two_a is length of transverse axis
F1 is Focus1: (F1x,F1y)
F2 is Focus2: (F2x,F2y)
if flag : print info about hyperbola.
'''
thisName = 'hyperbola_ABCDEF (two_a, F1, F2, {}) :'.format(bool(flag))

F1x,F1y = F1 ; F2x,F2y = F2
two_a,F1x,F1y,F2x,F2y = [ dD(str(v)) for v in (two_a,F1x,F1y,F2x,F2y) ]

a = two_a/2
if a == 0 :
print (thisName)
print ('    For hyperbola a must be non-zero.')
return None

G = (F1x + F2x)/2 ; H = (F1y + F2y)/2
p = F2x - G ; q = F2y - H
aa,pp,qq = a**2, p**2, q**2
cc = pp + qq
if cc > aa : pass
else :
print (thisName)
print ('    For hyperbola c must be greater than a.')
return None
A00,B00,C00,F00 = hyperbola_ABCF(a, (p,q)) # Hyperbola at origin.
A,B,C,D,E,F = move_section_relative ( (A00,B00,C00,0,0,F00), (G,H) )
( {A==A00, B==B00, C==C00} == {True} ) or ({}[2])

if flag :
print()
print(thisName)
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'
print (str1.format(A,B,C,D,E,F))
print ('   ', str1.format(A,B,C,0,0,F00))

str3 = '({},{})    (x - ({}))^2 + (y - ({}))^2 = 1'
print ('    F1:', str3.format(F1x,F1y, F1x,F1y))
print ('    F2:', str3.format(F2x,F2y, F2x,F2y))
print ('    GH:', str3.format(G,H, G,H))
print ('    f1:', str3.format(p,q, p,q))
print ('    f2:', str3.format(-p,-q, -p,-q))

bb = cc - aa
b = bb.sqrt() ; c = cc.sqrt()
print ('    a =', a)
print ('    b =', b)
print ('    c =', c)
print ('    eccentricity e =', c/a)
# Axis:
Dx = F1x-F2x ; Dy = F1y - F2y
# Dy x - Dx y + c = 0
a,b = Dy, -Dx
# ax + by + c = 0
c = -(a*F1x + b*F1y)
print ( '    axis: ({})x + ({})y + ({}) = 0'.format(a,b,c) )
return A,B,C,D,E,F

#### Examples

[edit | edit source]

Curve in Figure 1 below is defined by:

* Focus1,  F 1 = ( − 9 , 6 ) {\displaystyle F_{1}=(-9,6)}

* Focus2,  F 2 = ( − 9 , 102 ) {\displaystyle F_{2}=(-9,102)}

* Constant,  2 a = 60 {\displaystyle 2a=60}

Curve has equation:  ( 900 ) x 2 + ( − 1404 ) y 2 + ( 0 ) x y + ( 16200 ) x + ( 151632 ) y + ( − 2757564 ) = 0. {\displaystyle (900)x^{2}+(-1404)y^{2}+(0)xy+(16200)x+(151632)y+(-2757564)=0.}

Curve in Figure 2 below is defined by:

* Focus1,  F 1 = ( − 7 , 24 ) {\displaystyle F_{1}=(-7,24)}

* Focus2,  F 2 = ( 7 , − 24 ) {\displaystyle F_{2}=(7,-24)}

* Constant,  2 a = 40 {\displaystyle 2a=40}

Curve has equation:  ( 351 ) x 2 + ( − 176 ) y 2 + ( 336 ) x y + ( 0 ) x + ( 0 ) y + ( 90000 ) = 0 {\displaystyle (351)x^{2}+(-176)y^{2}+(336)xy+(0)x+(0)y+(90000)=0}

Curve in Figure 3 below is defined by:

* Focus1,  F 1 = ( 13 , − 27 ) {\displaystyle F_{1}=(13,-27)}

* Focus2,  F 2 = ( 43 , − 11 ) {\displaystyle F_{2}=(43,-11)}

* Constant,  2 a = 27.2 {\displaystyle 2a=27.2}

Curve has equation:  ( − 40.04 ) x 2 + ( 120.96 ) y 2 + ( − 240 ) x y + ( − 2317.76 ) x + ( 11316.48 ) y + ( 159198.4384 ) = 0 {\displaystyle (-40.04)x^{2}+(120.96)y^{2}+(-240)xy+(-2317.76)x+(11316.48)y+(159198.4384)=0}

* Figure 1.
Hyperbola parallel to Y axis.

* Figure 2.
Random hyperbola at origin.

* Figure 3.
Hyperbola with random position and orientation.

#### Reversing the process

[edit | edit source]

The expression "reversing the process" means calculating the values of  F 1 , F 2 {\displaystyle F_{1},F_{2}} and `length of transverse axis` when given equation of general hyperbola, the familiar values  A , B , C , D , E , F . {\displaystyle A,B,C,D,E,F.}

Calculate center of hyperbola.

Move hyperbola to origin.

Calculate a,(p,q) of hyperbola at origin.

Calculate  F 1 , F 2 {\displaystyle F_{1},F_{2}} and `length of transverse axis,` ( 2 a ) . {\displaystyle (2a).}

##### Implementation

[edit | edit source]

# python code

def hyperbola_2a_F1_F2 (ABCDEF, flag = 0) :
'''
Ax^2 + By^2 + Cxy + Dx + Ey + F = 0

two_a, F1, F2 = hyperbola_2a_F1_F2 (ABCDEF  [, flag])
two_a, (2)a, is length of transverse axis.
F1, (F1x,F1y), is Focus1.
F2, (F2x,F2y), is Focus2.
#bb = b**2 where (2)b is length of conjugate axis.
if flag == 1 : Check calculations.
if flag == 2 : Check and print result of calculations.
'''
thisName = 'hyperbola_2a_F1_F2 (ABCDEF, flag = {}) :'.format(flag)
( 2 >= flag >= 0 ) or ({}[1])
A,B,C,D,E,F = [ dD(str(v)) for v in ABCDEF ]
G,H = center_of_hyperbola ((A,B,C,D,E,F))
# Move hyperbola to origin.
A0,B0,C0,D0,E0,F0 = move_section_relative (ABCDEF, (-G,-H))
(D0 == E0 == 0) or ({}[2])
a,(p,q) = hyperbola_a_pq ( (A0,B0,C0,F0) )
# Two foci:
F1 = G+p,H+q ; F2 = G-p,H-q
if flag :
# Check calculations.
# Produce hyperbola in standard form.
ABCDEF_ = hyperbola_ABCDEF (2*a, F1, F2)
# zip returns:
# ( (ABCDEF[0], ABCDEF_[0]),
#    .....................
#   (ABCDEF[5], ABCDEF_[5]) )
# (Both v,v_ must be 0) or (Both v,v_ must be non-zero.)
for (v,v_) in zip(ABCDEF, ABCDEF_) : ( bool(v) == bool(v_) ) or ({}[3])
set1 = set([ (v_/v) for (v_,v) in zip( ABCDEF_, (A,B,C,D,E,F) ) if v ])
(len(set1) == 1) or ({}[4])

if flag == 2 :
print ()
print (thisName)
# Print results.
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'
str2 = str1.format(A,B,C,D,E,F)
print (str2)
K, = set1
if K != 1 :
A_,B_,C_,D_,E_,F_ = ABCDEF_
str3 = str1.format(A_,B_,C_,D_,E_,F_)
print (str3, 'Standard form.')
str4 = '({})x^2 + ({})y^2 + ({})xy + ({}) = 0'.format(A0,B0,C0,F0)
print (str4, 'At origin.')

F1x,F1y = F1 ; F2x,F2y = F2
two_c = distance_between_foci = ( (F1x-F2x)**2 + (F1y-F2y)**2 ).sqrt()
length_of_transverse_axis = 2*a
e = distance_between_foci/length_of_transverse_axis

for c in 'K G,H a 2*a two_c e'.split() :
print ('   ', c, '=', eval(c))
str5 = '({}, {})    (x - ({}))^2 + (y - ({}))^2 = 1'
print ('    F1:', str5.format(F1x,F1y, F1x,F1y))
print ('    F2:', str5.format(F2x,F2y, F2x,F2y))
print ('    f1:', str5.format(p,q, p,q))
print ('    f2:', str5.format(-p,-q, -p,-q))

# Axis:
Dx = F1x-F2x ; Dy = F1y - F2y
# Dy x - Dx y + c = 0
a1,b1 = Dy, -Dx
# a1 x + b1 y + c1 = 0
c1 = -(a1*F1x + b1*F1y)
print ( '    axis: ({})x + ({})y + ({}) = 0'.format(a1,b1,c1) )

return 2*a,F1,F2

##### Example

[edit | edit source]

Figure 1: Hyperbola with random position and orientation.
f ( x , y ) = 176 x 2 − 351 y 2 − 336 x y − 2528 x + 6504 y − 89104 = 0 {\displaystyle f(x,y)=176x^{2}-351y^{2}-336xy-2528x+6504y-89104=0}

Equation of hyperbola is given.
This section calculates `length of transverse axis,` F 1 , F 2 . {\displaystyle F_{1},F_{2}.}

A hyperbola has equation:  f ( x , y ) = 176 x 2 − 351 y 2 − 336 x y − 2528 x + 6504 y − 89104 = 0. {\displaystyle f(x,y)=176x^{2}-351y^{2}-336xy-2528x+6504y-89104=0.}

Calculate two foci and `length of transverse axis.`

# python code

ABCDEF = 176, -351, -336, -2528, 6504, -89104
two_a, F1, F2 = hyperbola_2a_F1_F2 (ABCDEF)
print ('Length of transverse axis =',two_a )
print ('F1 = ({},{})'.format(F1[0], F1[1] ))
print ('F2 = ({},{})'.format(F2[0], F2[1] ))

Length of transverse axis = 40
F1 = (35,-3)
F2 = (-13,11)

To check calculation and for more information about hyperbola:

# python code
hyperbola_2a_F1_F2 (ABCDEF, 2) # Set flag.

hyperbola_2a_F1_F2 (ABCDEF, flag = 2) :
(176.00)x^2 + (-351.00)y^2 + (-336)xy + (-2528.00)x + (6504.00)y + (-89104.0000) = 0
(-176.00)x^2 + (351.00)y^2 + (336.0)xy + (2528.000)x + (-6504.00)y + (89104.0000) = 0 Standard form.
(176.00)x^2 + (-351.00)y^2 + (-336)xy + (-90000.0000) = 0 At origin.
K = -1
G,H = (Decimal('11'), Decimal('4'))
a = 20.0
2*a = 40.0
two_c = 50.0
e = 1.25
F1: (35.0, -3)    (x - (35.0))^2 + (y - (-3))^2 = 1
F2: (-13.0, 11)    (x - (-13.0))^2 + (y - (11))^2 = 1
f1: (24.0, -7)    (x - (24.0))^2 + (y - (-7))^2 = 1
f2: (-24.0, 7)    (x - (-24.0))^2 + (y - (7))^2 = 1
axis: (-14)x + (-48.0)y + (346.0) = 0

### Asymptotes of hyperbola

[edit | edit source]

* * *

Graph of hyperbola  x 2 a 2 − y 2 b 2 = 1 {\displaystyle {\frac {x^{2}}{a^{2}}}-{\frac {y^{2}}{b^{2}}}=1} where  a , b = 4 , 3 {\displaystyle a,b=4,3} .
Blue lines are asymptotes of hyperbola.
Hyperbola and asymptotes do not intersect.
Any line parallel to asymptote intersects hyperbola in exactly one place.

We are familiar with values  a , c {\displaystyle a,c} where:

* Length of transverse axis  = 2 a {\displaystyle =2a}

* Distance between foci  = 2 c . {\displaystyle =2c.}

And we have said: Let  b 2 = c 2 − a 2 . {\displaystyle b^{2}=c^{2}-a^{2}.} What is  b {\displaystyle b} ?

Value  b {\displaystyle b} defines the  c o n j u g a t e a x i s . {\displaystyle conjugate\ axis.} In diagram, line segment  B 1 B 2 {\displaystyle B_{1}B_{2}} is conjugate axis with length  2 b . {\displaystyle 2b.}

Box at origin with length  2 a {\displaystyle 2a} and width  2 b {\displaystyle 2b} contains two special lines (blue lines) called  a s y m p t o t e s . {\displaystyle asymptotes.}

Let asymptote1 have equation  y = b a x … ( 1 ) . {\displaystyle y={\frac {b}{a}}x\ \dots \ (1).}

Hyperbola has equation  b 2 x 2 − a 2 y 2 = a 2 b 2 … ( 2 ) . {\displaystyle b^{2}x^{2}-a^{2}y^{2}=a^{2}b^{2}\ \dots \ (2).}

Calculate point of intersection of  ( 1 ) , ( 2 ) : {\displaystyle (1),(2):}

From  ( 1 ) : a y = b x . {\displaystyle (1):\ ay=bx.}

Substitute for  a y {\displaystyle ay} in  ( 2 ) : b 2 x 2 − b 2 x 2 = a 2 b 2 = 0. {\displaystyle (2):\ b^{2}x^{2}-b^{2}x^{2}=a^{2}b^{2}=0.}

This does not make sense. There is no real point of intersection of  ( 1 ) , ( 2 ) . {\displaystyle (1),(2).}

Let any line parallel to asymptote have equation:  y = b a x + m … ( 4 ) {\displaystyle y={\frac {b}{a}}x+m\ \dots \ (4)}

Calculate point of intersection of  ( 2 ) , ( 4 ) : {\displaystyle (2),(4):}

a y = b x + a m {\displaystyle ay=bx+am}

a y = b x + n {\displaystyle ay=bx+n}

b b x x − ( b x + n ) ( b x + n ) = a a b b {\displaystyle bbxx-(bx+n)(bx+n)=aabb}

b b x x − ( b b x x + 2 b n x + n n ) = a a b b {\displaystyle bbxx-(bbxx+2bnx+nn)=aabb}

b b x x − b b x x − 2 b n x − n n = a a b b {\displaystyle bbxx-bbxx-2bnx-nn=aabb}

− 2 b n x − n n = a a b b {\displaystyle -2bnx-nn=aabb}

− 2 b n x = a a b b + n n {\displaystyle -2bnx=aabb+nn}

x = − ( a 2 b 2 + n 2 ) 2 b n . {\displaystyle x={\frac {-(a^{2}b^{2}+n^{2})}{2bn}}.}

Provided that  m , n {\displaystyle m,n} are non-zero,  x {\displaystyle x} is a real number.

* Asymptote is line whose position is as close as possible to hyperbola (both sides) without touching it.

* Any line parallel to asymptote intersects hyperbola in exactly one place.

#### Line and hyperbola

[edit | edit source]

This section describes possibilities that arise when we consider intersection of line and hyperbola.

##### At origin

[edit | edit source]

Let hyperbola have equation  b 2 x 2 − a 2 y 2 = a 2 b 2 . {\displaystyle b^{2}x^{2}-a^{2}y^{2}=a^{2}b^{2}.}

Let line have equation:  y = m x + n . {\displaystyle y=mx+n.}

Let line intersect curve. For  y {\displaystyle y} substitute  ( m x + n ) : {\displaystyle (mx+n):}

b 2 x 2 − a 2 ( m x + n ) 2 = a 2 b 2 … ( 4 ) {\displaystyle b^{2}x^{2}-a^{2}(mx+n)^{2}=a^{2}b^{2}\ \dots \ (4)}

Expand  ( 4 ) , {\displaystyle (4),} simplify, gather like terms and result is quadratic function in  x : {\displaystyle x:}

( c 2 ) x 2 + ( c 1 ) x + ( c 0 ) = 0 … ( 5 ) {\displaystyle (c2)x^{2}+(c1)x+(c0)=0\ \dots \ (5)} where:

c 2 = a 2 m 2 − b 2 {\displaystyle c2=a^{2}m^{2}-b^{2}}

c 1 = 2 a 2 m n {\displaystyle c1=2a^{2}mn}

c 0 = a 2 ( b 2 + n 2 ) {\displaystyle c0=a^{2}(b^{2}+n^{2})}

From these results we can deduce:

* If line is parallel to asymptote, c2 = 0.

* If c2 == 0, line is parallel to asymptote.

* If line is asymptote, both  c 2 , c 1 {\displaystyle c_{2},c_{1}} are 0.

* If both  c 2 , c 1 {\displaystyle c_{2},c_{1}} are 0, line is asymptote.

These deductions are included in general case below.

##### Generally

[edit | edit source]

Let the conic section have the familiar equation:  A x 2 + B y 2 + C x y + D x + E y + F = 0. {\displaystyle Ax^{2}+By^{2}+Cxy+Dx+Ey+F=0.}

Let a line have equation:  y = f ( x ) = m x + n . {\displaystyle y=f(x)=mx+n.}

Let  f ( x ) {\displaystyle f(x)} intersect the conic section. For  y {\displaystyle y} in equation of conic section substitute  ( m x + n ) . {\displaystyle (mx+n).}

y = g ( x ) = A x 2 + B ( m x + n ) 2 + C x ( m x + n ) + D x + E ( m x + n ) + F = 0. {\displaystyle y=g(x)=Ax^{2}+B(mx+n)^{2}+Cx(mx+n)+Dx+E(mx+n)+F=0.}

Expand  g ( x ) , {\displaystyle g(x),} simplify, gather like terms and result is quadratic function in  x : {\displaystyle x:}

h ( x ) = ( a {\displaystyle h(x)=(a} _ ) x 2 + ( b {\displaystyle )x^{2}+(b} _ ) x + ( c {\displaystyle )x+(c} _ ) = 0 {\displaystyle )=0} where:

a {\displaystyle a} _  = A + B m 2 + C m {\displaystyle =A+Bm^{2}+Cm}

b {\displaystyle b} _  = 2 B m n + C n + D + E m {\displaystyle =2Bmn+Cn+D+Em}

c {\displaystyle c} _  = E n + F + B n 2 {\displaystyle =En+F+Bn^{2}}

If line  f ( x ) {\displaystyle f(x)} is an asymptote, then  a {\displaystyle a} _  = b {\displaystyle =b} _  = 0 , {\displaystyle =0,} in which case:

j ( m ) = ( {\displaystyle j(m)=\ (} _ a ) m 2 + ( {\displaystyle a)m^{2}+(} _ b ) m + ( {\displaystyle b)m+(} _ c ) = 0 {\displaystyle c)=0} where:

_ a = B ; {\displaystyle a=B;\ } _ b = C ; {\displaystyle b=C;\ } _ c = A {\displaystyle c=A}

and  m 1 , m 2 {\displaystyle m_{1},m_{2}} (roots of  j ( m ) {\displaystyle j(m)} ) are the slopes of the 2 asymptotes.

Python code below recognizes whether or not line is asymptote or parallel to asymptote.

##### Implementation

[edit | edit source]

# python code
def hyperbola_and_line (ABCDEF, line_abc, flag = 0) :
'''
This function calculates point/s of intersection (if any) of hyperbola and line.
hyperbola is: Ax^2 + By^2 + Cxy + Dx + Ey + F = 0
line is: ax + by + c = 0
To invoke:
[] = hyperbola_and_line (ABCDEF, line_abc[, flag])
[point1] = hyperbola_and_line (ABCDEF, line_abc[, flag])
[point1,point2] = hyperbola_and_line (ABCDEF, line_abc[, flag])
if line is asymptote or parallel to asymptote, output is type tuple.
if flag : check results.
if flag==2 : print results.
'''

(2 >= flag >= 0) or ({}[1])
thisName = 'hyperbola_and_line (ABCDEF, line_abc, {}) :'.format(flag)
a,b,c = [ dD(str(v)) for v in line_abc ]
# a,b,c refer to line ax + by + c = 0.
if a == b == 0 :
print (thisName)
print ('  At least one of a,b must be non-zero.')
return None
A,B,C,D,E,F = [ dD(str(v)) for v in ABCDEF ]

output = []
if b == 0:
# Reverse x,y going in.
result = hyperbola_and_line ( (B,A,C,E,D,F), (b,a,c))
# Reverse x,y coming out.
output = (type(result))([ v[::-1] for v in result ])
# output is same type as result.
else:
# Axx + Byy + Cxy + Dx + Ey + F = 0
# ax + by + c = 0 ; by = (- (ax + c))
# Multiply equation of hyperbola by bb:
# Abbxx + Bbyby + Cxbby + Dbbx + Ebby + Fbb = 0
# For 'by' substitute '(- (ax + c))'.
# Abbxx + B(-(ax+c))(-(ax+c)) + Cxb(-(ax+c)) + Dbbx + Eb(-(ax+c)) + Fbb = 0
# Expand and result is quadratic function in x, (a_)xx + (b_)x + (c_) = 0 where
a_ = A*b*b, + B*a*a, - C*a*b
b_ = B*2*a*c, + D*b*b, - C*b*c, - E*b*a
c_ = B*c*c, + F*b*b, - E*b*c
a_,b_,c_ = [ sum_zero(v) for v in (a_,b_,c_) ]
while 1:
if a_ == 0 :
# Line is parallel to asymptote.
# values_of_x is of type tuple.
if b_ == 0 :
# Line is asymptote. Return empty tuple.
values_of_x = tuple([]) ; break
values_of_x = ( -c_/b_, ) ; break

# values_of_x is of type list.
two_a = 2*a_ ; discr = sum_zero((b_**2, - 4*a_*c_))
if discr == 0 :
# discr is 0 or very close to 0.
values_of_x = [ -b_/two_a ] ; break

if discr < 0 :
values_of_x = [ ] ; break

root = discr.sqrt()
values_of_x = [ (-b_ - root)/two_a, (-b_ + root)/two_a ] ; break

for x in values_of_x :
by = -(a*x+c) ; y = by/b # Here is why b must be non-zero.
output += [ (x,y) ]
# output is same type as values_of_x.
output = (type(values_of_x))(output)

if flag :
# Check results.
errors = []
for x,y in output :
sum1 = sum_zero((A*x**2 , B*y**2 , C*x*y , D*x , E*y , F))
if sum1 :
errors += [ 'bad sum1: {} for point ({},{})'.format(sum1, x,y) ]
sum2 = sum_zero((a*x , b*y , c))
if sum2 :
errors += [ 'bad sum2: {} for point ({},{})'.format(sum2, x,y) ]
if errors or (flag == 2) :
# Print results.
print ()
print (thisName)
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'
print ( str1.format(A,B,C,D,E,F) )
str3 = '({})x + ({})y + ({}) = 0'.format(a,b,c)
print (str3)
print ( 'ABCDEF = A,B,C,D,E,F = {}, {}, {}, {}, {}, {}'.format(A,B,C,D,E,F) )
print ( 'abc = a,b,c = {}, {}, {}'.format(a,b,c) )

str4 = 'output[{}]: ({},{}),    (x - ({}))^2 + (y - ({}))^2 = 1'
for p in range (0,len(output)) :
x,y = output[p]
print ('   ', str4.format(p, x,y, x,y))
for v in errors : print ('   ',v)
# output may be empty: [] or (). () means asymptote.
# or output may contain one point:
#     [ (x1,y1) ] or ( (x1,y1), ). ( (x1,y1), ) means line is parallel to asymptote.
# or output may contain two points: [ (x1,y1), (x2,y2) ]
return output

##### Examples

[edit | edit source]

###### With no common point

[edit | edit source]

Diagram of hyperbola and two lines.
Both lines do not touch hyperbola.
Line 1 is asymptote.
Line 2 is not asymptote.

Line 1:

# python code

ABCDEF = A,B,C,D,E,F = 704, -1404, 1344, -11040, -41220, -161775

abc = a,b,c = 88.0, 234.0, 435.0
result = hyperbola_and_line (ABCDEF, abc)
sx = 'result' ; print (sx, eval(sx))

Code recognizes that line is asymptote and returns empty tuple:

result ()

Line 2:

# python code

result = hyperbola_and_line (ABCDEF, (1,0,-10)) # x = 10.
sx = 'result' ; print (sx, eval(sx))

Code recognizes that line is not asymptote and returns empty list:

result []

###### With one common point

[edit | edit source]

Diagram of hyperbola and two lines.
Each line and hyperbola have one common point.
Line 1 (blue) is parallel to asymptote.
Line 2 (orange) is not parallel to asymptote.

Line 1:

# python code

ABCDEF = A,B,C,D,E,F = 704, -1404, 1344, -11040, -41220, -161775

abc = a,b,c = 88.0, 234.0, -1065
result = hyperbola_and_line (ABCDEF, abc)
sx = 'result' ; print (sx, eval(sx))

Code recognizes that line is parallel to asymptote and returns tuple containing one point:

result ((24.6, -4.7),)

Line 2:

# python code

abc = a,b,c = -.96, -.28, 2.3
result = hyperbola_and_line (ABCDEF, abc)
sx = 'result' ; print (sx, eval(sx))

Code recognizes that line is not parallel to asymptote and returns list containing one point:

result [ (5.4, -10.3) ]

###### With two common points

[edit | edit source]

Diagram of hyperbola and line.
Line and hyperbola have two common points.
When line and hyperbola have two common points, line cannot be parallel to asymptote.

Line 1:

# python code

ABCDEF = A,B,C,D,E,F = 704, -1404, 1344, -11040, -41220, -161775

abc = a,b,c = .96, .28, .2
result = hyperbola_and_line (ABCDEF, abc)
sx = 'result' ; print (sx, eval(sx))

Code returns list containing two points:

result [ (1.425,-5.6), (4.575,-16.4) ]

#### Calculation of Asymptotes

[edit | edit source]

# python code

def asymptotes_of_hyperbola (ABCDEF, flag = 0) :
'''
asymptote1, asymptote2 = asymptotes_of_hyperbola (ABCDEF [, flag])
Each asymptote is of form (a,b,c) where ax + by + c = 0.
if flag == 1: check results.
if flag == 2: check and print results.
'''
(2 >= flag >= 0) or ({}[3])
thisName = 'asymptotes_of_hyperbola (ABCDEF, {}) :'.format(flag)

A,B,C,D,E,F = [ dD(str(v)) for v in ABCDEF ]

G,H = center_of_hyperbola (ABCDEF)
while 1 :
if A == B == 0 :
if 0 in (C,F) :
print (thisName)
print ('    For rectangular hyperbola, both C,F must be non-zero.')
return None
asymptote1 = 1,0,-G # x = G
asymptote2 = 0,1,-H # y = H
output = [ asymptote1, asymptote2 ] ; break

if B == 0 :
# Reverse x,y going in.
result = asymptotes_of_hyperbola ( (B,A,C,E,D,F), int(bool(flag)) )
(a1,b1,c1),(a2,b2,c2) = result
# Reverse x,y coming out.
output = [ (b1,a1,c1), (b2,a2,c2) ] ; break

_a,_b,_c = B,C,A
discr = _b**2 - 4*_a*_c
root = discr.sqrt()
m1 = (-_b - root),(2*_a)
m2 = (-_b + root),(2*_a)
#     p
# y = -x + c
#     q

# qy = px + c
# px - qy + c = 0
# ax + by + c = 0
p,q = m1 ; a1,b1 = p,-q
c1 = -(a1*G + b1*H)
asymptote1 = a1,b1,c1
p,q = m2 ; a2,b2 = p,-q
c2 = -(a2*G + b2*H)
asymptote2 = a2,b2,c2
output = [ asymptote1, asymptote2 ]

if flag :
# Check results.
values_of_c_ = []
for a3,b3,c3 in output :
# a3 x + b3 y + c3 = 0
# b3 y = -(a3 x + c3)
m = -a3/b3 ; c = -c3/b3
b_ = sum_zero((2*B*c*m , c*C , D , E*m))
b_ and ({}[6])
values_of_c_ += [ E*c + F + B*c**2 ]
c_1,c_2 = values_of_c_ # c_1,c_2 should be equal.
sum_zero ((c_1, -c_2)) and ({}[6])
break

if flag :
results = []
for asymptote in output :
result = hyperbola_and_line (ABCDEF, asymptote, 1)
results += [ result ]
set1 = { v==tuple([]) for v in results }
error = (set1 != {True})
if error or (flag == 2) :
print (thisName)
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'
a,b,c,d,e,f = [ float(v) for v in ABCDEF ]
print ( '   ', str1.format(a,b,c,d,e,f) )

asymptote1,asymptote2 = output
a1,b1,c1 = [ float(v) for v in asymptote1 ]
print ( '    asymptote1: ({})x + ({})y + ({}) = 0    {}'.format(a1,b1,c1, results[0]==()) )
a2,b2,c2 = [ float(v) for v in asymptote2 ]
print ( '    asymptote2: ({})x + ({})y + ({}) = 0    {}'.format(a2,b2,c2, results[1]==()) )
return output

#### Gallery

[edit | edit source]

* Figure 1.
Hyperbola parallel to X axis.

* Figure 2.
Hyperbola with asymptote horizontal.

* Figure 3.
Hyperbola with asymptote vertical.

* Figure 4.
Hyperbola with random orientation.

#### Family of hyperbolas

[edit | edit source]

Family of hyperbolas  3.1616 x 2 − 0.645975 y 2 − 2.4276 x y − 42.01 x − 4.41375 y + F n = 0. {\displaystyle 3.1616x^{2}-0.645975y^{2}-2.4276xy-42.01x-4.41375y+F_{n}=0.}

Asymptote1 (brown line):  − 1.3224 x + 1.29195 y + 16.02975 = 0 {\displaystyle -1.3224x+1.29195y+16.02975=0}
Asymptote2 (green line):  6.1776 x + 1.29195 y − 7.20225 = 0 {\displaystyle 6.1776x+1.29195y-7.20225=0}

Asymptotes of hyperbola are determined by coefficients  A , B , C , D , E . {\displaystyle A,B,C,D,E.}

All hyperbolas in diagram have coefficients  A , B , C , D , E = 3.1616 , − 0.645975 , − 2.4276 , − 42.01 , − 4.41375. {\displaystyle A,B,C,D,E=3.1616,-0.645975,-2.4276,-42.01,-4.41375.}

Consider the family of hyperbolas that satisfy equation:

f ( x , y ) = A x 2 + B y 2 + C x y + D x + E y + F n = 0. {\displaystyle f(x,y)=Ax^{2}+By^{2}+Cxy+Dx+Ey+F_{n}=0.}

Provided that coefficients  A , B , C , D , E {\displaystyle A,B,C,D,E} remain constant, hyperbolas of form  f ( x , y ) {\displaystyle f(x,y)} are members of a family, all of which share the same asymptotes.

Examples of this family in diagram are:

Hyperbola 1 (black): {\displaystyle {\text{Hyperbola 1 (black):}}}

3.1616 x 2 − 0.645975 y 2 − 2.4276 x y − 42.01 x − 4.41375 y − 59.359375 = 0 {\displaystyle 3.1616x^{2}-0.645975y^{2}-2.4276xy-42.01x-4.41375y-59.359375=0}

Hyperbola 2 (red): {\displaystyle {\text{Hyperbola 2 (red):}}}

3.1616 x 2 − 0.645975 y 2 − 2.4276 x y − 42.01 x − 4.41375 y − 59.359375 ( 5 ) = 0 {\displaystyle 3.1616x^{2}-0.645975y^{2}-2.4276xy-42.01x-4.41375y-59.359375(5)=0}

Hyperbola 3 (blue): {\displaystyle {\text{Hyperbola 3 (blue):}}}

3.1616 x 2 − 0.645975 y 2 − 2.4276 x y − 42.01 x − 4.41375 y + 59.359375 = 0 {\displaystyle 3.1616x^{2}-0.645975y^{2}-2.4276xy-42.01x-4.41375y+59.359375=0}

Hyperbola 4 (magenta): {\displaystyle {\text{Hyperbola 4 (magenta):}}}

3.1616 x 2 − 0.645975 y 2 − 2.4276 x y − 42.01 x − 4.41375 y + 59.359375 ( 5 ) = 0 {\displaystyle 3.1616x^{2}-0.645975y^{2}-2.4276xy-42.01x-4.41375y+59.359375(5)=0}

### Rectangular Hyperbolas

[edit | edit source]

Rectangular Hyperbolas are special cases of hyperbolas where the asymptotes are perpendicular. These have the general equation:

x y = c {\displaystyle xy=c}

Diagram 1. Graph of rectangular hyperbola at origin.
x y = n = 91 2 . {\displaystyle xy=n=91^{2}.}

A rectangular hyperbola has eccentricity  e = 2 . {\displaystyle e={\sqrt {2}}.}

If hyperbola is expressed as  x y = n , {\displaystyle xy=n,} then:

* Distance from origin to focus:  c = 2 n {\displaystyle c=2{\sqrt {n}}}

* Distance from origin to vertex:  a = c 2 = 2 n 2 = 2 n {\displaystyle a={\frac {c}{\sqrt {2}}}={\frac {2{\sqrt {n}}}{\sqrt {2}}}={\sqrt {2}}{\sqrt {n}}}

* Distance from origin to directrix:  d = a 2 = 2 n 2 = n . {\displaystyle d={\frac {a}{\sqrt {2}}}={\frac {{\sqrt {2}}{\sqrt {n}}}{\sqrt {2}}}={\sqrt {n}}.}

* c d = 2 n n = 2 = e 2 . {\displaystyle {\frac {c}{d}}={\frac {2{\sqrt {n}}}{\sqrt {n}}}=2=e^{2}.}

* Length of conjugate axis 2 = b = a {\displaystyle {\frac {\text{Length of conjugate axis}}{2}}=b=a} because  b 2 = c 2 − a 2 = 4 n − 2 n = 2 n = a 2 . {\displaystyle b^{2}=c^{2}-a^{2}=4n-2n=2n=a^{2}.}

* Focus  F 1 = ( a , a ) {\displaystyle F_{1}=(a,a)} because  a 2 + a 2 = 4 n = c 2 . {\displaystyle a^{2}+a^{2}=4n=c^{2}.}

* Focus  F 2 = ( − a , − a ) {\displaystyle F_{2}=(-a,-a)}

* Vertex  V 1 = ( d , d ) {\displaystyle V_{1}=(d,d)} because  d 2 + d 2 = 2 n = a 2 . {\displaystyle d^{2}+d^{2}=2n=a^{2}.}

* Vertex  V 2 = ( − d , − d ) {\displaystyle V_{2}=(-d,-d)}

* Directrix 1 has equation:  x 2 + y 2 = d {\displaystyle {\frac {x}{\sqrt {2}}}+{\frac {y}{\sqrt {2}}}=d} or  x + y = a {\displaystyle x+y=a}

* Directrix 2 has equation:  x 2 + y 2 = − d {\displaystyle {\frac {x}{\sqrt {2}}}+{\frac {y}{\sqrt {2}}}=-d} or  x + y = − a {\displaystyle x+y=-a}

It is obvious that asymptotes are the  X , Y {\displaystyle X,Y} axes.

#### Details

[edit | edit source]

Diagram 2: Detail of quadrant 1 of Diagram 1.
x y = n = 91 2 = 8281. {\displaystyle xy=n=91^{2}=8281.}

Diagram 2 shows detail of quadrant 1 of Diagram 1.

* Distance from origin to Directrix1  = {\displaystyle =} distance  O D 1 = d = n = 8281 = 91. {\displaystyle OD_{1}=d={\sqrt {n}}={\sqrt {8281}}=91.}

* Distance from origin to Vertex1  = {\displaystyle =} distance  O V 1 = a = d e = 2 d = 2 ⋅ 91. {\displaystyle OV_{1}=a=de={\sqrt {2}}d={\sqrt {2}}\cdot 91.}

* Distance from origin to Focus1  = {\displaystyle =} distance  O F 1 = c = a e = 2 a = 2 2 d = 2 ⋅ 91 = 182. {\displaystyle OF_{1}=c=ae={\sqrt {2}}a={\sqrt {2}}{\sqrt {2}}d=2\cdot 91=182.}

Line segment  B 1 V 1 B 2 : {\displaystyle B_{1}V_{1}B_{2}:}

* is parallel to conjugate axis,

* has length of conjugate axis:  2 b = 2 a , {\displaystyle 2b=2a,}

* has equation:  x + y = c . {\displaystyle x+y=c.}

Directrix1 has equation:  x + y = a . {\displaystyle x+y=a.}

Three circles are included for reference:

* Circle1, green line through point  D 1 {\displaystyle D_{1}} has equation:  x 2 + y 2 = d 2 . {\displaystyle x^{2}+y^{2}=d^{2}.}

* Circle2, magenta line through vertex  V 1 {\displaystyle V_{1}} has equation:  x 2 + y 2 = a 2 . {\displaystyle x^{2}+y^{2}=a^{2}.}

* Circle3, orange line through focus  F 1 {\displaystyle F_{1}} has equation:  x 2 + y 2 = c 2 . {\displaystyle x^{2}+y^{2}=c^{2}.}

#### Examples

[edit | edit source]

##### Rectangular hyperbola at origin

[edit | edit source]

Figure 1: Rectangular hyperbola at origin with transverse axis horizontal.
x 2 − y 2 = 8281 = 91 2 . {\displaystyle x^{2}-y^{2}=8281=91^{2}.}

Curve in Figure 1 has equation:  x 2 − y 2 = 8281. {\displaystyle x^{2}-y^{2}=8281.}

When  y = 0 , x 2 = 8281 , x = 8281 = 91 = a = {\displaystyle y=0,\ x^{2}=8281,x={\sqrt {8281}}=91=a=} distance O V 1 = {\displaystyle OV_{1}=} distance O V 2 . {\displaystyle OV_{2}.}

Vertex  V 1 {\displaystyle V_{1}} has coordinates  ( a , 0 ) . {\displaystyle (a,0).} Vertex  V 2 {\displaystyle V_{2}} has coordinates  ( − a , 0 ) . {\displaystyle (-a,0).}

Distance O F 1 = c = a 2 . {\displaystyle OF_{1}=c=a{\sqrt {2}}.}

Focus  F 1 {\displaystyle F_{1}} has coordinates  ( c , 0 ) . {\displaystyle (c,0).} Focus  F 2 {\displaystyle F_{2}} has coordinates  ( − c , 0 ) . {\displaystyle (-c,0).}

Distance O D 1 = d = a 2 . {\displaystyle OD_{1}=d={\frac {a}{\sqrt {2}}}.}

Point  D 1 {\displaystyle D_{1}} has coordinates  ( d , 0 ) . {\displaystyle (d,0).} Point  D 2 {\displaystyle D_{2}} has coordinates  ( − d , 0 ) . {\displaystyle (-d,0).}

Directrix1, directrix through point  D 1 {\displaystyle D_{1}} has equation  x = d . {\displaystyle x=d.}

Directrix2, directrix through point  D 2 {\displaystyle D_{2}} has equation  x = − d . {\displaystyle x=-d.}

Asymptote1 has equation:  y = x . {\displaystyle y=x.}

Asymptote2 has equation:  y = − x . {\displaystyle y=-x.}

Slope of asymptote1:  m 1 = 1. {\displaystyle m_{1}=1.}

Slope of asymptote2:  m 2 = − 1. {\displaystyle m_{2}=-1.}

Product of slopes:  m 1 ⋅ m 2 = − 1. {\displaystyle m_{1}\cdot m_{2}=-1.} Asymptotes are perpendicular.

##### Rectangular hyperbola parallel to Y axis

[edit | edit source]

Figure 2: Rectangular hyperbola parallel to Y axis.
( − 1.0 ) x 2 + ( 1.0 ) y 2 + ( 0.0 ) x y + ( 80.0 ) x + ( − 120.0 ) y + ( − 6281.0 ) = 0. {\displaystyle (-1.0)x^{2}+(1.0)y^{2}+(0.0)xy+(80.0)x+(-120.0)y+(-6281.0)=0.}
Curve is  y 2 − x 2 = 8281 {\displaystyle y^{2}-x^{2}=8281} moved from origin to point  C : ( 40 , 60 ) . {\displaystyle C:\ (40,60).}

Curve in Figure 2 has equation:  ( − 1.0 ) x 2 + ( 1.0 ) y 2 + ( 0.0 ) x y + ( 80.0 ) x + ( − 120.0 ) y + ( − 6281.0 ) = 0. {\displaystyle (-1.0)x^{2}+(1.0)y^{2}+(0.0)xy+(80.0)x+(-120.0)y+(-6281.0)=0.}

Center of hyperbola, point  C {\displaystyle C} has coordinates  ( 40 , 60 ) . {\displaystyle (40,60).}

Distance  C V 1 = a = 91 = {\displaystyle CV_{1}=a=91=} distance  C V 2 . {\displaystyle CV_{2}.}

Vertex  V 1 {\displaystyle V_{1}} has coordinates  ( 40 , 60 + a ) . {\displaystyle (40,60+a).} Vertex  V 2 {\displaystyle V_{2}} has coordinates  ( 40 , 60 − a ) . {\displaystyle (40,60-a).}

Distance  C F 1 = c = a 2 = {\displaystyle CF_{1}=c=a{\sqrt {2}}=} distance  C F 2 . {\displaystyle CF_{2}.}

Focus  F 1 {\displaystyle F_{1}} has coordinates  ( 40 , 60 + c ) . {\displaystyle (40,60+c).} Focus  F 2 {\displaystyle F_{2}} has coordinates  ( 40 , 60 − c ) . {\displaystyle (40,60-c).}

Distance  C D 1 = d = a 2 = {\displaystyle CD_{1}=d={\frac {a}{\sqrt {2}}}=} distance  C D 2 . {\displaystyle CD_{2}.}

Point  D 1 {\displaystyle D_{1}} has coordinates  ( 40 , 60 + d ) . {\displaystyle (40,60+d).} Point  D 2 {\displaystyle D_{2}} has coordinates  ( 40 , 60 − d ) . {\displaystyle (40,60-d).}

Directrix1, directrix through point  D 1 {\displaystyle D_{1}} has equation  y = 60 + d . {\displaystyle y=60+d.}

Directrix2, directrix through point  D 2 {\displaystyle D_{2}} has equation  y = 60 − d . {\displaystyle y=60-d.}

distance between foci distance between directrices = 2 c 2 d = a 2 a / 2 = a 2 2 a = 2 = e 2 . {\displaystyle {\frac {\text{distance between foci}}{\text{distance between directrices}}}={\frac {2c}{2d}}={\frac {a{\sqrt {2}}}{a/{\sqrt {2}}}}={\frac {a{\sqrt {2}}{\sqrt {2}}}{a}}=2=e^{2}.}

e = 2 {\displaystyle e={\sqrt {2}}}

Asymptote1 has equation:  y = − x + 100. {\displaystyle y=-x+100.}

Asymptote2 has equation:  y = x + 20. {\displaystyle y=x+20.}

Slope of asymptote1:  m 1 = − 1. {\displaystyle m_{1}=-1.}

Slope of asymptote2:  m 2 = 1. {\displaystyle m_{2}=1.}

Product of slopes:  m 1 ⋅ m 2 = − 1. {\displaystyle m_{1}\cdot m_{2}=-1.} Asymptotes are perpendicular.

##### Rectangular hyperbola, random

[edit | edit source]

Figure 3: Rectangular hyperbola with random position and orientation.
( − 6982.5392 ) x 2 + ( 6982.5392 ) y 2 + ( − 8903.7312 ) x y {\displaystyle (-6982.5392)x^{2}+(6982.5392)y^{2}+(-8903.7312)xy} + ( 627236.064 ) x + ( 783316.352 ) y + ( 58230998.28 ) = 0. {\displaystyle +(627236.064)x+(783316.352)y+(58230998.28)=0.}
Curve is  y 2 − x 2 = 8281 {\displaystyle y^{2}-x^{2}=8281} moved from origin to point  C : ( 57.36 , − 19.52 ) {\displaystyle C:\ (57.36,-19.52)} and rotated.

In all rectangular hyperbolas:
* Point  D 1 {\displaystyle D_{1}} is mid-point of segment  C F 1 . {\displaystyle CF_{1}.}
* Point  D 2 {\displaystyle D_{2}} is mid-point of segment  C F 2 . {\displaystyle CF_{2}.}

Curve in Figure 3 has equation:  ( − 6982.5392 ) x 2 {\displaystyle (-6982.5392)x^{2}} + ( 6982.5392 ) y 2 {\displaystyle +(6982.5392)y^{2}} + ( − 8903.7312 ) x y {\displaystyle +(-8903.7312)xy} + ( 627236.064 ) x {\displaystyle +(627236.064)x} + ( 783316.352 ) y {\displaystyle +(783316.352)y} + ( 58230998.28 ) = 0. {\displaystyle +(58230998.28)=0.}

Center of hyperbola, point  C {\displaystyle C} has coordinates  ( 57.36 , − 19.52 ) . {\displaystyle (57.36,-19.52).}

Distance  C V 1 = a = 91 = {\displaystyle CV_{1}=a=91=} distance  C V 2 . {\displaystyle CV_{2}.}

Vertex  V 1 {\displaystyle V_{1}} has coordinates  ( 144.72 , 5.96 ) . {\displaystyle (144.72,5.96).} Vertex  V 2 {\displaystyle V_{2}} has coordinates  ( − 30.0 , − 45.0 ) . {\displaystyle (-30.0,-45.0).}

Distance  C F 1 = c = a 2 = {\displaystyle CF_{1}=c=a{\sqrt {2}}=} distance  C F 2 . {\displaystyle CF_{2}.}

Focus  F 1 {\displaystyle F_{1}} has coordinates  ( 180.90569680891358 , 16.514161569266463 ) . {\displaystyle (180.90569680891358,16.514161569266463).} Focus  F 2 {\displaystyle F_{2}} has coordinates  ( − 66.18569680891359 , − 55.55416156926646 ) . {\displaystyle (-66.18569680891359,-55.55416156926646).}

Distance  C D 1 = d = a 2 = {\displaystyle CD_{1}=d={\frac {a}{\sqrt {2}}}=} distance  C D 2 . {\displaystyle CD_{2}.}

Point  D 1 {\displaystyle D_{1}} has coordinates  ( 119.1328484044568 , − 1.502919215366769 ) . {\displaystyle (119.1328484044568,-1.502919215366769).} Point  D 2 {\displaystyle D_{2}} has coordinates  ( − 4.412848404456792 , − 37.53708078463323 ) . {\displaystyle (-4.412848404456792,-37.53708078463323).}

Conjugate axis through point  C {\displaystyle C} has equation  ( − 0.96 ) x + ( − 0.28 ) y + ( 49.6 ) = 0. {\displaystyle (-0.96)x+(-0.28)y+(49.6)=0.}

Directrix1, directrix through point  D 1 {\displaystyle D_{1}} has equation  ( − 0.96 ) x + ( − 0.28 ) y + ( 49.6 + d ) = 0. {\displaystyle (-0.96)x+(-0.28)y+(49.6+d)=0.}

Directrix2, directrix through point  D 2 {\displaystyle D_{2}} has equation  ( − 0.96 ) x + ( − 0.28 ) y + ( 49.6 − d ) = 0. {\displaystyle (-0.96)x+(-0.28)y+(49.6-d)=0.}

Asymptote1 has equation:  ( − 7658.2688 ) x + ( − 13965.0784 ) y + ( 166679.968 ) = 0. {\displaystyle (-7658.2688)x+(-13965.0784)y+(166679.968)=0.}

Asymptote2 has equation:  ( 25465.7312 ) x + ( − 13965.0784 ) y + ( − 1733312.672 ) = 0. {\displaystyle (25465.7312)x+(-13965.0784)y+(-1733312.672)=0.}

Slope of asymptote1:  m 1 = − ( − 7658.2688 ) ( − 13965.0784 ) . {\displaystyle m_{1}={\frac {-(-7658.2688)}{(-13965.0784)}}.}

Slope of asymptote2:  m 2 = − ( 25465.7312 ) ( − 13965.0784 ) . {\displaystyle m_{2}={\frac {-(25465.7312)}{(-13965.0784)}}.}

Product of slopes:  m 1 ⋅ m 2 = 76582688 − 139650784 ⋅ 254657312 139650784 = 19502341471814656 − 19502341471814656 = − 1. {\displaystyle m_{1}\cdot m_{2}={\frac {76582688}{-139650784}}\cdot {\frac {254657312}{139650784}}={\frac {19502341471814656}{-19502341471814656}}=-1.} Asymptotes are perpendicular.

## Conic sections generally

[edit | edit source]

Within the two dimensional space of Cartesian Coordinate Geometry a conic section may be located anywhere and have any orientation.

This section examines the parabola, ellipse and hyperbola, showing how to calculate the equation of the conic section, and also how to calculate the foci and directrices given the equation.

### Deriving the equation

[edit | edit source]

The curve is defined as a point whose distance to the focus and distance to a line, the directrix, have a fixed ratio, eccentricity  e . {\displaystyle e.} Distance from focus to directrix must be non-zero.

Let the point have coordinates  ( x , y ) . {\displaystyle (x,y).}

Let the focus have coordinates  ( p , q ) . {\displaystyle (p,q).}

Let the directrix have equation  a x + b y + c = 0 {\displaystyle ax+by+c=0} where  a 2 + b 2 = 1. {\displaystyle a^{2}+b^{2}=1.}

Then  e = distance to focus distance to directrix {\displaystyle e={\frac {\text{distance to focus}}{\text{distance to directrix}}}} = ( x − p ) 2 + ( y − q ) 2 a x + b y + c {\displaystyle ={\frac {\sqrt {(x-p)^{2}+(y-q)^{2}}}{ax+by+c}}}

e ( a x + b y + c ) = ( x − p ) 2 + ( y − q ) 2 {\displaystyle e(ax+by+c)={\sqrt {(x-p)^{2}+(y-q)^{2}}}}

Square both sides:  ( a x + b y + c ) ( a x + b y + c ) e 2 = ( x − p ) 2 + ( y − q ) 2 {\displaystyle (ax+by+c)(ax+by+c)e^{2}=(x-p)^{2}+(y-q)^{2}}

Rearrange:  ( x − p ) 2 + ( y − q ) 2 − ( a x + b y + c ) ( a x + b y + c ) e 2 = 0 … ( 1 ) . {\displaystyle (x-p)^{2}+(y-q)^{2}-(ax+by+c)(ax+by+c)e^{2}=0\ \dots \ (1).}

Expand  ( 1 ) , {\displaystyle (1),} simplify, gather like terms and result is:

A x 2 + B y 2 + C x y + D x + E y + F = 0 {\displaystyle Ax^{2}+By^{2}+Cxy+Dx+Ey+F=0} where:

X = e 2 {\displaystyle X=e^{2}}

A = X a 2 − 1 {\displaystyle A=Xa^{2}-1}

B = X b 2 − 1 {\displaystyle B=Xb^{2}-1}

C = 2 X a b {\displaystyle C=2Xab}

D = 2 p + 2 X a c {\displaystyle D=2p+2Xac}

E = 2 q + 2 X b c {\displaystyle E=2q+2Xbc}

F = X c 2 − p 2 − q 2 {\displaystyle F=Xc^{2}-p^{2}-q^{2}}

Note that values  A , B , C , D , E , F {\displaystyle A,B,C,D,E,F} depend on:

* e {\displaystyle e} non-zero. This method is not suitable for circle where  e = 0. {\displaystyle e=0.}

* e 2 . {\displaystyle e^{2}.} Sign of  e ± {\displaystyle e\pm } is not significant.

* ( a x + b y + c ) 2 . ( ( − a ) x + ( − b ) y + ( − c ) ) 2 {\displaystyle (ax+by+c)^{2}.\ ((-a)x+(-b)y+(-c))^{2}} or  ( ( − 1 ) ( a x + b y + c ) ) 2 {\displaystyle ((-1)(ax+by+c))^{2}} and  ( a x + b y + c ) 2 {\displaystyle (ax+by+c)^{2}} produce same result.

For example, directrix  0.6 x − 0.8 y + 3 = 0 {\displaystyle 0.6x-0.8y+3=0} and directrix  − 0.6 x + 0.8 y − 3 = 0 {\displaystyle -0.6x+0.8y-3=0} produce same result.

### Implementation

[edit | edit source]

# python code
import decimal

dD = decimal.Decimal # Decimal object is like a float with (almost) unlimited precision.
dgt = decimal.getcontext()
Precision = dgt.prec = 22

def reduce_Decimal_number(number) :
# This function improves appearance of numbers.
# The technique used here is to perform the calculations using precision of 22,
# then convert to float or int to display result.
# -1e-22 becomes 0.
#  12.34999999999999999999 becomes 12.35
# -1.000000000000000000001 becomes -1.
# 1E+1 becomes 10.
# 0.3333333333333333333333 is unchanged.

thisName = 'reduce_Decimal_number(number) :'
if type(number) != dD : number = dD(str(number))

f1 = float(number)
if (f1 + 1) == 1 : return dD(0)
if int(f1) == f1 : return dD(int(f1))

dD1 = dD(str(f1))

t1 = dD1.normalize().as_tuple()
if (len(t1[1]) < 12) :
# if number == 12.34999999999999999999, dD1 = 12.35
return dD1

return number

def ABCDEF_from_abc_epq (abc,epq,flag = 0) :
'''
ABCDEF = ABCDEF_from_abc_epq (abc,epq[,flag])
'''
thisName = 'ABCDEF_from_abc_epq (abc,epq, {}) :'.format(bool(flag))
a,b,c = [ dD(str(v)) for v in abc ]
e,p,q = [ dD(str(v)) for v in epq ]

divider = a**2 + b**2
if divider == 0 :
print (thisName, 'At least one of (a,b) must be non-zero.')
return None
if divider != 1 :
root = divider.sqrt()
a,b,c = [ (v/root) for v in (a,b,c) ]

distance_from_focus_to_directrix = a*p + b*q + c
if distance_from_focus_to_directrix == 0 :
print (thisName, 'distance_from_focus_to_directrix must be non-zero.')
return None

X = e*e
A = X*a**2 - 1
B = X*b**2 - 1
C = 2*X*a*b
D = 2*p + 2*X*a*c
E = 2*q + 2*X*b*c
F = X*c**2 - p*p - q*q

A,B,C,D,E,F = [ reduce_Decimal_number(v) for v in (A,B,C,D,E,F) ]

if flag :
print (thisName)
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'.format(A,B,C,D,E,F)
print (' ', str1)

return (A,B,C,D,E,F)

### Examples

[edit | edit source]

#### Parabola

[edit | edit source]

Every parabola has eccentricity  e = 1. {\displaystyle e=1.}

Quadratic function complies with definition of parabola.
Distance from point  ( 6 , 9 ) {\displaystyle (6,9)} to focus
= distance from point  ( 6 , 9 ) {\displaystyle (6,9)} to directrix = 10.
Distance from point  ( 0 , 0 ) {\displaystyle (0,0)} to focus
= distance from point  ( 0 , 0 ) {\displaystyle (0,0)} to directrix = 1.

Simple quadratic function:

Let focus be point  ( 0 , 1 ) . {\displaystyle (0,1).}

Let directrix have equation:  y = − 1 {\displaystyle y=-1} or  ( 0 ) x + ( 1 ) y + 1 = 0. {\displaystyle (0)x+(1)y+1=0.}

# python code

p,q = 0,1
a,b,c = abc = 0,1,q
epq = 1,p,q

ABCDEF = ABCDEF_from_abc_epq (abc,epq,1)
print ('ABCDEF =', ABCDEF)

(-1)x^2 + (0)y^2 + (0)xy + (0)x + (4)y + (0) = 0
ABCDEF = (Decimal('-1'), Decimal('0'), Decimal('0'), Decimal('0'), Decimal('4'), Decimal('0'))

As conic section curve has equation:  ( − 1 ) x 2 + ( 0 ) y 2 + ( 0 ) x y + ( 0 ) x + ( 4 ) y + ( 0 ) = 0 {\displaystyle (-1)x^{2}+(0)y^{2}+(0)xy+(0)x+(4)y+(0)=0}

Curve is quadratic function:  4 y = x 2 {\displaystyle 4y=x^{2}} or  y = x 2 4 {\displaystyle y={\frac {x^{2}}{4}}}

For a quick check select some random points on the curve:

# python code

for x in (-2,4,6) :
y = x**2/4
print ('\nFrom point ({}, {}):'.format(x,y))
distance_to_focus = ((x-p)**2 + (y-q)**2)**.5
distance_to_directrix = a*x + b*y + c
s1 = 'distance_to_focus' ; print (s1, eval(s1))
s1 = 'distance_to_directrix' ; print (s1, eval(s1))

From point (-2, 1.0):
distance_to_focus 2.0
distance_to_directrix 2.0

From point (4, 4.0):
distance_to_focus 5.0
distance_to_directrix 5.0

From point (6, 9.0):
distance_to_focus 10.0
distance_to_directrix 10.0

##### Gallery

[edit | edit source]

Curve in Figure 1 below has:

* Directrix:  y = − 23 {\displaystyle y=-23}

* Focus:  ( 7 , − 21 ) {\displaystyle (7,-21)}

* Equation:  ( − 1 ) x 2 + ( 0 ) y 2 + ( 0 ) x y + ( 14 ) x + ( 4 ) y + ( 39 ) = 0 {\displaystyle (-1)x^{2}+(0)y^{2}+(0)xy+(14)x+(4)y+(39)=0} or  y = x 2 − 14 x − 39 4 {\displaystyle y={\frac {x^{2}-14x-39}{4}}}

Curve in Figure 2 below has:

* Directrix:  x = 12 {\displaystyle x=12}

* Focus:  ( 10 , − 7 ) {\displaystyle (10,-7)}

* Equation:  ( 0 ) x 2 + ( − 1 ) y 2 + ( 0 ) x y + ( − 4 ) x + ( − 14 ) y + ( − 5 ) = 0 {\displaystyle (0)x^{2}+(-1)y^{2}+(0)xy+(-4)x+(-14)y+(-5)=0} or  x = − ( y 2 + 14 y + 5 ) 4 {\displaystyle x={\frac {-(y^{2}+14y+5)}{4}}}

Curve in Figure 3 below has:

* Directrix:  ( 0.6 ) x − ( 0.8 ) y + ( 2.0 ) = 0 {\displaystyle (0.6)x-(0.8)y+(2.0)=0}

* Focus:  ( 6.6 , 6.2 ) {\displaystyle (6.6,6.2)}

* Equation:  − ( 0.64 ) x 2 − ( 0.36 ) y 2 − ( 0.96 ) x y + ( 15.6 ) x + ( 9.2 ) y − ( 78 ) = 0 {\displaystyle -(0.64)x^{2}-(0.36)y^{2}-(0.96)xy+(15.6)x+(9.2)y-(78)=0}

* Figure 1. y = x 2 − 14 x − 39 4 {\displaystyle y={\frac {x^{2}-14x-39}{4}}}

* Figure 2. x = − ( y 2 + 14 y + 5 ) 4 {\displaystyle x={\frac {-(y^{2}+14y+5)}{4}}}

* Figure 3.
− ( 0.64 ) x 2 − ( 0.36 ) y 2 {\displaystyle -(0.64)x^{2}-(0.36)y^{2}} − ( 0.96 ) x y + ( 15.6 ) x {\displaystyle -(0.96)xy+(15.6)x} + ( 9.2 ) y − ( 78 ) = 0 {\displaystyle +(9.2)y-(78)=0}

#### Ellipse

[edit | edit source]

Every ellipse has eccentricity  1 > e > 0. {\displaystyle 1>e>0.}

Ellipse with ecccentricity of 0.25 and center at origin.
Point1  = ( 0 , 3.87298334620741688517926539978 ) . {\displaystyle =(0,3.87298334620741688517926539978).}
Eccentricity  e = distance from point1 to focus distance from point1 to directrix = 4 16 = 0.25. {\displaystyle e={\frac {\text{distance from point1 to focus}}{\text{distance from point1 to directrix}}}={\frac {4}{16}}=0.25.}
For every point on curve,  e = 0.25. {\displaystyle e=0.25.}

A simple ellipse:

Let focus be point  ( p , q ) {\displaystyle (p,q)} where  p , q = − 1 , 0 {\displaystyle p,q=-1,0}

Let directrix have equation:  ( 1 ) x + ( 0 ) y + 16 = 0 {\displaystyle (1)x+(0)y+16=0} or  x = − 16. {\displaystyle x=-16.}

Let eccentricity  e = 0.25 {\displaystyle e=0.25}

# python code
p,q = -1,0
e = 0.25
abc = a,b,c = 1,0,16
epq = e,p,q
ABCDEF_from_abc_epq  (abc,epq,1)

(-0.9375)x^2 + (-1)y^2 + (0)xy + (0)x + (0)y + (15) = 0

Ellipse has center at origin and equation:  ( 0.9375 ) x 2 + ( 1 ) y 2 = ( 15 ) . {\displaystyle (0.9375)x^{2}+(1)y^{2}=(15).}

Some basic checking:

# python code

points = (
(-4  ,  0    ),
(-3.5, -1.875),
( 3.5,  1.875),
(-1  ,  3.75 ),
( 1  , -3.75 ),

A,B,F = -0.9375, -1, 15

for (x,y) in points :
# Verify that point is on curve.
(A*x**2 + B*y**2 + F) and 1/0 # Create exception if sum != 0.
distance_to_focus = ( (x-p)**2 + (y-q)**2 )**.5
distance_to_directrix = a*x + b*y + c
e = distance_to_focus / distance_to_directrix
s1 = 'x,y' ; print (s1, eval(s1))
s1 = '    distance_to_focus, distance_to_directrix, e' ; print (s1, eval(s1))

x,y (-4, 0)
distance_to_focus, distance_to_directrix, e (3.0, 12, 0.25)
x,y (-3.5, -1.875)
distance_to_focus, distance_to_directrix, e (3.125, 12.5, 0.25)
x,y (3.5, 1.875)
distance_to_focus, distance_to_directrix, e (4.875, 19.5, 0.25)
x,y (-1, 3.75)
distance_to_focus, distance_to_directrix, e (3.75, 15.0, 0.25)
x,y (1, -3.75)
distance_to_focus, distance_to_directrix, e (4.25, 17.0, 0.25)

Ellipses with ecccentricities from 0.1 to 0.9.
As eccentricity approaches  0 , {\displaystyle 0,} shape of ellipse approaches shape of circle.
As eccentricity approaches  1 , {\displaystyle 1,} shape of ellipse approaches shape of parabola.

The effect of eccentricity.

All ellipses in diagram have:

* Focus at point  ( − 1 , 0 ) {\displaystyle (-1,0)}

* Directrix with equation  x = − 16. {\displaystyle x=-16.}

Five ellipses are shown with eccentricities varying from  0.1 {\displaystyle 0.1} to  0.9. {\displaystyle 0.9.}

##### Gallery

[edit | edit source]

Curve in Figure 1 below has:

* Directrix:  x = − 10 {\displaystyle x=-10}

* Focus:  ( 3 , 0 ) {\displaystyle (3,0)}

* Eccentricity:  e = 0.5 {\displaystyle e=0.5}

* Equation:  ( − 0.75 ) x 2 + ( − 1 ) y 2 + ( 0 ) x y + ( 11 ) x + ( 0 ) y + ( 16 ) = 0 {\displaystyle (-0.75)x^{2}+(-1)y^{2}+(0)xy+(11)x+(0)y+(16)=0}

Curve in Figure 2 below has:

* Directrix:  y = − 12 {\displaystyle y=-12}

* Focus:  ( 7 , − 4 ) {\displaystyle (7,-4)}

* Eccentricity:  e = 0.7 {\displaystyle e=0.7}

* Equation:  ( − 1 ) x 2 + ( − 0.51 ) y 2 + ( 0 ) x y + ( 14 ) x + ( 3.76 ) y + ( 5.56 ) = 0 {\displaystyle (-1)x^{2}+(-0.51)y^{2}+(0)xy+(14)x+(3.76)y+(5.56)=0}

Curve in Figure 3 below has:

* Directrix:  ( 0.6 ) x − ( 0.8 ) y + ( 2.0 ) = 0 {\displaystyle (0.6)x-(0.8)y+(2.0)=0}

* Focus:  ( 8 , 5 ) {\displaystyle (8,5)}

* Eccentricity:  e = 0.9 {\displaystyle e=0.9}

* Equation:  ( − 0.7084 ) x 2 + ( − 0.4816 ) y 2 + ( − 0.7776 ) x y + ( 17.944 ) x + ( 7.408 ) y + ( − 85.76 ) = 0 {\displaystyle (-0.7084)x^{2}+(-0.4816)y^{2}+(-0.7776)xy+(17.944)x+(7.408)y+(-85.76)=0}

* Figure 1.
Ellipse on X axis.

* Figure 2.
Ellipse parallel to Y axis.

* Figure 3.
Ellipse with random orientation.

#### Hyperbola

[edit | edit source]

Every hyperbola has eccentricity  e > 1. {\displaystyle e>1.}

Hyperbola with eccentricity of 1.5 and center at origin.
Point1  = ( 22.5 , 21 ) . {\displaystyle =(22.5,21).}
Eccentricity  e = distance from point1 to focus distance from point1 to directrix = 37.5 25 = 1.5. {\displaystyle e={\frac {\text{distance from point1 to focus}}{\text{distance from point1 to directrix}}}={\frac {37.5}{25}}=1.5.}
For every point on curve,  e = 1.5. {\displaystyle e=1.5.}

A simple hyperbola:

Let focus be point  ( p , q ) {\displaystyle (p,q)} where  p , q = 0 , − 9 {\displaystyle p,q=0,-9}

Let directrix have equation:  ( 0 ) x + ( 1 ) y + 4 = 0 {\displaystyle (0)x+(1)y+4=0} or  y = − 4. {\displaystyle y=-4.}

Let eccentricity  e = 1.5 {\displaystyle e=1.5}

# python code
p,q = 0,-9
e = 1.5
abc = a,b,c = 0,1,4
epq = e,p,q
ABCDEF_from_abc_epq  (abc,epq,1)

(-1)x^2 + (1.25)y^2 + (0)xy + (0)x + (0)y + (-45) = 0

Hyperbola has center at origin and equation:  ( 1.25 ) y 2 − x 2 = 45. {\displaystyle (1.25)y^{2}-x^{2}=45.}

Some basic checking:

# python code

four_points = pt1,pt2,pt3,pt4 = (-7.5,9),(-7.5,-9),(22.5,21),(22.5,-21)
for (x,y) in four_points :
# Verify that point is on curve.
sum = 1.25*y**2 - x**2 - 45
sum and 1/0 # Create exception if sum != 0.
distance_to_focus = ( (x-p)**2 + (y-q)**2 )**.5
distance_to_directrix = a*x + b*y + c
e = distance_to_focus / distance_to_directrix
s1 = 'x,y' ; print (s1, eval(s1))
s1 = '    distance_to_focus, distance_to_directrix, e' ; print (s1, eval(s1))

x,y (-7.5, 9)
distance_to_focus, distance_to_directrix, e (19.5, 13.0, 1.5)
x,y (-7.5, -9)
distance_to_focus, distance_to_directrix, e (7.5, -5.0, -1.5)
x,y (22.5, 21)
distance_to_focus, distance_to_directrix, e (37.5, 25.0, 1.5)
x,y (22.5, -21)
distance_to_focus, distance_to_directrix, e (25.5, -17.0, -1.5)

Hyperbolas with ecccentricities from 1.5 to 20.
As eccentricity increases, curve approaches directrix:  y = − 4. {\displaystyle y=-4.}
As eccentricity approaches  1 , {\displaystyle 1,} shape of curve approaches shape of parabola.

The effect of eccentricity.

All hyperbolas in diagram have:

* Focus at point  ( 0 , − 9 ) {\displaystyle (0,-9)}

* Directrix with equation  y = − 4. {\displaystyle y=-4.}

Six hyperbolas are shown with eccentricities varying from  1.5 {\displaystyle 1.5} to  20. {\displaystyle 20.}

##### Gallery

[edit | edit source]

Curve in Figure 1 below has:

* Directrix:  y = 6 {\displaystyle y=6}

* Focus:  ( 0 , 1 ) {\displaystyle (0,1)}

* Eccentricity:  e = 1.5 {\displaystyle e=1.5}

* Equation:  ( − 1 ) x 2 + ( 1.25 ) y 2 + ( 0 ) x y + ( 0 ) x + ( − 25 ) y + ( 80 ) = 0 {\displaystyle (-1)x^{2}+(1.25)y^{2}+(0)xy+(0)x+(-25)y+(80)=0}

Curve in Figure 2 below has:

* Directrix:  x = 1 {\displaystyle x=1}

* Focus:  ( − 5 , 6 ) {\displaystyle (-5,6)}

* Eccentricity:  e = 2.5 {\displaystyle e=2.5}

* Equation:  ( 5.25 ) x 2 + ( − 1 ) y 2 + ( 0 ) x y + ( − 22.5 ) x + ( 12 ) y + ( − 54.75 ) = 0 {\displaystyle (5.25)x^{2}+(-1)y^{2}+(0)xy+(-22.5)x+(12)y+(-54.75)=0}

Curve in Figure 3 below has:

* Directrix:  ( 0.8 ) x + ( 0.6 ) y + ( 2.0 ) = 0 {\displaystyle (0.8)x+(0.6)y+(2.0)=0}

* Focus:  ( − 28 , 12 ) {\displaystyle (-28,12)}

* Eccentricity:  e = 1.2 {\displaystyle e=1.2}

* Equation:  ( − 0.0784 ) x 2 + ( − 0.4816 ) y 2 + ( 1.3824 ) x y + ( − 51.392 ) x + ( 27.456 ) y + ( − 922.24 ) = 0 {\displaystyle (-0.0784)x^{2}+(-0.4816)y^{2}+(1.3824)xy+(-51.392)x+(27.456)y+(-922.24)=0}

* Figure 1.
Hyperbola on Y axis.

* Figure 2.
Hyperbola parallel to X axis.

* Figure 3.
Hyperbola with random orientation.

### Reversing the process

[edit | edit source]

The expression "reversing the process" means calculating the values of  e , {\displaystyle e,} focus and directrix when given the equation of the conic section, the familiar values  A , B , C , D , E , F . {\displaystyle A,B,C,D,E,F.}

Consider the equation of a simple ellipse:  0.9375 x 2 + y 2 = 15. {\displaystyle 0.9375x^{2}+y^{2}=15.} This is a conic section where  A , B , C , D , E , F = − 0.9375 , − 1 , 0 , 0 , 0 , 15. {\displaystyle A,B,C,D,E,F=-0.9375,-1,0,0,0,15.}

This ellipse may be expressed as  15 x 2 + 16 y 2 = 240 , {\displaystyle 15x^{2}+16y^{2}=240,} a format more appealing to the eye than numbers containing fractions or decimals.

However, when this ellipse is expressed as  − 0.9375 x 2 − y 2 + 15 = 0 , {\displaystyle -0.9375x^{2}-y^{2}+15=0,} this format is the ellipse expressed in "standard form," a notation that greatly simplifies the calculation of  a , b , c , e , p , q . {\displaystyle a,b,c,e,p,q.}

Modify the equations for  A , B , C {\displaystyle A,B,C} slightly:

K A = X a a − 1 {\displaystyle KA=Xaa-1} or  X a a = K A + 1 … ( 1 ) {\displaystyle Xaa=KA+1\ \dots \ (1)}

K B = X b b − 1 {\displaystyle KB=Xbb-1} or  X b b = K B + 1 … ( 2 ) {\displaystyle Xbb=KB+1\ \dots \ (2)}

K C = 2 X a b … ( 3 ) {\displaystyle KC=2Xab\ \dots \ (3)}

( 3 ) squared: K K C C = 4 X a a X b b … ( 4 ) {\displaystyle (3)\ {\text{squared:}}\ KKCC=4XaaXbb\ \dots \ (4)}

In  ( 4 ) {\displaystyle (4)} substitute for  X a a , X b b : {\displaystyle Xaa,Xbb:} C 2 K 2 = 4 ( K A + 1 ) ( K B + 1 ) … ( 5 ) {\displaystyle C^{2}K^{2}=4(KA+1)(KB+1)\ \dots \ (5)}

( 5 ) {\displaystyle (5)} is a quadratic equation in  K : ( a _ ) K 2 + ( b _ ) K + ( c _ ) = 0 {\displaystyle K:\ (a\\_)K^{2}+(b\\_)K+(c\\_)=0} where:

a _ = 4 A B − C 2 {\displaystyle a\\_=4AB-C^{2}}

b _ = 4 ( A + B ) {\displaystyle b\\_=4(A+B)}

c _ = 4 {\displaystyle c\\_=4}

Because  ( 5 ) {\displaystyle (5)} is a quadratic equation, the solution of  ( 5 ) {\displaystyle (5)} may contain an unwanted value of  K {\displaystyle K} that will be eliminated later.

From  ( 1 ) {\displaystyle (1)} and  ( 2 ) : {\displaystyle (2):}

X a a + X b b = K A + K B + 2 {\displaystyle Xaa+Xbb=KA+KB+2}

X ( a a + b b ) = K A + K B + 2 {\displaystyle X(aa+bb)=KA+KB+2}

Because  a a + b b = 1 , X = K A + K B + 2 {\displaystyle aa+bb=1,\ X=KA+KB+2}

#### Implementation

[edit | edit source]

# python code

def solve_quadratic (abc) :
'''
result = solve_quadratic (abc)
result may be :

[ root1 ]
[ root1, root2 ]
'''
a,b,c = abc

if a == 0 : return [ -c/b ]

disc = b**2 - 4*a*c

if disc < 0 : return []

two_a = 2*a
if disc == 0 : return [ -b/two_a ]

root = disc.sqrt()
r1,r2 = (-b - root)/two_a, (-b + root)/two_a
return [r1,r2]

def calculate_Kab (ABC, flag=0) :
'''
result = calculate_Kab (ABC)
result may be :

[tuple1]
[tuple1,tuple2]
'''
thisName = 'calculate_Kab (ABC, {}) :'.format(bool(flag))
A_,B_,C_ = [ dD(str(v)) for v in ABC ]
# Quadratic function in K: (a_)K**2 + (b_)K + (c_) = 0
a_ = 4*A_*B_ - C_*C_
b_ = 4*(A_+B_)
c_ = 4

values_of_K = solve_quadratic ((a_,b_,c_))

if flag :
print (thisName)
str1 = '  A_,B_,C_' ; print (str1,eval(str1))
str1 = '  a_,b_,c_' ; print (str1,eval(str1))
print ('  y = ({})x^2 + ({})x + ({})'.format( float(a_), float(b_), float(c_) ))
str1 = '  values_of_K' ; print (str1,eval(str1))

output = []
for K in values_of_K :
A,B,C = [ reduce_Decimal_number(v*K) for v in (A_,B_,C_) ]
X = A + B + 2
if X <= 0 :
# Here is one place where the spurious value of K may be eliminated.
if flag : print ('  K = {}, X = {}, continuing.'.format(K, X))
continue

aa = reduce_Decimal_number((A + 1)/X)

if flag :
print ('  K =', K)
for strx in ('A', 'B', 'C', 'X', 'aa') :
print ('   ', strx, eval(strx))

if aa == 0 :
a = dD(0) ; b = dD(1)
else :
a = aa.sqrt() ; b = C/(2*X*a)

Kab = [ reduce_Decimal_number(v) for v in (K,a,b) ]
output += [ Kab ]
if flag:
print (thisName)
for t in range (0, len(output)) :
str1 = '  output[{}] = {}'.format(t,output[t])
print (str1)
return output

#### More calculations

[edit | edit source]

The values  D , E , F : {\displaystyle D,E,F:}

D = 2 p + 2 X a c ; 2 p = ( D − 2 X a c ) {\displaystyle D=2p+2Xac;\ 2p=(D-2Xac)}

E = 2 q + 2 X b c ; 2 q = ( E − 2 X b c ) {\displaystyle E=2q+2Xbc;\ 2q=(E-2Xbc)}

F = X c c − p p − q q … ( 10 ) {\displaystyle F=Xcc-pp-qq\ \dots \ (10)}

( 10 ) ∗ 4 : 4 F = 4 X c c − 4 p p − 4 q q … ( 11 ) {\displaystyle (10)*4:\ 4F=4Xcc-4pp-4qq\ \dots \ (11)}

In  ( 11 ) {\displaystyle (11)} replace  4 p p , 4 q q : 4 F = 4 X c c − ( D − 2 X a c ) ( D − 2 X a c ) − ( E − 2 X b c ) ( E − 2 X b c ) … ( 12 ) {\displaystyle 4pp,4qq:\ 4F=4Xcc-(D-2Xac)(D-2Xac)-(E-2Xbc)(E-2Xbc)\ \dots \ (12)}

Expand  ( 12 ) , {\displaystyle (12),} simplify, gather like terms and result is quadratic function in  c : {\displaystyle c:}

( a _ ) c 2 + ( b _ ) c + ( c _ ) = 0 … ( 14 ) {\displaystyle (a\\_)c^{2}+(b\\_)c+(c\\_)=0\ \dots \ (14)} where:

a _ = 4 X ( 1 − X a a − X b b ) {\displaystyle a\\_=4X(1-Xaa-Xbb)}

a a + b b = 1 , {\displaystyle aa+bb=1,} Therefore:

a _ = 4 X ( 1 − X ) {\displaystyle a\\_=4X(1-X)}

b _ = 4 X ( D a + E b ) {\displaystyle b\\_=4X(Da+Eb)}

c _ = − ( D 2 + E 2 + 4 F ) {\displaystyle c\\_=-(D^{2}+E^{2}+4F)}

For parabola, there is one value of  c {\displaystyle c} because there is one directrix.

For ellipse and hyperbola, there are two values of  c {\displaystyle c} because there are two directrices.

#### Implementation

[edit | edit source]

# python code

def compare_ABCDEF1_ABCDEF2 (ABCDEF1, ABCDEF2) :
'''
status = compare_ABCDEF1_ABCDEF2 (ABCDEF1, ABCDEF2)

This function compares the two conic sections.
"0.75x^2 + y^2 + 3 = 0" and "3x^2 + 4y^2 + 12 = 0" compare as equal.
"0.75x^2 + y^2 + 3 = 0" and "3x^2 + 4y^2 + 10 = 0" compare as not equal.

(0.24304)x^2 + (1.49296)y^2 + (-4.28544)xy + (159.3152)x + (-85.1136)y + (2858.944) = 0
and
(-0.0784)x^2 + (-0.4816)y^2 + (1.3824)xy + (-51.392)x + (27.456)y + (-922.24) = 0
are verified as the same curve.

>>> abcdef1 = (0.24304, 1.49296, -4.28544, 159.3152, -85.1136, 2858.944)
>>> abcdef2 = (-0.0784, -0.4816, 1.3824, -51.392, 27.456, -922.24)
>>> [ (v[0]/v[1]) for v in zip(abcdef1, abcdef2) ]
[-3.1, -3.1, -3.1, -3.1, -3.1, -3.1]
set ([-3.1, -3.1, -3.1, -3.1, -3.1, -3.1]) = {-3.1}
'''
thisName = 'compare_ABCDEF1_ABCDEF2 (ABCDEF1, ABCDEF2) :'

# For each value in ABCDEF1, ABCDEF2, both value1 and value2 must be 0
# or both value1 and value2 must be non-zero.
for v1,v2 in zip (ABCDEF1, ABCDEF2) :
status = (bool(v1) == bool(v2))
if not status :
print (thisName)
print ('  mismatch:',v1,v2)
return status

# Results of v1/v2 must all be the same.
set1 = { (v1/v2) for (v1,v2) in zip (ABCDEF1, ABCDEF2) if v2 }
status = (len(set1) == 1)
if status : quotient, = list(set1)
else : quotient = '??'

L1 = [] ; L2 = [] ; L3 = []

for m in range (0,6) :
bottom = ABCDEF2[m]
if not bottom : continue
top = ABCDEF1[m]
L1 += [ str(top) ] ; L3 += [ str(bottom) ]
for m in range (0,len(L1)) :
L2 += [ (sorted( [ len(v) for v in (L1[m], L3[m]) ] ))[-1] ] # maximum value.
for m in range (0,len(L1)) :
max = L2[m]
L1[m] = ( (' '*max)+L1[m] )[-max:] # string right justified.
L2[m] = ( '-'*max )
L3[m] = ( (' '*max)+L3[m] )[-max:] # string right justified.
print ('   ', '   '.join(L1))
print ('   ', ' = '.join(L2), '=', quotient)
print ('   ', '   '.join(L3))
return status

def calculate_abc_epq (ABCDEF_, flag = 0) :
'''
result = calculate_abc_epq (ABCDEF_ [, flag])
For parabola, result is:
[((a,b,c), (e,p,q))]
For ellipse or hyperbola, result is:
[((a1,b1,c1), (e,p1,q1)), ((a2,b2,c2), (e,p2,q2))]
'''

thisName = 'calculate_abc_epq (ABCDEF, {}) :'.format(bool(flag))

ABCDEF = [ dD(str(v)) for v in ABCDEF_ ]
if flag :
v1,v2,v3,v4,v5,v6 = ABCDEF
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'.format(v1,v2,v3,v4,v5,v6)
print('\n' + thisName, 'enter')
print(str1)

result = calculate_Kab (ABCDEF[:3], flag)

output = []
for (K,a,b) in result :
A,B,C,D,E,F = [ reduce_Decimal_number(K*v) for v in ABCDEF ]

X = A + B + 2
e = X.sqrt()
# Quadratic function in c: (a_)c**2 + (b_)c + (c_) = 0
# Directrix has equation: ax + by + c = 0.
a_ = 4*X*( 1 - X  )
b_ = 4*X*( D*a + E*b )
c_ = -D*D - E*E - 4*F

values_of_c = solve_quadratic((a_,b_,c_))
# values_of_c may be empty in which case this value of K is not used.

for c in values_of_c :
p = (D - 2*X*a*c)/2
q = (E - 2*X*b*c)/2
abc = [ reduce_Decimal_number(v) for v in (a,b,c) ]
epq = [ reduce_Decimal_number(v) for v in (e,p,q) ]
output += [ (abc,epq) ]
if flag :
print (thisName)
str1 = '  ({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'.format(A,B,C,D,E,F)
print (str1)
if values_of_c : str1 = '  K = {}. values_of_c = {}'.format(K, values_of_c)
else : str1 = '  K = {}. values_of_c = {}'.format(K, 'EMPTY')
print (str1)
if len(output) not in (1,2) :
# This should be impossible.
print (thisName)
print ('  Internal error: len(output) =', len(output))
1/0

if flag :
# Check output and print results.

L1 = []
for ((a,b,c),(e,p,q)) in output :
print ('  e =',e)
print ('    directrix: ({})x + ({})y + ({}) = 0'.format(a,b,c) )
print ('    for focus : p, q = {}, {}'.format(p,q))
# A small circle at focus for grapher.
print ('    (x - ({}))^2 + (y - ({}))^2 = 1'.format(p,q))

# normal through focus :
a_,b_ = b,-a
# normal through focus : a_ x + b_ y + c_ = 0
c_ = reduce_Decimal_number(-(a_*p + b_*q))
print ('    normal through focus: ({})x + ({})y + ({}) = 0'.format(a_,b_,c_) )
L1 += [ (a_,b_,c_) ]

_ABCDEF = ABCDEF_from_abc_epq ((a,b,c),(e,p,q))
# This line checks that values _ABCDEF, ABCDEF make sense when compared against each other.
if not compare_ABCDEF1_ABCDEF2 (_ABCDEF, ABCDEF) :
print ('    _ABCDEF =',_ABCDEF)
print ('    ABCDEF =',ABCDEF)
2/0
# This piece of code checks that normal through one focus is same as normal through other focus.
# Both of these normals, if there are 2, should be same line.
# It also checks that 2 directrices, if there are 2, are parallel.
set2 = set(L1)
if len(set2) != 1 :
print ('    set2 =',set2)
3/0

return output

### Examples

[edit | edit source]

#### Parabola

[edit | edit source]

Graph of parabola  16 x 2 + 9 y 2 − 24 x y + 410 x − 420 y + 3175 = 0. {\displaystyle 16x^{2}+9y^{2}-24xy+410x-420y+3175=0.}
Equation of parabola is given.
This section calculates  eccentricity, focus, directrix. {\displaystyle {\text{eccentricity, focus, directrix.}}}

Given equation of conic section:  16 x 2 + 9 y 2 − 24 x y + 410 x − 420 y + 3175 = 0. {\displaystyle 16x^{2}+9y^{2}-24xy+410x-420y+3175=0.}

Calculate  eccentricity, focus, directrix. {\displaystyle {\text{eccentricity, focus, directrix.}}}

# python code

input = ( 16, 9, -24, 410, -420, 3175 )

(abc,epq), = calculate_abc_epq  (input)

s1 = 'abc' ; print (s1, eval(s1))
s1 = 'epq' ; print (s1, eval(s1))

abc [Decimal('0.6'), Decimal('0.8'), Decimal('3')]
epq [Decimal('1'), Decimal('-10'), Decimal('6')]

interpreted as:

Directrix:  0.6 x + 0.8 y + 3 = 0 {\displaystyle 0.6x+0.8y+3=0}

Eccentricity:  e = 1 {\displaystyle e=1}

Focus:  p , q = − 10 , 6 {\displaystyle p,q=-10,6}

Because eccentricity is  1 , {\displaystyle 1,} curve is parabola.

Because curve is parabola, there is one directrix and one focus.

For more insight into the method of calculation and also to check the calculation:

calculate_abc_epq  (input, 1) # Set flag to 1.

calculate_abc_epq (ABCDEF, True) : enter
(16)x^2 + (9)y^2 + (-24)xy + (410)x + (-420)y + (3175) = 0 # This equation of parabola is not in standard form.
calculate_Kab (ABC, True) :
A_,B_,C_ (Decimal('16'), Decimal('9'), Decimal('-24'))
a_,b_,c_ (Decimal('0'), Decimal('100'), 4)
y = (0.0)x^2 + (100.0)x + (4.0)
values_of_K [Decimal('-0.04')]
K = -0.04
A -0.64
B -0.36
C 0.96
X 1.00
aa 0.36
calculate_Kab (ABC, True) :
output[0] = [Decimal('-0.04'), Decimal('0.6'), Decimal('0.8')]
calculate_abc_epq (ABCDEF, True) :
(-0.64)x^2 + (-0.36)y^2 + (0.96)xy + (-16.4)x + (16.8)y + (-127) = 0 # This is equation of parabola in standard form.
K = -0.04. values_of_c = [Decimal('3')]
e = 1
directrix: (0.6)x + (0.8)y + (3) = 0
for focus : p, q = -10, 6
(x - (-10))^2 + (y - (6))^2 = 1
normal through focus: (0.8)x + (-0.6)y + (11.6) = 0
# This is proof that equation supplied and equation in standard form are same curve.
-0.64   -0.36   0.96   -16.4   16.8   -127

-- = 
-- = 
- = 
-- = 
- = 
- = -0.04 # K
16       9    -24     410   -420   3175

#### Ellipse

[edit | edit source]

Graph of ellipse  481 x 2 + 369 y 2 − 384 x y + 5190 x + 5670 y + 7650 = 0. {\displaystyle 481x^{2}+369y^{2}-384xy+5190x+5670y+7650=0.}
Equation of ellipse is given.
This section calculates  eccentricity, foci, directrices. {\displaystyle {\text{eccentricity, foci, directrices.}}}

Given equation of conic section:  481 x 2 + 369 y 2 − 384 x y + 5190 x + 5670 y + 7650 = 0. {\displaystyle 481x^{2}+369y^{2}-384xy+5190x+5670y+7650=0.}

Calculate  eccentricity, foci, directrices. {\displaystyle {\text{eccentricity, foci, directrices.}}}

# python code

input = ( 481, 369, -384, 5190, 5670, 7650 )

(abc1,epq1),(abc2,epq2) = calculate_abc_epq  (input)

s1 = 'abc1' ; print (s1, eval(s1))
s1 = 'epq1' ; print (s1, eval(s1))
s1 = 'abc2' ; print (s1, eval(s1))
s1 = 'epq2' ; print (s1, eval(s1))

abc1 [Decimal('0.6'), Decimal('0.8'), Decimal('-3')]
epq1 [Decimal('0.8'), Decimal('-3'), Decimal('-3')]
abc2 [Decimal('0.6'), Decimal('0.8'), Decimal('37')]
epq2 [Decimal('0.8'), Decimal('-18.36'), Decimal('-23.48')]

interpreted as:

Directrix 1:  0.6 x + 0.8 y − 3 = 0 {\displaystyle 0.6x+0.8y-3=0}

Eccentricity:  e = 0.8 {\displaystyle e=0.8}

Focus 1:  p , q = − 3 , − 3 {\displaystyle p,q=-3,-3}

Directrix 2:  0.6 x + 0.8 y + 37 = 0 {\displaystyle 0.6x+0.8y+37=0}

Eccentricity:  e = 0.8 {\displaystyle e=0.8}

Focus 2:  p , q = − 18.36 , − 23.48 {\displaystyle p,q=-18.36,-23.48}

Because eccentricity is  0.8 , {\displaystyle 0.8,} curve is ellipse.

Because curve is ellipse, there are two directrices and two foci.

For more insight into the method of calculation and also to check the calculation:

calculate_abc_epq  (input, 1) # Set flag to 1.

calculate_abc_epq (ABCDEF, True) : enter
(481)x^2 + (369)y^2 + (-384)xy + (5190)x + (5670)y + (7650) = 0 # Not in standard form.
calculate_Kab (ABC, True) :
A_,B_,C_ (Decimal('481'), Decimal('369'), Decimal('-384'))
a_,b_,c_ (Decimal('562500'), Decimal('3400'), 4)
y = (562500.0)x^2 + (3400.0)x + (4.0)
values_of_K [Decimal('-0.004444444444444444444444'), Decimal('-0.0016')]
# Unwanted value of K is rejected here.
K = -0.004444444444444444444444, X = -1.777777777777777777778, continuing.
K = -0.0016
A -0.7696
B -0.5904
C 0.6144
X 0.6400
aa 0.36
calculate_Kab (ABC, True) :
output[0] = [Decimal('-0.0016'), Decimal('0.6'), Decimal('0.8')]
calculate_abc_epq (ABCDEF, True) :
# Equation of ellipse in standard form.
(-0.7696)x^2 + (-0.5904)y^2 + (0.6144)xy + (-8.304)x + (-9.072)y + (-12.24) = 0
K = -0.0016. values_of_c = [Decimal('-3'), Decimal('37')]
e = 0.8
directrix: (0.6)x + (0.8)y + (-3) = 0
for focus : p, q = -3, -3
(x - (-3))^2 + (y - (-3))^2 = 1
normal through focus: (0.8)x + (-0.6)y + (0.6) = 0
# Method calculates equation of ellipse using these values of directrix, eccentricity and focus.
# Method then verifies that calculated and supplied values are the same curve.
-0.7696   -0.5904   0.6144   -8.304   -9.072   -12.24

- = 

- = 

 = 

 = 

 = 

 = -0.0016 # K
481       369     -384     5190     5670     7650
e = 0.8
directrix: (0.6)x + (0.8)y + (37) = 0
for focus : p, q = -18.36, -23.48
(x - (-18.36))^2 + (y - (-23.48))^2 = 1
normal through focus: (0.8)x + (-0.6)y + (0.6) = 0 # Same as normal above.
# Method calculates equation of ellipse using these values of directrix, eccentricity and focus.
# Method then verifies that calculated and supplied values are the same curve.
-0.7696   -0.5904   0.6144   -8.304   -9.072   -12.24

- = 

- = 

 = 

 = 

 = 

 = -0.0016 # K
481       369     -384     5190     5670     7650

#### Hyperbola

[edit | edit source]

Graph of hyperbola  7 x 2 + 0 y 2 − 24 x y + 90 x + 216 y − 81 = 0. {\displaystyle 7x^{2}+0y^{2}-24xy+90x+216y-81=0.}
Equation of hyperbola is given.
This section calculates  eccentricity, foci, directrices. {\displaystyle {\text{eccentricity, foci, directrices.}}}

Given equation of conic section:  7 x 2 + 0 y 2 − 24 x y + 90 x + 216 y − 81 = 0. {\displaystyle 7x^{2}+0y^{2}-24xy+90x+216y-81=0.}

Calculate  eccentricity, foci, directrices. {\displaystyle {\text{eccentricity, foci, directrices.}}}

# python code

input = ( 7, 0, -24, 90, 216, -81 )

(abc1,epq1),(abc2,epq2) = calculate_abc_epq  (input)

s1 = 'abc1' ; print (s1, eval(s1))
s1 = 'epq1' ; print (s1, eval(s1))
s1 = 'abc2' ; print (s1, eval(s1))
s1 = 'epq2' ; print (s1, eval(s1))

abc1 [Decimal('0.6'), Decimal('0.8'), Decimal('-3')]
epq1 [Decimal('1.25'), Decimal('0'), Decimal('-3')]
abc2 [Decimal('0.6'), Decimal('0.8'), Decimal('-22.2')]
epq2 [Decimal('1.25'), Decimal('18'), Decimal('21')]

interpreted as:

Directrix 1:  0.6 x + 0.8 y − 3 = 0 {\displaystyle 0.6x+0.8y-3=0}

Eccentricity:  e = 1.25 {\displaystyle e=1.25}

Focus 1:  p , q = 0 , − 3 {\displaystyle p,q=0,-3}

Directrix 2:  0.6 x + 0.8 y − 22.2 = 0 {\displaystyle 0.6x+0.8y-22.2=0}

Eccentricity:  e = 1.25 {\displaystyle e=1.25}

Focus 2:  p , q = 18 , 21 {\displaystyle p,q=18,21}

Because eccentricity is  1.25 , {\displaystyle 1.25,} curve is hyperbola.

Because curve is hyperbola, there are two directrices and two foci.

For more insight into the method of calculation and also to check the calculation:

calculate_abc_epq  (input, 1) # Set flag to 1.

calculate_abc_epq (ABCDEF, True) : enter
# Given equation is not in standard form.
(7)x^2 + (0)y^2 + (-24)xy + (90)x + (216)y + (-81) = 0
calculate_Kab (ABC, True) :
A_,B_,C_ (Decimal('7'), Decimal('0'), Decimal('-24'))
a_,b_,c_ (Decimal('-576'), Decimal('28'), 4)
y = (-576.0)x^2 + (28.0)x + (4.0)
values_of_K [Decimal('0.1111111111111111111111'), Decimal('-0.0625')]
K = 0.1111111111111111111111
A 0.7777777777777777777777
B 0
C -2.666666666666666666666
X 2.777777777777777777778
aa 0.64
K = -0.0625
A -0.4375
B 0
C 1.5
X 1.5625
aa 0.36
calculate_Kab (ABC, True) :
output[0] = [Decimal('0.1111111111111111111111'), Decimal('0.8'), Decimal('-0.6')]
output[1] = [Decimal('-0.0625'), Decimal('0.6'), Decimal('0.8')]
calculate_abc_epq (ABCDEF, True) :
# Here is where unwanted value of K is rejected.
(0.7777777777777777777777)x^2 + (0)y^2 + (-2.666666666666666666666)xy + (10)x + (24)y + (-9) = 0
K = 0.1111111111111111111111. values_of_c = EMPTY
calculate_abc_epq (ABCDEF, True) :
# Equation of hyperbola in standard form.
(-0.4375)x^2 + (0)y^2 + (1.5)xy + (-5.625)x + (-13.5)y + (5.0625) = 0
K = -0.0625. values_of_c = [Decimal('-3'), Decimal('-22.2')]
e = 1.25
directrix: (0.6)x + (0.8)y + (-3) = 0
for focus : p, q = 0, -3
(x - (0))^2 + (y - (-3))^2 = 1
normal through focus: (0.8)x + (-0.6)y + (-1.8) = 0
# Method calculates equation of hyperbola using these values of directrix, eccentricity and focus.
# Method then verifies that calculated and given values are the same curve.
-0.4375   1.5   -5.625   -13.5   5.0625

- = 
 = 

 = 
-- = 

 = -0.0625 # K
7   -24       90     216      -81
e = 1.25
directrix: (0.6)x + (0.8)y + (-22.2) = 0
for focus : p, q = 18, 21
(x - (18))^2 + (y - (21))^2 = 1
normal through focus: (0.8)x + (-0.6)y + (-1.8) = 0 # Same as normal above.
# Method calculates equation of hyperbola using these values of directrix, eccentricity and focus.
# Method then verifies that calculated and given values are the same curve.
-0.4375   1.5   -5.625   -13.5   5.0625

- = 
 = 

 = 
-- = 

 = -0.0625 # K
7   -24       90     216      -81

## Slope of curve

[edit | edit source]

Given equation of conic section:  A x 2 + B y 2 + C x y + D x + E y + F = 0 , {\displaystyle Ax^{2}+By^{2}+Cxy+Dx+Ey+F=0,}

differentiate both sides with respect to  x . {\displaystyle x.}

2 A x + B ( 2 y y ′ ) + C ( x y ′ + y ) + D + E y ′ = 0 {\displaystyle 2Ax+B(2yy')+C(xy'+y)+D+Ey'=0}

2 A x + 2 B y y ′ + C x y ′ + C y + D + E y ′ = 0 {\displaystyle 2Ax+2Byy'+Cxy'+Cy+D+Ey'=0}

2 B y y ′ + C x y ′ + E y ′ + 2 A x + C y + D = 0 {\displaystyle 2Byy'+Cxy'+Ey'+2Ax+Cy+D=0}

y ′ ( 2 B y + C x + E ) = − ( 2 A x + C y + D ) {\displaystyle y'(2By+Cx+E)=-(2Ax+Cy+D)}

y ′ = − ( 2 A x + C y + D ) C x + 2 B y + E {\displaystyle y'={\frac {-(2Ax+Cy+D)}{Cx+2By+E}}}

For slope horizontal:  2 A x + C y + D = 0. {\displaystyle 2Ax+Cy+D=0.}

For slope vertical:  C x + 2 B y + E = 0. {\displaystyle Cx+2By+E=0.}

For given slope  m = − ( 2 A x + C y + D ) C x + 2 B y + E {\displaystyle m={\frac {-(2Ax+Cy+D)}{Cx+2By+E}}}

m ( C x + 2 B y + E ) = − 2 A x − C y − D {\displaystyle m(Cx+2By+E)=-2Ax-Cy-D}

m C x + 2 A x + m 2 B y + C y + m E + D = 0 {\displaystyle mCx+2Ax+m2By+Cy+mE+D=0}

( m C + 2 A ) x + ( m 2 B + C ) y + ( m E + D ) = 0. {\displaystyle (mC+2A)x+(m2B+C)y+(mE+D)=0.}

### Implementation

[edit | edit source]

# python code

def three_slopes (ABCDEF, slope, flag = 0) :
'''
equation1, equation2, equation3 = three_slopes (ABCDEF, slope[, flag])
equation1 is equation for slope horizontal.
equation2 is equation for slope vertical.
equation3 is equation for slope supplied.
All equations are in format (a,b,c) where ax + by + c = 0.
'''
A,B,C,D,E,F = ABCDEF
output = []

abc = 2*A, C, D ; output += [ abc ]
abc = C, 2*B, E ; output += [ abc ]

m = slope
# m(Cx + 2By + E) = -2Ax - Cy - D
# mCx + m2By + mE = -2Ax - Cy - D
# mCx + 2Ax + m2By + Cy + mE + D = 0
abc = m*C + 2*A, m*2*B + C, m*E + D ; output += [ abc ]

if flag :
str1 = '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'.format (A,B,C,D,E,F)
print (str1)
a,b,c = output[0]
str1 = 'For slope horizontal: ({})x + ({})y + ({}) = 0'.format (a,b,c)
print (str1)
a,b,c = output[1]
str1 = 'For slope vertical: ({})x + ({})y + ({}) = 0'.format (a,b,c)
print (str1)
a,b,c = output[2]
str1 = 'For slope {}: ({})x + ({})y + ({}) = 0'.format (slope, a,b,c)
print (str1)

return output

### Examples

[edit | edit source]

#### Quadratic function

[edit | edit source]

##### y = f(x)

[edit | edit source]

Graph of quadratic function  y = x 2 − 14 x − 39 4 . {\displaystyle y={\frac {x^{2}-14x-39}{4}}.}
At intersection of  line 1 {\displaystyle {\text{line 1}}} and curve, slope =  0 {\displaystyle 0} .
At intersection of  line 2 {\displaystyle {\text{line 2}}} and curve, slope =  5 {\displaystyle 5} .
Slope of curve is never vertical.

Consider conic section:  ( − 1 ) x 2 + ( 0 ) y 2 + ( 0 ) x y + ( 14 ) x + ( 4 ) y + ( 39 ) = 0. {\displaystyle (-1)x^{2}+(0)y^{2}+(0)xy+(14)x+(4)y+(39)=0.}

This is quadratic function:  y = x 2 − 14 x − 39 4 {\displaystyle y={\frac {x^{2}-14x-39}{4}}}

Slope of this curve:  m = y ′ = 2 x − 14 4 {\displaystyle m=y'={\frac {2x-14}{4}}}

Produce values for slope horizontal, slope vertical and slope  5 : {\displaystyle 5:} {\displaystyle } {\displaystyle } {\displaystyle } {\displaystyle } {\displaystyle }

# python code

ABCDEF = A,B,C,D,E,F = -1,0,0,14,4,39 # quadratic
three_slopes (ABCDEF, 5, 1)

(-1)x^2 + (0)y^2 + (0)xy + (14)x + (4)y + (39) = 0
For slope horizontal: (-2)x + (0)y + (14) = 0  # x = 7
For slope vertical: (0)x + (0)y + (4) = 0      # This does not make sense.
# Slope is never vertical.
For slope 5: (-2)x + (0)y + (34) = 0           # x = 17.

Check results:

# python code

for x in (7,17) :
m = (2*x - 14)/4
s1 = 'x,m' ; print (s1, eval(s1))

x,m (7, 0.0)   # When x = 7, slope = 0.
x,m (17, 5.0)  # When x = 17, slope = 5.

##### x = f(y)

[edit | edit source]

Graph of quadratic function  x = − ( y 2 + 14 y + 5 ) 4 . {\displaystyle x={\frac {-(y^{2}+14y+5)}{4}}.}
At intersection of  line 1 {\displaystyle {\text{line 1}}} and curve, slope is vertical.
At intersection of  line 2 {\displaystyle {\text{line 2}}} and curve, slope =  0.5 {\displaystyle 0.5} .
Slope of curve is never horizontal.

Consider conic section:  ( 0 ) x 2 + ( − 1 ) y 2 + ( 0 ) x y + ( − 4 ) x + ( − 14 ) y + ( − 5 ) = 0. {\displaystyle (0)x^{2}+(-1)y^{2}+(0)xy+(-4)x+(-14)y+(-5)=0.}

This is quadratic function:  x = − ( y 2 + 14 y + 5 ) 4 {\displaystyle x={\frac {-(y^{2}+14y+5)}{4}}}

Slope of this curve:  d x d y = − 2 y − 14 4 {\displaystyle {\frac {dx}{dy}}={\frac {-2y-14}{4}}}

m = y ′ = d y d x = − 4 2 y + 14 {\displaystyle m=y'={\frac {dy}{dx}}={\frac {-4}{2y+14}}}

Produce values for slope horizontal, slope vertical and slope  0.5 : {\displaystyle 0.5:} {\displaystyle } {\displaystyle } {\displaystyle } {\displaystyle } {\displaystyle }

# python code

ABCDEF = A,B,C,D,E,F = 0,-1,0,-4,-14,-5 # quadratic x = f(y)
three_slopes (ABCDEF, 0.5, 1)

(0)x^2 + (-1)y^2 + (0)xy + (-4)x + (-14)y + (-5) = 0
For slope horizontal: (0)x + (0)y + (-4) = 0    # This does not make sense.
# Slope is never horizontal.
For slope vertical: (0)x + (-2)y + (-14) = 0    # y = -7
For slope 0.5: (0.0)x + (-1.0)y + (-11.0) = 0   # y = -11

Check results:

# python code

for y in (-7,-11) :
top = -4 ; bottom = 2*y + 14
if bottom == 0 :
print ('y,m',y,'{}/{}'.format(top,bottom))
continue
m = top/bottom
s1 = 'y,m' ; print (s1, eval(s1))

y,m -7 -4/0     # When y = -7, slope is vertical.
y,m (-11, 0.5)  # When y = -11, slope is 0.5.

#### Parabola

[edit | edit source]

Graph of parabola  ( 9 ) x 2 + ( 16 ) y 2 + ( − 24 ) x y + ( 104 ) x + ( 28 ) y + ( − 144 ) = 0. {\displaystyle (9)x^{2}+(16)y^{2}+(-24)xy+(104)x+(28)y+(-144)=0.}
At intersection of  Line 1 {\displaystyle {\text{Line 1}}} and curve, slope is horizontal.
At intersection of  Line 2 {\displaystyle {\text{Line 2}}} and curve, slope is vertical.
At intersection of  Line 3 {\displaystyle {\text{Line 3}}} and curve, slope =  2 {\displaystyle 2} .
Slope of curve is never  0.75 {\displaystyle 0.75} because axis has slope  0.75 {\displaystyle 0.75} and curve is never parallel to axis.

Consider conic section:  ( 9 ) x 2 + ( 16 ) y 2 + ( − 24 ) x y + ( 104 ) x + ( 28 ) y + ( − 144 ) = 0. {\displaystyle (9)x^{2}+(16)y^{2}+(-24)xy+(104)x+(28)y+(-144)=0.}

This curve is a parabola.

Produce values for slope horizontal, slope vertical and slope  2 : {\displaystyle 2:}

# python code

ABCDEF = A,B,C,D,E,F = 9,16,-24,104,28,-144 # parabola
three_slopes (ABCDEF, 2, 1)

(9)x^2 + (16)y^2 + (-24)xy + (104)x + (28)y + (-144) = 0
For slope horizontal: (18)x + (-24)y + (104) = 0
For slope vertical: (-24)x + (32)y + (28) = 0
For slope 2: (-30)x + (40)y + (160) = 0

Because all 3 lines are parallel to axis, all 3 lines have slope  3 4 . {\displaystyle {\frac {3}{4}}.}

Produce values for slope horizontal, slope vertical and slope  0.75 : {\displaystyle 0.75:}

# python code

three_slopes (ABCDEF, 0.75, 1)

(9)x^2 + (16)y^2 + (-24)xy + (104)x + (28)y + (-144) = 0
For slope horizontal: (18)x + (-24)y + (104) = 0 # Same as above.
For slope vertical: (-24)x + (32)y + (28) = 0    # Same as above.
For slope 0.75: (0.0)x + (0.0)y + (125.0) = 0    # Impossible.

Axis has slope  0.75 {\displaystyle 0.75} and curve is never parallel to axis.

#### Ellipse

[edit | edit source]

Graph of ellipse  ( 1771 ) x 2 + ( 1204 ) y 2 + ( 1944 ) x y + ( − 44860 ) x + ( − 18520 ) y + ( 214400 ) = 0. {\displaystyle (1771)x^{2}+(1204)y^{2}+(1944)xy+(-44860)x+(-18520)y+(214400)=0.}
At intersection of  Line 1 {\displaystyle {\text{Line 1}}} and curve, slope is horizontal.
At intersection of  Line 2 {\displaystyle {\text{Line 2}}} and curve, slope is vertical.
At intersection of  Line 3 {\displaystyle {\text{Line 3}}} and curve, slope =  − 1. {\displaystyle -1.}

Consider conic section:  ( 1771 ) x 2 + ( 1204 ) y 2 + ( 1944 ) x y + ( − 44860 ) x + ( − 18520 ) y + ( 214400 ) = 0. {\displaystyle (1771)x^{2}+(1204)y^{2}+(1944)xy+(-44860)x+(-18520)y+(214400)=0.}

This curve is an ellipse.

Produce values for slope horizontal, slope vertical and slope  − 1 : {\displaystyle -1:}

# python code

ABCDEF = A,B,C,D,E,F = 1771, 1204, 1944, -44860, -18520, 214400 # ellipse
three_slopes (ABCDEF, -1, 1)

(1771)x^2 + (1204)y^2 + (1944)xy + (-44860)x + (-18520)y + (214400) = 0
For slope horizontal: (3542)x + (1944)y + (-44860) = 0
For slope vertical: (1944)x + (2408)y + (-18520) = 0
For slope -1: (1598)x + (-464)y + (-26340) = 0

Because curve is closed loop, slope of curve may be any value including  1 0 . {\displaystyle {\frac {1}{0}}.}

If slope of curve is given as  1 0 , {\displaystyle {\frac {1}{0}},} it means that curve is vertical at that point and tangent to curve has equation  x = k . {\displaystyle x=k.}

For any given slope there are always 2 points on opposite sides of curve where tangent to curve at each of those points has the given slope.

#### Hyperbola

[edit | edit source]

Graph of hyperbola  ( − 351 ) x 2 + ( 176 ) y 2 + ( − 336 ) x y + ( 4182 ) x + ( − 3824 ) y + ( − 16231 ) = 0. {\displaystyle (-351)x^{2}+(176)y^{2}+(-336)xy+(4182)x+(-3824)y+(-16231)=0.}
At intersection of  Line 1 {\displaystyle {\text{Line 1}}} and curve, slope is horizontal.
Line 2 {\displaystyle {\text{Line 2}}} and curve do not intersect. Slope is never vertical.
At intersection of  Line 3 {\displaystyle {\text{Line 3}}} and curve, slope =  2. {\displaystyle 2.}

Consider conic section:  ( − 351 ) x 2 + ( 176 ) y 2 + ( − 336 ) x y + ( 4182 ) x + ( − 3824 ) y + ( − 16231 ) = 0. {\displaystyle (-351)x^{2}+(176)y^{2}+(-336)xy+(4182)x+(-3824)y+(-16231)=0.}

This curve is a hyperbola.

Produce values for slope horizontal, slope vertical and slope  2 : {\displaystyle 2:}

# python code

ABCDEF = A,B,C,D,E,F = -351, 176, -336, 4182, -3824, -16231 # hyperbola
three_slopes (ABCDEF, 2, 1)

(-351)x^2 + (176)y^2 + (-336)xy + (4182)x + (-3824)y + (-16231) = 0
For slope horizontal: (-702)x + (-336)y + (4182) = 0
For slope vertical: (-336)x + (352)y + (-3824) = 0
For slope 2: (-1374)x + (368)y + (-3466) = 0

## Latera recta et cetera

[edit | edit source]

"Latus rectum" is a Latin expression meaning "straight side." According to Google, the Latin plural of "latus rectum" is "latera recta," but English allows "latus rectums" or possibly "lati rectums." The title of this section is poetry to the eyes and music to the ears of a Latin student and this author hopes that the gentle reader will permit such poetic licence in a mathematical topic.

The translation of the title is "Latus rectums and other things." This section describes the calculation of interesting items associated with the ellipse: latus rectums, major axis, minor axis, focal chords, directrices and various points on these lines.

When given the equation of an ellipse, the first thing is to calculate eccentricity, foci and directrices as shown above. Then verify that the curve is in fact an ellipse.

From these values everything about the ellipse may be calculated. For example:

Graph of ellipse  1771 x 2 + 1204 y 2 + 1944 x y − 44860 x − 18520 y + 214400 = 0. {\displaystyle 1771x^{2}+1204y^{2}+1944xy-44860x-18520y+214400=0.}

Axis : (-0.8)x + (-0.6)y + (9.4) = 0
Eccentricity = 0.9

Directrix 2 : (0.6)x + (-0.8)y + (2) = 0
Latus rectum RS : (0.6)x + (-0.8)y + (-0.8) = 0
Minor axis : (0.6)x + (-0.8)y + (-12.73684210526315789474) = 0
Latus rectum PU : (0.6)x + (-0.8)y + (-24.67368421052631578947) = 0
Directrix 1 : (0.6)x + (-0.8)y + (-27.47368421052631578947) = 0

ID2 {\displaystyle {\text{ID2}}} = (6.32, 7.24)
I2 {\displaystyle {\text{I2}}} = (7.204210526315789473684, 6.061052631578947368421)
F2 = (8, 5)
M = (15.16210526315789473684, -4.54947368421052631579)
F1 = (22.32421052631578947368, -14.09894736842105263158)
I1 {\displaystyle {\text{I1}}} = (23.12, -15.16)
ID1 {\displaystyle {\text{ID1}}} = (24.00421052631578947368, -16.33894736842105263158)

P = (20.30821052631578947368, -15.61094736842105263158)
Q = (10.53708406832736953616, -8.018239580333420216299)
R = (5.984, 3.488)
S = (10.016, 6.512)
T = (19.78712645798841993752, -1.080707788087632415281)
U = (24.34021052631578947368, -12.58694736842105263158)

Distance between directrices:  ID1ID2 {\displaystyle {\text{ID1ID2}}} = 29.47368421052631578947
Length of major axis:  I1I2 {\displaystyle {\text{I1I2}}} = 26.52631578947368421052
Distance between foci:  F1F2 {\displaystyle {\text{F1F2}}} = 23.87368421052631578947
Length of minor axis: QT = 11.56255298707631300170
Length of latus rectum: RS = PU = 5.04

Consider conic section:  1771 x 2 + 1204 y 2 + 1944 x y − 44860 x − 18520 y + 214400 = 0. {\displaystyle 1771x^{2}+1204y^{2}+1944xy-44860x-18520y+214400=0.}

This curve is ellipse with random orientation.

# python code

ABCDEF = A,B,C,D,E,F = 1771, 1204, 1944, -44860, -18520, 214400 # ellipse

result = calculate_abc_epq(ABCDEF)
(len(result) == 2) or 1/0

# ellipse or hyperbola
(abc1,epq1), (abc2,epq2) = result
a1,b1,c1 = abc1 ; e1,p1,q1 = epq1
a2,b2,c2 = abc2 ; e2,p2,q2 = epq2
(e1 == e2) or 2/0
(1 > e1 > 0) or 3/0

print ( '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'.format(A,B,C,D,E,F) )
A,B,C,D,E,F = ABCDEF_from_abc_epq(abc1,epq1)
print ('Equation of ellipse in standard form:')
print ( '({})x^2 + ({})y^2 + ({})xy + ({})x + ({})y + ({}) = 0'.format(A,B,C,D,E,F) )

(1771)x^2 + (1204)y^2 + (1944)xy + (-44860)x + (-18520)y + (214400) = 0
Equation of ellipse in standard form:
(-0.7084)x^2 + (-0.4816)y^2 + (-0.7776)xy + (17.944)x + (7.408)y + (-85.76) = 0

# python code
def sum_zero(input) :
'''
sum = sum_zero(input)
If sum is close to 0 and Tolerance permits, sum is returned as 0.
For example: if input contains (2, -1.999999999999999999999)
this function returns sum of these 2 values as 0.
'''
global Tolerance
sump = sumn = 0
for v in input :
if v > 0 : sump += v
elif v < 0 : sumn -= v
sum = sump - sumn
if abs(sum) < Tolerance : return (type(Tolerance))(0)
min, max = sorted((sumn,sump))
if abs(sum) <= Tolerance*min : return (type(Tolerance))(0)
return sum

### Major axis

[edit | edit source]

# axis is perpendicular to directrix.
ax,bx = b1,-a1
# axis contains foci. ax + by + c = 0
cx = reduce_Decimal_number(-(ax*p1 + bx*q1))
axis = ax,bx,cx
print ( '    Axis : ({})x + ({})y + ({}) = 0'.format(ax,bx,cx) )
print ( '    Eccentricity = {}'.format(e1) )
print ()
print ( '    Directrix 1 : ({})x + ({})y + ({}) = 0'.format(a1,b1,c1) )
print ( '    Directrix 2 : ({})x + ({})y + ({}) = 0'.format(a2,b2,c2) )
print ( '    Distance between directrices = {}'.format(abs(c1-c2)) )
F1 = p1,q1 # Focus 1.
print ( '    F1 : ({}, {})'.format(p1,q1) )
F2 = p2,q2 # Focus 2.
print ( '    F2 : ({}, {})'.format(p2,q2) )

#  Direction cosines along axis from F1 towards F2:
dx,dy = a1,b1

# p2 = p1 + dx*distance_F1_F2
# q2 = q1 + dy*distance_F1_F2
if dx : distance_F1_F2 = (p2 - p1)/dx
else :  distance_F1_F2 = (q2 - q1)
if distance_F1_F2 < 0 :
distance_F1_F2 *= -1
dx *= -1 ; dy *= -1
print ( '    Distance between foci = {}'.format(distance_F1_F2) )

# Intercept on directrix1
distance_from_F1_to_ID1 = abs(a1*p1 + b1*q1 + c1)
ID1 = xID1,yID1 = p1 - dx*distance_from_F1_to_ID1, q1 - dy*distance_from_F1_to_ID1
print ( '    Intercept ID1 : ({}, {})'.format(xID1,yID1) )

# distance_F1_F2
# 

-- = e
# length_of_major_axis

length_of_major_axis = distance_F1_F2 / e1

# Intercept1 on curve
distance_from_F1_to_curve = (length_of_major_axis - distance_F1_F2 )/2

xI1,yI1 = p1 - dx*distance_from_F1_to_curve, q1 - dy*distance_from_F1_to_curve
I1 = xI1,yI1 = [ reduce_Decimal_number(v) for v in (xI1,yI1) ]
print ( '    Intercept I1 : ({}, {})'.format(xI1,yI1) )

Axis : (-0.8)x + (-0.6)y + (9.4) = 0
Eccentricity = 0.9

Directrix 1 : (0.6)x + (-0.8)y + (-27.47368421052631578947) = 0
Directrix 2 : (0.6)x + (-0.8)y + (2) = 0
Distance between directrices = 29.47368421052631578947
F1 : (22.32421052631578947368, -14.09894736842105263158)
F2 : (8, 5)
Distance between foci = 23.87368421052631578947
Intercept ID1 : (24.00421052631578947368, -16.33894736842105263158)
Intercept I1 : (23.12, -15.16)

Techniques similar to above can be used to calculate points  I 2 , I D 2. {\displaystyle I2,ID2.}

### Latus rectums

[edit | edit source]

# direction cosines along latus rectum.
dlx,dly = -dy,dx

# distance from U to F1               half_latus_rectum
# 

 = 

-- = e1
# distance from U to directrix 1   distance_from_F1_to_ID1

half_latus_rectum = reduce_Decimal_number(e1*distance_from_F1_to_ID1)
# latus rectum 1
# Focal chord has equation (afc)x + (bfc)y + (cfc) = 0.
afc,bfc = a1,b1
cfc = reduce_Decimal_number(-(afc*p1 + bfc*q1))
print ( '    Focal chord PU : ({})x + ({})y + ({}) = 0'.format(afc,bfc,cfc) )

P = xP,yP = p1 + dlx*half_latus_rectum, q1 + dly*half_latus_rectum
print ( '    Point P : ({}, {})'.format(xP,yP) )
U = xU,yU = p1 - dlx*half_latus_rectum, q1 - dly*half_latus_rectum
print ( '    Point U : ({}, {})'.format(xU,yU) )
distance = reduce_Decimal_number(( (xP - xU)**2 + (yP - yU)**2 ).sqrt())
print ('    Length PU =', distance)
print ('    half_latus_rectum =', half_latus_rectum)

Focal chord PU : (0.6)x + (-0.8)y + (-24.67368421052631578947) = 0
Point P : (20.30821052631578947368, -15.61094736842105263158)
Point U : (24.34021052631578947368, -12.58694736842105263158)
Length PU = 5.04
half_latus_rectum = 2.52

Techniques similar to above can be used to calculate points  R , S . {\displaystyle R,S.}

### Minor axis

[edit | edit source]

print ()

# Mid point between F1, F2:
M = xM,yM = (p1 + p2)/2, (q1 + q2)/2
print ( '    Mid point M : ({}, {})'.format(xM,yM) )
half_major  = length_of_major_axis / 2
half_distance = distance_F1_F2 / 2

# half_distance**2 + half_minor**2 = half_major**2
half_minor = ( half_major**2 - half_distance**2 ).sqrt()
length_of_minor_axis = half_minor * 2

Q = xQ,yQ = xM + dlx*half_minor,  yM + dly*half_minor
T = xT,yT = xM - dlx*half_minor,  yM - dly*half_minor
print ( '    Point Q : ({}, {})'.format(xQ,yQ) )
print ( '    Point T : ({}, {})'.format(xT,yT) )

print ('    length_of_major_axis =', length_of_major_axis)
print ('    length_of_minor_axis =', length_of_minor_axis)

# A basic check.
# length_of_minor_axis**2 = (length_of_major_axis**2)(1-e**2)

# length_of_minor_axis**2
# 

-- = 1-e**2
# length_of_major_axis**2

# length_of_minor_axis**2
# 

-- + (e**2 - 1) = 0
# length_of_major_axis**2

values = (length_of_minor_axis/length_of_major_axis)**2, e1**2 - 1
sum_zero(values) and 3/0

aM,bM = a1,b1 # Minor axis is parallel to directrix.
cM = reduce_Decimal_number(-(aM*xM + bM*yM))
print ( '    Minor axis : ({})x + ({})y + ({}) = 0'.format(aM,bM,cM) )

Mid point M : (15.16210526315789473684, -4.54947368421052631579)
Point Q : (10.53708406832736953616, -8.018239580333420216299)
Point T : (19.78712645798841993752, -1.080707788087632415281)
length_of_major_axis = 26.52631578947368421052
length_of_minor_axis = 11.56255298707631300170
Minor axis : (0.6)x + (-0.8)y + (-12.73684210526315789474) = 0

### Checking

[edit | edit source]

All interesting points have been calculated without using equations of any of the relevant lines.

However, equations of relevant lines are very useful for testing, for example:

* Check that points  I D 2 , I 2 , F 2 , M , F 1 , I 1 , I D 1 {\displaystyle ID2,I2,F2,M,F1,I1,ID1} are on axis.

* Check that points  R , F 2 , S {\displaystyle R,F2,S} are on latus rectum through  F 2. {\displaystyle F2.}

* Check that points  Q , M , T {\displaystyle Q,M,T} are on minor axis through  M . {\displaystyle M.}

* Check that points  P , F 1 , U {\displaystyle P,F1,U} are on latus rectum through  F 1. {\displaystyle F1.}

Test below checks that 8 points  I 1 , I 2 , P , Q , R , S , T , U {\displaystyle I1,I2,P,Q,R,S,T,U} are on ellipse and satisfy eccentricity  e = 0.9. {\displaystyle e=0.9.}

t1 = (
('I1'), ('I2'),
('P'), ('Q'), ('R'),
('S'), ('T'), ('U'),

for name in t1 :
value = eval(name)
x,y = [ reduce_Decimal_number(v) for v in value ]
print ('{} : ({}, {})'.format((name+' ')[:2], x,y))
values = A*x**2, B*y**2, C*x*y, D*x, E*y, F
sum_zero(values) and 3/0

# Relative to Directrix 1 and Focus 1:
distance_to_F1 = ( (x-p1)**2 + (y-q1)**2 ).sqrt()
distance_to_directrix1 = a1*x + b1*y + c1
e1 = distance_to_F1 / distance_to_directrix1
print ('    e1 =',e1) # Raw value is printed.

# Relative to Directrix 2 and Focus 2:
distance_to_F2 = ( (x-p2)**2 + (y-q2)**2 ).sqrt()
distance_to_directrix2 = a2*x + b2*y + c2
e2 = distance_to_F2 / distance_to_directrix2
e2 = reduce_Decimal_number(e2)
print ('    e2 =',e2) # Clean value is printed.

Note the differences between "raw" values of  e 1 {\displaystyle e_{1}} and "clean" values of  e 2 . {\displaystyle e_{2}.}

I1 : (23.12, -15.16)
e1 = -0.9000000000000000000034
e2 = 0.9
I2 : (7.204210526315789473684, 6.061052631578947368421)
e1 = -0.9
e2 = 0.9
P  : (20.30821052631578947368, -15.61094736842105263158)
e1 = -0.9
e2 = 0.9
Q  : (10.53708406832736953616, -8.018239580333420216299)
e1 = -0.9000000000000000000002
e2 = 0.9
R  : (5.984, 3.488)
e1 = -0.9000000000000000000003
e2 = 0.9
S  : (10.016, 6.512)
e1 = -0.9000000000000000000003
e2 = 0.9
T  : (19.78712645798841993752, -1.080707788087632415281)
e1 = -0.8999999999999999999996
e2 = 0.9
U  : (24.34021052631578947368, -12.58694736842105263158)
e1 = -0.9
e2 = 0.9

## Other resources

[edit | edit source]

* Should the contents of this Wikiversity page be merged into the related Wikibooks modules such as b:Conic Sections/Ellipse?

* Ellipse