Question: Reduced conical equation

Is it possible to write an equation reduction program that uses only LinearAlgebra.?

restart; with(LinearAlgebra); with(Student[LinearAlgebra]); unprotect(D);
f := proc (x, y) options operator, arrow; 5*x^2+4*y*x+8*y^2+16*x-8*y-16 end proc;
A := coeff(f(x, y), x, 2); B := coeff(coeff(f(x, y), x, 1), y, 1); C := coeff(f(x, y), y, 2); D := coeff(coeff(f(x, y), x, 1), y, 0); E := coeff(coeff(f(x, y), y, 1), x, 0);
F := tcoeff(f(x, y));
MQ:=Matrix([[A,B/2], [B/2,C]]):
Delta := A^2-4*A*C;
ML := `<,>`(D, E);
vp := Eigenvalues(MQ);
Omega := evalm(-`&*`((1/2)*ML, 1/MQ));
M1 := MQ-Eigenvalues(MQ)[1]*IdentityMatrix(2);
M2 := MQ-Eigenvalues(MQ)[2]*IdentityMatrix(2);
D := JordanForm(MQ);
with(linalg);
ma := matrix(2, 2, [A, (1/2)*B, (1/2)*B, C]);
jordan(ma, 'P1'); G := map(normalize, GramSchmidt([col(P1, 1 .. 2)])); P := map(simplify, concat(op(G)));

;
evalm(`&*`(`&*`(1/P, MQ), P));
nx := [X, Y];
var := [x, y];
x := matrix([seq([nx[i]], i = 1 .. 2)]); y := evalm(`&*`(P, x));
s := seq(var[k] = y[k, 1]+Omega[k], k = 1 .. 2);
eq := unapply(simplify(expand(subs(s, f(x, y)))), X, Y);
alpha := -eq(0, 0);
a := sqrt(alpha/vp[2]); b := sqrt(alpha/vp[1]); c := sqrt(a^2-b^2); print(X^2/a^2+Y^2/b^2 = 1);

This program works;. It is possible to simplify ? Thank you.

 

Please Wait...