kill(all)$

maxima : asymptotes computation without determinant(=quadratic form),version 1.0a
peter.vlasschaert@gmail.com,14/05/2022

extra :conjugate hyperbola.

How to do computation :
--------------------------------
a) f(x,y) =0 ,only constant term must replaced unknown =k .
b) quadratic part (x^2,x*y,y^2) replaced = product two lines (constant=l,m)
---------------------------------------------------------------------------------------------
f(x,y) = 0 : "quadratic form" ≠ quadratic part
----------------------------------------------------------------------------------------------
k,l,m = unknowns
-----------------------------------------------------------------------------------------------

Given quadratic form :
----------------------------

→ f(x,y) =0

p1:(3*x^2-5*x*y-2*y^2+17*x+y+14 =0)*(-1);

1e) step : find constant term:p1→k
--------------------------------------

k1:subst([x=0,y=0],lhs(p1));

p2:lhs(p1)-k1=0;

→ f(x,y,k) = 0

p2a:lhs(p2)+k=0;

2e) step :find quadratic part terms (x^2,x*y,y^2)
-----------------------------------------------------

p3:[x^2,x*y,y^2];
p3a:makelist(p3[i]*ratcoeff(lhs(p2a),p3[i]),i,1,length(p3));

p3b:sum(p3a[i],i,1,length(p3));

p3c:(facsum(p3b));

? what to do remove neg sign in front :p3c

if part(p3c,0) = "-" then
    print("minus sign in front expression:p3c    ")
else 
    print("no minus sign in front expression:p3c")$

rem : p3c
negative sign in front : see above.

solve : multiplication →(p1)*(-1) 
-----------------------------------------
reason : p1=0→ (p1=0)*(-1)
------------------------------------------

3e) step: construct product two lines with constant (l,m).
----------------------------------------------------------------

p4a1:part(lhs(p3c),1)+l;
p4a2:part(lhs(p3c),2)+m;

p4:p4a1*p4a2=0;

4e) step: f(x,y,k) = lhs(p4),equations:k,l,m
---------------------------------------------------

p5:lhs(p2a)=expand(lhs(p4));

→ find three equations : k,l,m

firsr : x ,[y=0]
---------

p5a:reverse(subst([y=0],ratcoeff(p5,x)));

second :y,[x=0]
-----------

p5b:reverse(subst([x=0],ratcoeff(p5,y)));

third : constant k
----------------------

p5c:subst([x=0,y=0],p5);

5e) step : solve = k,l,m
-----------------------------

→ l,m : find {p5a,p5}

p6a:solve([p5a,p5b],listofvars(p5a))[1];

find two linear equations :{p6aa,p6bb}

p6aa:subst(p6a,p4a1)=0;
p6bb:subst(p6a,p4a2)=0;

→ k =l*m

p6b:subst(p6a,p5c);

6e) step : k found,subst : f(x,y,k)=0
------------------------------------------

p7:subst([p6b],p2a);

plot : p1 & p7
-----------------

blue  : conic section (= quadratic form)
red    :asymptotes equation.

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

use :p6aa,p6bb

fig :without conjugate hyperbola.

wxplot2d ([p1,p6aa,p6bb], [x, -8, 8], [y, -8, 8],grid2d,nobox,[yx_ratio, 1])$

find intersection: (red,green):
------------------------------------

p8:[p6aa,p6bb];
p8a:solve(p8,listofvars(p8))[1];

rem :                  x=xC,y=yC → "center of the conic" = (xC,yC)

find :(xC,yC)
----------------

p9a:diff(p1,x);
p9b:diff(p1,y);

p9c:solve([p9a,p9b],listofvars(p9a))[1];

map(is,[lhs(p8a[1])=lhs(p9c[1]),lhs(p8a[2])=lhs(p9c[2])]);

find :k from p9c:(xC,yC)

p10:subst(p9c,p2a);

p10a:solve(p10,listofvars(p10));

→ asymptote:

p10b:subst(p10a,p2a);

check :against p7

is(lhs(p10b)=lhs(p7));

Hyperbola conjugate : 
---------------------------
HYP +CHYP =2*AS
---------------------------

HYP     = equation hperbola.(=p1)
CHYP  = conjugate hperbola.(= ?)
AS        = asymptote (=p10b)

p11a:HYP=lhs(p1);

p11b:AS =lhs(p10b);

p11c:solve(HYP+CHYP=2*AS,CHYP)[1];

p11d:subst([p11a,p11b],p11c);

p11d1:expand(rhs(p11d))=0;

fig : with conjugate hyperbola

wxplot2d ([p1,p6aa,p6bb,p11d1], [x, -8, 8], [y, -8, 8],
    grid2d,nobox,[yx_ratio, 1])$

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