kill(all)$

maxima : computation : asymptote & axes of a conic,other elements,version 1.0
peter.vlasschaert@gmail.com, 10/05/2022

ref :

load packages
-------------------

load(lrats)$

→ option : other : ratprint:false can be used.

ordergreat(x,y)$

quadratic form:
===========

values : 2d quadratic form:
---------------------------------

quadr(a,h,b,g,f,c):=ev(a*x^2+2*h*x*y+b*y^2+2*g*x+2*f*y+c,nouns);

p1:quadr(a,h,b,g,f,c);

p1b:ratcoeff(p1,x^2);
p1bx:ratcoeff(p1,2*x);
p1c:ratcoeff(p1,y^2);
p1cy:ratcoeff(p1,2*y);
p1d:subst([x=0,y=0],p1);

function :
------------

p1a:f(x,y):=''p1;

matrix quadratic form:
-----------------------------

vv: matrix(
 [a,h,g], 
 [h,b,f], 
 [g,f,c]
);

detvv(a,h,b,g,f,c):=determinant(vv);

p1e:Δ=expand(detvv(a,h,b,g,f,c));

p1e1:[reverse(p1e)];

 submatrix =δ1,quadratic part 

p1f1:δ1 = submatrix(3,vv,3);

→ determinant :δ1→δ

p1f2:δ =determinant(rhs(p1f1));

p1f3:reverse(p1f2);

example :

→ equation of the conic :

p2:quadr(1,6,-4,-3,2,9)=0;

plot conic :p2,quadratic form.

wxplot2d ([p2], [x, -8, 8], [y, -8, 8],grid2d,nobox,[yx_ratio, 1])$

→ center of the conic     :

p3ax:'diff(lhs(p2),x)=diff(lhs(p2),x);

p3xx:rhs(p3ax)=0;

p3ay:'diff(lhs(p2),y)=diff(lhs(p2),y);

p3yy:rhs(p3ay)=0;

system : solve for (x,y) → (xC,yC)

p3sys:[p3xx,p3yy];

point intersection :(xC,yC), other way : see end of document.

wxplot2d (p3sys, [x, -2, 4], [y, -2, 4],grid2d,nobox,[yx_ratio, 1])$

p3solve:solve(p3sys,listofvars(p3sys))[1];

p3final:subst([x=xC,y=yC],p3solve);

p3z1:flatten([p2,p3sys]);

→ equation of the central conic :

quadrC(A,H,B):=ev(A*x^2+2*H*x*y+B*y^2,nouns);

conic refered to : centre as origin.(use:quadra)

p4:quadr(1,6,-4,0,0,c1)=0;

c1→g*x+f*y+c, (x=xC,y=yC)
-------------------------------------------
rem : c1 = 0 into p4,result : a pair of straight lines.

c1:subst([g=-3,f=2,c=9,x=rhs(p3final[2]),y=rhs(p3final[1])],g*x+f*y+c);

p4a:ev(p4,nouns);

p4b:p4a-subst([x=0,y=0],lhs(p4a));

p4c:expand((p4b)/rhs(p4b));

values : quadrC

A:ratcoeff(lhs(p4c),x^2);
H:ratcoeff(lhs(p4c),x*y)/2;/*2*H*x*y*/
B:ratcoeff(lhs(p4c),y^2);

p4d:quadrC(A,H/2,B)=1;

plot : p4d

wxplot2d ([p4d], [x, -8, 8], [y, -8, 8],grid2d,nobox,[yx_ratio, 1])$

plot : p4d,p2

wxplot2d ([ p4d,p2], [x, -8, 8], [y, -8, 8],grid2d,nobox,[yx_ratio, 1])$

rem : length of the axes : conic
use :{A,H,B}→{A1,H1,B1}, theoretical consideration.

→step:1 = central conic.

p4e:quadrC(A1,H1,B1)=1;

→step:2 = circle , with orgin =0,radius = r

p4e1:reverse(x^2+y^2 = r^2);

p4e2:p4e1/lhs(p4e1);

→ step:3 - combination step:1 & step:2

p4f:lhs(p4e)=rhs(p4e2);

→ step :4 - homogeneous equation

p4g1:lhs(p4f)-rhs(p4f)=0;

p4g2:collectterms(expand(lhs(p4g1)),x^2,x*y,y^2) =rhs(p4g1);

→ step:5 when represent :coincident straight lines: constraint

p4h1:H1^2 =expand( ratcoeff(lhs(p4g2),x^2))* expand(ratcoeff(lhs(p4g2),y^2));

p4h1a:reverse(p4h1);

p4h1aa:[part(lhs(p4h1a),1),part(lhs(p4h1a),2)];

p4h2:expand(reverse(0=rhs(p4h1)-lhs(p4h1)));

radius : r ,always positiv

p4h3:expand(r^4*lhs(p4h2))=rhs(p4h2);

p4h4:collectterms(lhs(p4h3),r^4,r^2) = rhs(p4h2);

→ step:6 - find r ?

