Question: Replacing and expression with a variables

Hello all,

I am trying to replace an expression with a variable using the algsubs command. Basically I have a vector evecA1 where I want to replace everywhere the expression rho*c^2/(gamma-1)*(1/rho)+(1/2)*u^2 occurs by the variable H.  I will post my code so you can see what i was trying to do. Any help is appreciated.

F := [q2, q2^2/q1+(gamma-1)*(q3-q2^2/(2*q1)), q3*q2/q1+(gamma-1)*(q3-q2^2/(2*q1))*q2/q1];
Q := [q1, q2, q3];

with(VectorCalculus);
A := Jacobian(F, Q);

A := subs(q1 = rho, q2 = rho*u, q3 = rho*e, A);
A := subs(e = P/(rho*(gamma-1))+(1/2)*u^2, A);
A := subs(P = rho*c^2/gamma, A);
A := simplify(A);
with(LinearAlgebra);
evalsA := simplify(Eigenvalues(A));
with(LinearAlgebra);
evecA1 := Eigenvectors(A);

algsubs(rho*c^2/(gamma-1)*(1/rho)+(1/2)*u^2 = H, evecAI);

 

Please Wait...