Analytische Geometrie: Kegelschnitt-Gleichung

Download PDF-Dokument: 2206290859_ConicSectionEquation.pdf

Quellen

Wikipedia(de) : Gleichung eines Kegelschnitt
Wikipedia(en) : Conic Section

Übersicht

Die "Allgemeine Gleichung eines Kegelschnitts"
("OCSE - Ordinary Conic Section Equation") lautet:

$\boxed{a x^2 + b x y + c y^2 + dx + e y + f = 0}$   (1*)  (OCSE)

Diese implizite Gleichung beschreibt in der Ebene einen allgemeinen
Kegelschnitt (Ellipse, Hyperbel, Parabel), dessen Mittelpunkt vom Ursprung
verschoben und welcher nicht achsenparallel (also gedreht) liegt.

Speziell für eine (achsenparallele und verschobene) Ellipse ergibt sich die
"Normalform" einer Ellipse:

$\boxed{\dfrac{(x - x_m)^2}{a_l^2} + \dfrac{(y - y_m)^2}{a_s^2} = 1}$   (10*)

mit dem vom Ursprung verschobenen Mittelpunkt $P_m(x_m, y_m)$ und den
Halbachsen $a_l$ (Grosse Halbachse) und $a_s$ (Kleine Halbachse).

Ziel: Finden der Gleichungen zur Bestimmung der
charakteristischen Kegelschnitt(Ellipsen)-Parameter:
  •  Gleichung für den Drehwinkel $\phi = \phi(a, b, c)$   (6.1),(6.2)
  •  Gleichungen für den Mittelpunkt $x_m, y_m$   
  •  Gleichungen für die Halbachsen $a_l, a_s$   

$\boxed{\phi = \dfrac{1}{2} \arctan{\bigg[ \dfrac{b}{a - c} \bigg]}}$   (7.1*)
$\boxed{\phi = \dfrac{b}{|b|} \cdot 45°}$   (7.2*)   für Spezialfall $\boxed{a = c}$

