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]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
- (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(, ) tangents will have the equation:
And normals:
Likewise for the parametric coordinates of P, (a , b ),
Properties of Ellipses
[edit | edit source]S and S' are typically regarded as the two foci of the ellipse. Where , these become (ae, 0) and (-ae, 0) respectively. Where these become (0, be) and (0, -be) respectively.
A point P on the ellipse will move about these two foci ut
Where a > b, which is to say the Ellipse will have a major-axes parallel to the x-axis:
The directrix will be:
Circles
[edit | edit source]A circle is a special type of the ellipse where the foci are the same point.
Hence, the equation becomes:
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:
A point P on will move about the two foci ut
The equations for the tangent and normal to the hyperbola closely resemble that of the ellipse.
From a point P(, ) tangents will have the equation:
And normals:
The directrixes (singular directrix) and foci of hyperbolas are the same as those of ellipses, namely directrixes of and foci of
The asymptotes of a hyperbola lie at
In cartesian geometry in two dimensions hyperbola is locus of a point that moves relative to two fixed points called The distance from one to the other is non-zero. The absolute difference of the distances from point to foci is constant.
|
Equation of hyperbola at origin
[edit | edit source]Transverse axis horizontal
[edit | edit source]
Let point have coordinates
Make appropriate substitutions, expand and result is:
Simplify, gather like terms and recall that, for hyperbola,
Let
Curve in diagram has:
equation or
where
Transverse axis vertical
[edit | edit source]
Let point have coordinates
Let Focus 1, have coordinates
Let Focus 2, have coordinates
Make substitutions as above, expand and result is:
Simplify, gather like terms and recall that, for hyperbola,
Let
Curve in diagram has:
equation or
where
Transverse axis oblique
[edit | edit source]With transverse axis oblique the two foci are defined as:
where both are non-zero.
Distance from center to focus and
Let
Let
By definition:
If you make the substitutions as before, result is:
where:
Curve in diagram has:
- Foci at (24,7), (-24,-7)
- a = 20
- equation
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]
|
Reversing the process
[edit | edit source]The expression "reversing the process" means calculating the values of when given equation of hyperbola at origin, the familiar values
Consider the equation of a hyperbola at origin: This is a hyperbola where
This hyperbola may be expressed as or or where is any real, non-zero number.
However, when this hyperbola is expressed as this format is the hyperbola expressed in "standard form," a notation that greatly simplifies the calculation of
Modify the equations for slightly:
There are four simultaneous equations with four known values and four unknown:
For
For 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 funtion 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]
Hyperbola is path of point that moves so that ratio of distance to fixed point and distance to fixed line is constant.
Therefore, Let directrix have equation where
Statement has been proved for two specific points, vertex and point
|
Proof
[edit | edit source]
As expressed above in statement 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.
base
Therefore: where
Hyperbola is path of point that moves so that ratio of distance to fixed point and distance to fixed line is constant, called eccentricity |
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])
|
Deriving equation
[edit | edit source]To calculate the general equation three values must be known:
- Focus1
- Focus2
- Length of transverse axis or
two_a.
Calculate center of hyperbola
Calculate
Calculate equation of hyperbola at origin
Move hyperbola from origin to point
# 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,
- Focus2,
- Constant,
Curve has equation:
Curve in Figure 2 below is defined by:
- Focus1,
- Focus2,
- Constant,
Curve has equation:
Curve in Figure 3 below is defined by:
- Focus1,
- Focus2,
- Constant,
Curve has equation:
|
Reversing the process
[edit | edit source]The expression "reversing the process" means calculating the values of and length of transverse axis
when given
equation of general hyperbola, the familiar values
Calculate center of hyperbola.
Move hyperbola to origin.
Calculate a,(p,q) of hyperbola at origin.
Calculate and length of transverse axis,
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]
A hyperbola has equation: Calculate two foci and # 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]
We are familiar with values where:
And we have said: Let What is ? Value defines the In diagram, line segment is conjugate axis with length Box at origin with length and width contains two special lines (blue lines) called
Hyperbola has equation Calculate point of intersection of
Substitute for in This does not make sense. There is no real point of intersection of
Calculate point of intersection of
Provided that are non-zero, is a real number.
|
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
Let line have equation:
Let line intersect curve. For substitute
Expand simplify, gather like terms and result is quadratic function in
where:
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 are 0.
- If both are 0, line is asymptote.
These decuctions are included in general case below.
Generally
[edit | edit source]Let the conic section have the familiar equation:
Let a line have equation:
Let intersect the conic section. For in equation of conic section substitute
Expand simplify, gather like terms and result is quadratic function in
___ where:
_
_
_
If line is an asymptote, then _ _ in which case:
___ where:
___
and (roots of ) 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]
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]
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]
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]
|
Family of hyperbolas
[edit | edit source]
Asymptotes of hyperbola are determined by coefficients All hyperbolas in diagram have coefficients Consider the family of hyperbolas that satisfy equation:
Provided that coefficients remain constant, hyperbolas of form are members of a family, all of which share the same asymptotes.
|
Rectangular Hyperbolas
[edit | edit source]Rectangular Hyperbolas are special cases of hyperbolas where the asymptotes are perpendicular. These have the general equation:
A rectangular hyperbola has eccentricity If hyperbola is expressed as then:
|
Details
[edit | edit source]
Diagram 2 shows detail of quadrant 1 of Diagram 1.
|
Examples
[edit | edit source]Rectangular hyperbola at origin
[edit | edit source]
Curve in Figure 1 has equation:
Vertex has coordinates Vertex has coordinates
Focus has coordinates Focus has coordinates
Point has coordinates Point has coordinates Directrix1, directrix through point has equation Directrix2, directrix through point has equation
Asymptote2 has equation: Slope of asymptote1: Slope of asymptote2: Product of slopes: Asymptotes are perpendicular. |
Rectangular hyperbola parallel to Y axis
[edit | edit source]
Curve in Figure 2 has equation:
Vertex has coordinates Vertex has coordinates
Focus has coordinates Focus has coordinates
Point has coordinates Point has coordinates Directrix1, directrix through point has equation Directrix2, directrix through point has equation
Asymptote2 has equation: Slope of asymptote1: Slope of asymptote2: Product of slopes: Asymptotes are perpendicular. |
Rectangular hyperbola, random
[edit | edit source]
Curve in Figure 3 has equation:
Vertex has coordinates Vertex has coordinates
Focus has coordinates Focus has coordinates
Point has coordinates Point has coordinates Conjugate axis through point has equation Directrix1, directrix through point has equation Directrix2, directrix through point has equation
Asymptote2 has equation: Slope of asymptote1: Slope of asymptote2: Product of slopes: 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 Distance from focus to directrix must be non-zero.
Let the point have coordinates
Let the focus have coordinates
Let the directrix have equation where
Then
Square both sides:
Rearrange:
Expand simplify, gather like terms and result is:
where:
Note that values depend on:
For example, directrix and directrix 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
Simple quadratic function: Let focus be point Let directrix have equation: or # 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: Curve is quadratic function: or 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:
Curve in Figure 2 below has:
Curve in Figure 3 below has:
|
Ellipse
[edit | edit source]Every ellipse has eccentricity
A simple ellipse: Let focus be point where Let directrix have equation: or Let eccentricity # 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:
# 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)
|
The effect of eccentricity.
|
Gallery
[edit | edit source]
Curve in Figure 1 below has:
Curve in Figure 2 below has:
Curve in Figure 3 below has:
|
Hyperbola
[edit | edit source]Every hyperbola has eccentricity
A simple hyperbola: Let focus be point where Let directrix have equation: or Let eccentricity # 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: 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)
|
The effect of eccentricity.
|
Gallery
[edit | edit source]
Curve in Figure 1 below has:
Curve in Figure 2 below has:
Curve in Figure 3 below has:
|
Reversing the process
[edit | edit source]The expression "reversing the process" means calculating the values of focus and directrix when given the equation of the conic section, the familiar values
Consider the equation of a simple ellipse: This is a conic section where
This ellipse may be expressed as a format more appealing to the eye than numbers containing fractions or decimals.
However, when this ellipse is expressed as this format is the ellipse expressed in "standard form," a notation that greatly simplifies the calculation of
Modify the equations for slightly: or or
In substitute for is a quadratic equation in where:
Because is a quadratic equation, the solution of may contain an unwanted value of that will be eliminated later. From and
Because |
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
In replace Expand simplify, gather like terms and result is quadratic function in where:
Therefore:
For parabola, there is one value of because there is one directrix. For ellipse and hyperbola, there are two values of 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 |