assume(r>0);

use : r^2 =R

p5a1:subst([r^2=R,r^4=R^2],p4h4);

p5a2:solve(p5a1,R);

p5a3:subst([R=r^2],p5a2);

p5a4:map(sqrt,p5a3);

r=r1 or r2, when values are given.

→ step:7 - case ?

use :p5a1

p6:δ = ratcoeff(lhs(p5a1),R^2);

case : I →ellipse :δ > 0
----------------------------
r1^2 & r2^2 → both positive
greater value : r^2 → semi-major axis
smaller value : r^2 → semi-minor axis
------------------------------------------------
axis :length = 2*r1,2*r2

case : II →hyperbola :δ < 0
----------------------------
r1^2 & r2^2 → different sign
one    value : r^2 → say :r1^2 >0
other value : r^2 →say   :r2^2<0
----------------------------------------
axis→length : 2*r1                   → r1:length : semi-transverse axis
axis→length : 2*sqrt(abs(r2))  → r2:length : semi-conjugate axis

rem : r=r1 or r=r2

→step:8 ,equations of the axes
use : constraint "p4h1 or p4h1a" and p4h1aa

use :p4g2

first : straight line (with constraint)

p7ax:multthru(lhs(p4g2*p4h1aa[1]))=0;

rem :multthru, hold the expression form.

use : constraint

p7ax1:y^2*rhs(p4h1a)+part(lhs(p7ax),1)+part(lhs(p7ax),2)=0;

p7ax2:facsum(lhs(p7ax1))=0;

p7ax3:(p4h1aa[1]*x+H1*y)^2=0;

p7ax4:part(lhs(p7ax3),1)=rhs(p7ax3);

shifting :{ x→x-xC, y→y-yC},see : center of conic

p7ax4s:subst([x=x-xC,y=y-yC],p7ax4);

analog :

second : straight line (with constraint)

p7ay:psubst([A1=B1,x=y,y=x],p7ax1);

p7ay1:facsum(lhs(p7ay))=0;

p7ay2:psubst([A1=B1,x=y,y=x],p7ax3);

rem :psubst,parallel substitution.

→ length of the axis : example.

1e) step : use p4h1a

p8:[A1=A,H1=H,B1=B]$
p8a:expand(subst(p8,p4h1a)*r^4);

p8b:rhs(p8a)-lhs(p8a)=0;

reason : r >0

p8c:subst([%i=1],solve(p8b,r));

p8c1:solve(subst([r^2=R,r^4=R^2],p8b),R);

2e) step :tranvers axis  & conjugate axis
-------------------------------------------------

r1:rhs(p8c[2])$
print("→  transvers-axis =",2*r1)$
r2:rhs(p8c[4])$
print("→  conjugate-axis =",2*r2)$

→ equation of the axis : example.

use :p7ax4s

p9a:p7ax4s;

→ first : linear equation

use : center of conic

p9b:flatten([A1=A,H1=H,r=r1,p3final]);

use :p9a

p9c:factor(expand(subst(p9b,p9a)))*(-10/3);

p9c1:expand(solve(p9c,y));

→ second : linear equation

p10b:flatten([A1=A,H1=H,r=r2,p3final]);

use:p10b

p10c:factor(expand(subst(p10b,p9a)))*(-10/3);

p10c1:expand(solve(p10c,y));

3e) step :e = (e)ccentricity (ellipse,hyperbola(=example))
---------------------------------------------------------------------

equation : ellipse       → e^2 =1-r2^2/r1^2,both +,r1^2 > r2^2
equation : hyperbola → e^2 =1+r2^2/r1^2,+/-,r1^2 > 0 ,r2^2 < 0 

use:p8c

p11:p8c1;

rem :general equations (R) : {A1=A,B1=B,H1=H}, subst into :p5a2,"see:above"

use : equations 3e) step

translate R=ri^2, i=1,2

p11a1:print ("r1=", r1," :follows →r1^2 =R1:",rhs(p11[2]))$
p11a2:print ( "r2=",r2," :follows   →r2^2 =R2:",rhs(p11[1]))$

p11a11:R1=rhs(p11[2]);
p11a22:R2=rhs(p11[1]);

p11a33:[p11a11,p11a22];

result : e ^2  =1-r2^2/r1^2. both ellipse ,take condition in account.

p11b:e:(sqrt(1+r2^2/r1^2));

4e) step :θ = inclinination → tan(θ) ,called : inclinination of conic (x,y: plane)
θ  → ellipse        :angle between (major        axis, x-axis)
θ  → hyperbola  :angle between (transverse axis, x-axis)

→1e) method :formula

p12a:tan(θ) =-(A-1/r1^2)/H;

use:p9c1

→2e) method :use transverse axis

use:p9c1

p12b1:p9c1[1];

p12b2: tan(θ) = coeff(rhs(p12b1),x);

→check : tan(θ)

p13:is(rhs(p12a)=rhs(p12b2));