$\boxed{x'_m = - \dfrac{S}{2A}}$    (11.1*)
$\boxed{y'_m = - \dfrac{T}{2B}}$    (11.2*)
$\boxed{a_l = \dfrac{BS^2 + AT^2 + 4ABK}{4A^2B}}$    (11.3*)
$\boxed{a_s = \dfrac{BS^2 + AT^2 + 4ABK}{4AB^2}}$    (11.4*)

mit den Definitionen:
$\boxed{A := a\cos^2\phi + b\cos\phi\sin\phi + c\sin^2\phi}$    (8.2*)
$\boxed{C := a\sin^2\phi - b\cos\phi\sin\phi + c\cos^2\phi}$    (8.3*)
$\boxed{S := d\cos\phi + e\sin\phi}$    (8.4*)
$\boxed{T := e\cos\phi - d\sin\phi}$    (8.5*)
$\boxed{K := -f}$    (8.6*)

(Die charakteristischen Kegelschnitt-Parameter einer Hyperbel oder Parabel werden später ergänzt.)

Herleitung

Gegeben

Allgemeine gedrehte und verschobene Ellipse (1):

$\boxed{a x^2 + b x y + c y^2 + dx + e y + f = 0}$   (1)

Gesucht: Drehwinkel

Finden des Drehwinkels $\phi$ durch Drehung der Ebene $(x,y) \rightarrow (x', y')$

$\begin{pmatrix} x \\ y \\ \end{pmatrix} = \begin{pmatrix} +\cos\phi & -\sin\phi \\ +\sin\phi & +\cos\phi \\ \end{pmatrix} \cdot \begin{pmatrix} x' \\ y' \\ \end{pmatrix} = \begin{pmatrix} x' \cos\phi - y' \sin\phi \\ x' \sin\phi + y' \cos\phi \\ \end{pmatrix} $   (2)

Transformation-Gleichungen $(x, y) \rightarrow (x', y')$ :

$\boxed{x = x' \cos\phi - y' \sin\phi}$   (3)
$\boxed{y = x' \sin\phi + y' \cos\phi}$

Durch Einsetzen in (1*) mit den Definitionen (D1) und (D2):

(D1) :   $C := \cos\phi$   (4.1)
(D2) :   $S := \sin\phi$    (4.2)

$x = x'C - y'S$
$y = x'S + y'C$

folgt:

$a[Cx' - Sy'] [Cx' - Sy'] +$
$+b[Cx' - Sy'] [Sx' + Cy'] +$
$+c[Sx' + Cy'] [Sx' + Cy'] +$
$+d[Cx' - Sy'] + e[Sx' + Cy'] + f = 0$

$aC^2x'^2 + aS^2y'^2 - 2aCSx'y' + $
$+ bCSx'^2 - bCSy'^2 + bC^2x'y' - bS^2x'y' +$
$+ cS^2x'^2 + cC^2y'^2 + 2cCSx'y' +$
$+ dCx' - dSy' + eSx' + eCy' + f = 0$

$x'^2[aC^2 + bCS + cS^2] + y'^2[aS^2 - bCS + cC^2] +$
$+ x'y'[- 2aCS + bC^2 - bS^2 + 2cCS] + $
$+ x'[dC + eS] + y'[-dS + eC] + f = 0$

$x'^2[aC^2 + bCS + cS^2] + y'^2[aS^2 - bCS + cC^2] +$     (5)
$+ x'y'[b(C^2 - S^2) + 2cCS - 2aCS] + $
$+ x'[dC + eS] + y'[eC - dS] + f = 0$

Es ergibt sich eine Bedingung für den gemischten oder "Drehterm":

$x'y'[b(C^2 - S^2) + 2cCS - 2aCS]$

Dieser Term muss Null für beliebige $x', y'$ werden!

$\Rightarrow$ Bedingung für achsenparallele Lage des Kegelschnitts:

$0 = b(C^2 - S^2) + [2c - 2a]CS$

entspricht mit den Definitionen (D1) und (D2):

$\boxed{0 = b(\cos^2\phi - \sin^2\phi) + [2c - 2a]\cos\phi \sin\phi}$    (6)

$b\dfrac{\cos\phi^2 - \sin\phi^2}{\cos\phi \sin\phi} = 2a - 2c$

(NR1) :   $\cos^2\phi - \sin^2\phi = \cos 2\phi$
(NR2) :   $\cos\phi \sin\phi = \dfrac{\sin 2\phi}{2}$

$2b\dfrac{\cos2\phi}{\sin2\phi} = 2a - 2c$

$\dfrac{1}{\tan{2\phi}} = \dfrac{a - c}{b}$

$\boxed{\tan2\phi = \dfrac{b}{a - c}}$    (7.1)

Spezialfall: $\boxed{a = c} \Rightarrow$ Steigung $\dfrac{b}{|b|} \cdot \infty \Rightarrow 2\phi = \dfrac{b}{|b|} \cdot 90° \Rightarrow \boxed{\phi = \dfrac{b}{|b|} \cdot 45°}$    (7.2)

Gesucht: Koeffizienten im achsenparallelen System (x',y')

Aus (3)

$x'^2[aC^2 + bCS + cS^2] + y'^2[aS^2 - bCS + cC^2] +$     (8.1)
$+ x'y'[b(C^2 - S^2) + 2cCS - 2aCS] + $
$+ x'[dC + eS] + y'[eC - dS] + f = 0$

folgt mit:

$\boxed{A := a\cos^2\phi + b\cos\phi\sin\phi + c\sin^2\phi}$    $(= aC^2 + bCS + cS^2)$        (8.2)
$\boxed{C := a\sin^2\phi - b\cos\phi\sin\phi + c\cos^2\phi}$    $(= aS^2 - bCS + cC^2)$     (8.3)
$\boxed{S := d\cos\phi + e\sin\phi}$    $(= dC + eS)$     (8.4)
$\boxed{T := e\cos\phi - d\sin\phi}$    $(= eC - dS)$     (8.5)
$\boxed{K := -f}$

wobei $\boxed{\phi = \dfrac{1}{2} \arctan\bigg[\dfrac{b}{a - c}\bigg]}$    (7.1*) und damit alle Terme $\cos{\phi}$ und $\sin{\phi}$ bekannt sind:

$\boxed{Ax'^2 + By'^2 + Sx' + Ty' = K}$    (8.6)

Quadratische Ergänzung:

$Ax'^2 + Sx' + By'^2 + Ty' = K$

$A\bigg[x'^2 + \dfrac{S}{A}x'\bigg] + B\bigg[y'^2 + \dfrac{T}{B}y'\bigg] = K$

$A\bigg[x'^2 + \dfrac{S}{A}x' + \dfrac{S^2}{4A^2}\bigg] + B\bigg[y'^2 + \dfrac{T}{B}y' + \dfrac{T^2}{4B^2}\bigg] = K + \dfrac{S^2}{4A} + \dfrac{T^2}{4B}$

$A\bigg[x' + \dfrac{S}{2A}\bigg]^2 + B\bigg[y' + \dfrac{T}{2B}\bigg]^2 = \dfrac{4ABK}{4AB} + \dfrac{BS^2}{4AB} + \dfrac{AT^2}{4AB}$

$A\bigg[x' + \dfrac{S}{2A}\bigg]^2 + B\bigg[y' + \dfrac{T}{2B}\bigg]^2 = \dfrac{4ABK + BS^2 + AT^2}{4AB}$

$\dfrac{4A^2B}{BS^2 + AT^2 + 4ABK}\bigg[x' + \dfrac{S}{2A}\bigg]^2 + \dfrac{4AB^2}{BS^2 + AT^2 + 4ABK}\bigg[y' + \dfrac{T}{2B}\bigg]^2 = 1$

$\boxed{\dfrac{\bigg[x' + \dfrac{S}{2A}\bigg]^2}{\dfrac{BS^2 + AT^2 + 4ABK}{4A^2B}} + \dfrac{\bigg[y' + \dfrac{T}{2B}\bigg]^2}{\dfrac{BS^2 + AT^2 + 4ABK}{4AB^2}} = 1}$    (9)

Gleichung (6) entspricht der Normalform der Ellipse im achsenparallelen $(x',y')$-System:

$\boxed{\dfrac{(x' - x'_m)^2}{a_l^2} + \dfrac{(y' - y'_m)^2}{a_s^2} = 1}$   (10)

mit:

$\boxed{x'_m = - \dfrac{S}{2A}}$    (11.1)
$\boxed{y'_m = - \dfrac{T}{2B}}$    (11.2)
$\boxed{a_l = \dfrac{BS^2 + AT^2 + 4ABK}{4A^2B}}$    (11.3)
$\boxed{a_s = \dfrac{BS^2 + AT^2 + 4ABK}{4AB^2}}$    (11.4)

Python-Programm: Kegelschnitt-Gleichung

Im Folgenden findet sich der Python-Code für die Lösung des Kegelschnitt-Problems:
(Python-Programm "ConicSection"):

  #
  #--------------------------------------------------------------------
  #   Include
  #--------------------------------------------------------------------
  import math as MT
  import numpy as NP
  ##
  #--------------------------------------------------------------------
  #   Helper
  #--------------------------------------------------------------------
  def RadDeg(rad):
      return rad * 180.0 / NP.pi
  def DegRad(deg):
      return deg * NP.pi / 180.0
  ##
  #--------------------------------------------------------------------
  #   Solver
  #--------------------------------------------------------------------
  def SolverGeneralQuadraticEquation(a, b, c):
      D = b * b - 4 * a * c
      X1 = 0.0
      X2 = 0.0
      if (D < 0):
         return 0, X1, X2
      if (0 == D):
         X1 = -b / 2 / a
         X1 = X2
         return 1, X1, X2
      # 0 < D
      X1 = -(b + MT.sqrt(D)) / 2 / a
      X2 = -(b - MT.sqrt(D)) / 2 / a
      return 2, X1, X2
  ##
  def SolverNormalizedQuadraticEquation(p, q):
      D = 0.25 * p * p - q
      X1 = 0.0
      X2 = 0.0
      if (D < 0):
         return 0, X1, X2
      if (0 == D):
         X1 = -p / 2
         X1 = X2
         return 1, X1, X2
      # 0 < D
      X1 = -p / 2 + MT.sqrt(D)
      X2 = -p / 2 - MT.sqrt(D)
      return 2, X1, X2
  ##
  #--------------------------------------------------------------------
  #   Main
  #--------------------------------------------------------------------
  if ('__main__' == __name__):
      print('*** ConicSection: begin')   
      #
      # 0 = a x^2 + b xy + c y^2 + d x +e y + f
      #-----------------------------------------------------------
      # # 0 = 5 x^2 - 4 xy + 8 y^2 + 20/sqrt(5)x - 80/sqrt(5)y + 4
      # a =  +5
      # b =  -4
      # c =  +8
      # d = +20 / MT.sqrt(5)
      # e = -80 / MT.sqrt(5)
      # f =  +4
      #-----------------------------------------------------------
      a =  +41
      b =  +24
      c =  +34
      d = +110
      e =  +20
      f =  +50
      print('a[%+.3f]' % a)
      print('b[%+.3f]' % b)
      print('c[%+.3f]' % c)
      print('d[%+.3f]' % d)
      print('e[%+.3f]' % e)
      print('f[%+.3f]' % f)
      #
      if (a != c):
          Phi = 0.5 * MT.atan2(b, a - c)
      else:
          Phi = 0.5 * NP.sign(b) * NP.pi

      print('Phi[%+.3f]rad' % Phi)
      print('Phi[%+.3f]deg' % RadDeg(Phi))
      #----------------------------------------
      CP = MT.cos(Phi)
      SP = MT.sin(Phi)
      A = a * CP * CP + b * CP * SP + c * SP * SP
      C = a * SP * SP - b * CP * SP + c * CP * CP
      S = d * CP + e * SP
      T = e * CP - d * SP
      K = -f
      #----------------------------------------
      Xm = -S / 2 / A
      Ym = -T / 2 / C
      N = C * S * S + A * T * T + 4 * A * C * K
      Al = MT.sqrt(N / 4 / A / A / C)
      As = MT.sqrt(N / 4 / A / C / C)
      #----------------------------------------
      print('Xm[%+.3f]' % Xm)
      print('Ym[%+.3f]' % Ym)
      print('Amajor[%+.3f]' % Al)
      print('Aminor[%+.3f]' % As)
      #----------------------------------------   
      #
      #----------------------------------------
      #   Test:
      #----------------------------------------
      NC = 36
      for T in range(0, NC):
          WA = MT.pi * T / NC
          x = Al * MT.cos(WA)
          y = As * MT.sin(WA)

      #----------------------------------------
      print('*** ConicSection: end')
      #
  #

Download des Python-Programms: 2206281400_ConicSection_01V02.zip

Ausgabe des Python-Programms "ConicSection":
runfile('.../2206281400_ConicSection_01V02.py',
wdir='.../2206281400_ConicSection_01V02',
current_namespace=True)
*** ConicSection: begin
a[+41.000]
b[+24.000]
c[+34.000]
d[+110.000]
e[+20.000]
f[+50.000]
Phi[+0.644]rad
Phi[+36.870]deg
Xm[-1.000]
Ym[+1.000]
Amajor[+0.707]
Aminor[+1.000]
*** ConicSection: end



WebSites    Module    Mathematik