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.

I want to remove the term XY

f:=(x,y)->2*x²+xy+y²+4x-y-2=0;

eq := simplify(subs(x = X-9/7, y = Y+8/7, f(x, y)));

theta:=Pi/8;

ex := simplify(subs(X = cos(theta)*X-sin(theta)*Y, Y = sin(theta)*X+cos(theta)*Y, eq)); evalf(%);

How to obtain (3+sqrt(2))/2*X²+(3-sqrt(2))/2=36 ? Thank you.

restart; _local(D);
A := [-L, 0]; B := [L, 0]; C := [x, y]; D := [-x, y];
Dist := proc (X, Y) options operator, arrow; sqrt((X[1]-Y[1])^2+(X[2]-Y[2])^2) end proc;
Eq := (Dist(C, D) = Dist(C, B))^2;
centre := [solve(diff(Eq, x), x), solve(diff(Eq, y), y)];
with(geometry); `assuming`([conic(p, Eq, [x, y])], [L > 0]);
detail(p); asymptotes(p);
y_acymp := `~`[solve](`~`[Equation](asymptotes(p)), y);
y := solve(Eq, y)[1]
P := proc (X, L0)
local Curve, Asymptote, Trapezoid, T, pt, Ip;
Curve := plot(eval([y, -y], L = L0), x = -(1/3)*L0 .. 15, color = red, thickness = 3);
Asymptote := plot(eval([-sqrt(3)*x-(1/3)*sqrt(3)*L, sqrt(3)*x+(1/3)*sqrt(3)*L], L = L0), x = -(1/3)*L0 .. 15, linestyle = 3, color = black, thickness = 0); Trapezoid := plottools:-polygon(eval([A, B, C, D], [L = L0, x = X]), color = "LightGreen");
Ip := (1/3)*(eval(C, [x = X-(1/3)*L0, L = L0])); #centre of gravity of ABC
T := plots:-textplot([[(eval(A, [x = X, L = L0]))[], "A"], [(eval(B, [x = X, L = L0]))[], "B"], [(eval(C, [x = X, L = L0]))[], "C"], [(eval(D, [x = X, L = L0]))[], "D"], [Ip[], "I"]], align = {above, left}, font = [TIMES, 16]);
pt := plot([A, B, C, Ip], style = plottools:-point, color = blue, symbolsize = 15);
plots:-display(Curve, Asymptote, Trapezoid, T, pt, scaling = constrained, size = [400, 800]) end proc;
a := 7;
P((1/2)*a, 6)
I would like of location of centre of gravity of ABC. Thank you.

I know how to contruct an isoscele ABCD trapeze knowing the 2L length of AB and BC=CD=CD=a. But I don't know answer to that question : L being fixed together with points A and B , show that the place of C when a varies is a branch of hyberbola. Here is my code.

restart; unprotect(O, D);

with(plots):

Vdot := proc (U, V) add(U[i]*V[i], i = 1 .. 2) end:

dist := proc (M, N) sqrt(Vdot(expand(M-N), expand(M-N))) end:

_EnvHorizontalName := x: _EnvVerticalName := y:

O:=[0,0]:A:=[-L,0]:alpha:=arccos((2*L-a)^2/(2*a*(2*L-a))):h:=tan(alpha)*(2*L-a)/2:

B:=[L,0]:C:=[L-(2*L-a)/2,h]:D:=[-L+(2*L-a)/2,h]:

L := 6; a := 7;

poly := [A, B, C, D, A];tp := textplot([[A[], "A"], [B[], "B"], [C[], "C"], [D[], "D"]], color = black, 'align' = {'above', 'right'});

trapeze := polygonplot(poly, axes = normal, color = "DarkGreen", transparency = .9);

display([tp, trapeze], scaling = constrained); Thank you foryour help.

We consider an ellipse E defined by the equation x²/a²+y²/b²=1. Either F1 and F2 its foci.

We consider a point M of E such the angle F1,M,F2 is equal to a given value phi.

Find F1M et F2M in function of a, b and phi . Then find the coordiinates x0 and y0 of M in function of a, b, and phi. Here is the begining of my code;

restart;

_EnvHorizontalName := x: _EnvVerticalName := y:

with(plots):

line := proc (x1, y1, x2, y2) options operator, arrow; (x-x1)*(y2-y1)-(y-y1)*(x2-x1) end proc:

Vdot := proc (U, V) add(U[i]*V[i], i = 1 .. 2) end proc:

dist := proc (M, N) sqrt(Vdot(expand(M-N), expand(M-N))) end proc:

ell := x^2/a^2+y^2/b^2 = 1:

c := sqrt(a^2-b^2):

F1 := [c, 0]: F2 := [-c, 0]:

M := [a*cos(t), b*sin(t)]:

MF2 := simplify(expand(sqrt((c+a*cos(t))^2+(b*sin(t))^2)));

MF1 := simplify(expand(sqrt((c-a*cos(t))^2+(b*sin(t))^2)));

varphi := arccos((MF1^2+MF2^2-4*c^2)/(2*MF1*MF2));

f := unapply(varphi, t);

`maxϕ` := f((1/2)*Pi);

diff(f(t), t);

a := 7: b := 5: t := (1/3)*Pi:

evalf(varphi);

evalf(MF1); evalf(dist(M, F1));

evalf(MF2); evalf(dist(M, F2));

MF1+MF2; evalf(%);

`maxϕ`; evalf(%);

ELL := implicitplot(ell, x = -a-2 .. a+2, y = -2-b .. b+2, color = blue):

tp := textplot([[F1[], "F1"],[F2[],"F2"],[M[],"M"]], 'align' = {'above', 'left'}):

po := plot([F1,F2, M], style = point, symbolsize = 15, symbol = solidcircle, color = red):

display([ELL, tp, po], scaling = constrained): Would you help me to answer the questions ? Thank you.