views:

218

answers:

3

I have an equation which has been reduced to the form

eqn1 := f(x,y,z) = T;

Now I have another equation that involves T as a variable

eqn2 := g(T,x,y,z);

I want to replace T with f(x) in eqn2. If I had eqn1 in the form

eqn1better := T = f(x,y,z);

Then the following command would do what I want.

algsubs(eqn1better, eqn2);

So how do I swap the left-hand side and the right-hand side of an equation to turn eqn1 into eqn1better?

+2  A: 

Maple gives you the functions lhs and rhs, have you tried using them.

eqn1 := f(x,y,z) = T;
eqn1better := rhs(eqn1) = lhs(eqn1)
adamse
Nope, I was unaware of these functions. Your solution works, thanks!
cheshirekow
A: 

I stumbled upon another function to do what I want. It only works in the specific case of

eqn1 := f(x) = T

but using the isolate function will also solve the problem I have specified.

eqn1better := isolate(eqn1, T);

adamse's answer is better because it solves the general case of reversing any equation, regardless of whether or not one side is a single variable.

cheshirekow
A: 

To solve the bigger problem, you should consider eliminate. You can just to eliminate({eqn1,eqn2},T) and get as a result both the substitution and the result.

Jacques Carette