Conic sections

From Wikiversity
Jump to navigation Jump to search

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]

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

   (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

Rectangular Hyperbolas[edit | edit source]

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

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:

  • non-zero. This method is not suitable for circle where
  • Sign of is not significant.
  • or and produce same result.

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

Quadratic function complies with definition of parabola.
Distance from point to focus
= distance from point to directrix = 10.
Distance from point to focus
= distance from point to directrix = 1.

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:

  • Directrix:
  • Focus:
  • Equation: or

Curve in Figure 2 below has:

  • Directrix:
  • Focus:
  • Equation: or

Curve in Figure 3 below has:

  • Directrix:
  • Focus:
  • Equation:

Ellipse[edit | edit source]

Every ellipse has eccentricity

Ellipse with ecccentricity of 0.25 and center at origin.
Point1
Eccentricity
For every point on curve,

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:


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 shape of ellipse approaches shape of circle.
As eccentricity approaches shape of ellipse approaches shape of parabola.

The effect of eccentricity.


All ellipses in diagram have:

  • Focus at point
  • Directrix with equation


Five ellipses are shown with eccentricities varying from to

Gallery[edit | edit source]

Curve in Figure 1 below has:

  • Directrix:
  • Focus:
  • Eccentricity:
  • Equation:

Curve in Figure 2 below has:

  • Directrix:
  • Focus:
  • Eccentricity:
  • Equation:

Curve in Figure 3 below has:

  • Directrix:
  • Focus:
  • Eccentricity:
  • Equation:

Hyperbola[edit | edit source]

Every hyperbola has eccentricity

Hyperbola with eccentricity of 1.5 and center at origin.
Point1
Eccentricity
For every point on curve,

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)

Hyperbolas with ecccentricities from 1.5 to 20.
As eccentricity increases, curve approaches directrix:
As eccentricity approaches shape of curve approaches shape of parabola.

The effect of eccentricity.


All hyperbolas in diagram have:

  • Focus at point
  • Directrix with equation


Six hyperbolas are shown with eccentricities varying from to

Gallery[edit | edit source]

Curve in Figure 1 below has:

  • Directrix:
  • Focus:
  • Eccentricity:
  • Equation:

Curve in Figure 2 below has:

  • Directrix:
  • Focus:
  • Eccentricity:
  • Equation:

Curve in Figure 3 below has:

  • Directrix:
  • Focus:
  • Eccentricity:
  • Equation:

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 = 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
Equation of parabola is given.
This section calculates

Given equation of conic section:

Calculate

# 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:

Eccentricity:

Focus:

Because eccentricity is 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
Equation of ellipse is given.
This section calculates

Given equation of conic section:

Calculate

# 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:

Eccentricity:

Focus 1:

Directrix 2:

Eccentricity:

Focus 2:

Because eccentricity is 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
Equation of hyperbola is given.
This section calculates

Given equation of conic section:

Calculate

# 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:

Eccentricity:

Focus 1:

Directrix 2:

Eccentricity:

Focus 2:

Because eccentricity is 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:

differentiate both sides with respect to




For slope horizontal:

For slope vertical:

For given slope

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
At intersection of and curve, slope = .
At intersection of and curve, slope = .
Slope of curve is never vertical.

Consider conic section:

This is quadratic function:

Slope of this curve:

Produce values for slope horizontal, slope vertical and slope

# 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
At intersection of and curve, slope is vertical.
At intersection of and curve, slope = .
Slope of curve is never horizontal.

Consider conic section:

This is quadratic function:

Slope of this curve:

Produce values for slope horizontal, slope vertical and slope

# 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
At intersection of and curve, slope is horizontal.
At intersection of and curve, slope is vertical.
At intersection of and curve, slope = .
Slope of curve is never because axis has slope and curve is never parallel to axis.

Consider conic section:

This curve is a parabola.


Produce values for slope horizontal, slope vertical and slope

# 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


Produce values for slope horizontal, slope vertical and slope

# 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 and curve is never parallel to axis.

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?