;;; Axis of an ellipse ;;; ------------------------- ;; Given an ellipse with its center at the origin, as ;; ax^2 + by^2 + cxy - 1 = 0 ;; The two axis of an ellipse are characterized by minimizing and ;; maximizing the radius. Let (x,y) be a point on the delimiter of the ;; ellipse. It's radius (distance from the origin) then is: ;; r^2 = x^2 + y^2 ;; To find the axis can now be stated as an minimization problem with ;; constraints. So mechanically construct the auxiliarry function H: ;; H = x^2 + y^2 - k(ax^2 + by^2 + cxy - 1) ;; So the following set of equations remain to be solved ;; (I) dH/dx = 0 = 2x + 2kax + kcy ;; (II) dH/dy = 0 = 2y + 2kby + kcx ;; (III) dH/dk = 0 = ax^2 + by^2 + cxy - 1 ;; Unfortunatley, As I always do the math work - hopelessly, even - ;; Maxima is the tool of my choice: ;; g1: 2*x + 2*k*a*x + k*c*y$ ;; g2: 2*y + 2*k*b*y + k*c*x$ ;; g3: a*x*x + b*y*y + c*x*y -1$ ;; sol1: solve ([g1,g2],[k,y])$ ;; /* This yields to solutions because of the squares with occur. The ;; * last equaltion (G3) must therefor be handled for both solutions for ;; * y. ;; */ ;; y1: rhs(first(rest(first(sol1))))$ ;; y2: rhs(first(rest(first(rest(sol1)))))$ ;; /* Substitute the 'y' found. */ ;; sol2: solve(subst(y1,y,g3),x); ;; x11: rhs(first(sol2)); ;; x12: rhs(first(rest(sol2))); ;; sol3: solve(subst(y2,y,g3),x); ;; x21: rhs(first(sol3)); ;; x22: rhs(first(rest(sol3))); ;; /* dump everything */ ;; dumpsol([[x=x11,y=y1], [x=x12,y=y1], [x=x21,y=y2], [x=x22,y=y2]]);