4e) step : c = foci major axis (ellipse,hyperbola(=example))
ref : center(xC,yC)
-------------------------------------------------------------------------

use : rem , e^2 general : ellipse & hyperbola,take condition ,r1^2 & r2^2.
use : R inside.
see "above"
3e) step :e = (e)ccentricity (ellipse,hyperbola(=example))

set : ee = e^2, don't for get this , use "otherwise direct evaluation:see above"
see : R1="p11a11",R2="p11a22"

→ a) equation : eccentricity

p14:ee =1-R2/R1;

→ b) polar coordinates for foci, ref : center =(xC,yC)

use : p12b2

p14a:p12b2;

rem : sign befor tan(θ): ? what about ,sin(θ),cos(θ).

hypotenusa : right triangle 

p14a1:denom(abs(rhs(p14a)));
p14a2:num(abs(rhs(p14a)));

p14a3:sqrt((p14a1)^2+(p14a2)^2);

   →1e) step : sin(θ) , from tan(θ): sign(p14a), condition :rectangle triangle

p14b1:sin(θ) = -1*p14a2/p14a3;

   →2e) step : cos(θ) , from tan(θ):condition :rectangle triangle

p14b2:cos(θ) = p14a1/p14a3;

p14bb:[p14b1,p14b2];

  →3e) step :foci coordinates.

p14c1: er1=sqrt(R1-R2);

use : p3final = (xC,yC),p11a33:R1,R2, example (hyperbola:R1>0,R2<0)

p14c1a:foci1=[xC+er1*cos(θ),yC+er1*sin(θ)];
p14c1b:foci2=[xC-er1*cos(θ),yC-er1*sin(θ)];

   →4e) step : input values (= example)

p14d1:subst(p11a33,p14c1);

p14d2:flatten([p3final,p14bb,p14d1]);

p14c1a:subst(p14d2,foci1=[xC+er1*cos(θ),yC+er1*sin(θ)]);
p14c1b:subst(p14d2,foci2=[xC-er1*cos(θ),yC-er1*sin(θ)]);

5e) step : directories are perpendicular to the major axis
----------------------------------------------------------------------

→ equation:

p15a1:(x-xC)*cos(θ)+(y-yC)*sin(θ) = + R1/sqrt(R1-R2);
p15a2:(x-xC)*cos(θ)+(y-yC)*sin(θ) = - R1/sqrt(R1-R2);

→ values : inside equation

p15:flatten([p14d2,p11a33]);

p15b1:subst(p15,(x-xC)*cos(θ)+(y-yC)*sin(θ) = + R1/sqrt(R1-R2));
p15b2:subst(p15,(x-xC)*cos(θ)+(y-yC)*sin(θ) = - R1/sqrt(R1-R2));

p15bb1:factor(expand(lhs(p15b1)-rhs(p15b1)))=0;
p15bb2:factor(expand(lhs(p15b2)-rhs(p15b2)))=0;

→ final equations:

p15bbb1:p15bb1*denom(lhs(p15bb1));
p15bbb2:p15bb2*denom(lhs(p15bb2));

6e) step :asymptotes
--------------------------

use: p2a

p16a:quadr(1,6,-4,-3,2,9)=0;

→ 1e:step : corrected wth λ

p16a1:lhs(p16a)+λ = rhs(p16a);

→ 2e:step : find λ with Δ

new value : c→c+λ in Δ

use :p1e

p16b1:p1e;

p16b2:[a=6,h=6,b=-4,g=-3,f=2,c=9];

p16b3:subst([c=c+λ],rhs(p16b1))=0;

p16b4:subst(p16b2,p16b3);

p16b5:solve(p16b4,listofvars(p16b4));

input λ into p16a1

p16b6:subst(p16b5,p16a1);

rem : check with geogebra : copy & paste two lines crossing.

How to do this: Geogebra
------------------------------------------------
1e) step : open Geogebra classic
2e) copy output from : p16b6
3e) input column : mouse , Ctrl-v
4e) see: result
-------------------------------------------------
rem : ? away to find crossing : two lines "p16b6"
-------------------------------------------------

p17b1:[a1*a1=1,b1*b2=-4,a1*c22+a2*c11=-6,b1*c22+b2*c11=4,c11*c22=-1,b1*a2+a1*b2=12];

p17b2:listofvars(p17b1);

p17b3:solve(p17b1,p17b2);

select : eassy value, %r1

p17b4:subst([%r1=1],p17b3[1]);

p17a1:subst(p17b4,a1*x+b1*y+c11=0);
p17a2:subst(p17b4,a2*x+b2*y+c22=0);

p17a3:[p17a1,p17a2];

plot :two lines

wxplot2d (p17a3, [x, -2, 4], [y, -2, 4],grid2d,nobox,[yx_ratio, 1])$

p17a4:solve(p17a3,listofvars(p17a3))[1];

see values :x=xC, y=yC: center of a conic.

use : see p3final:intersection both asymptote:intersction =center conic

p17a5:p3final;

computation : see above.

-----------------------------------------------------------------------------------------------------------