Question: how to solve a set of equations for a ratio in terms of variables involved?

April 06 2014 nm 415

0

This is better explained with simple example. Suppose I have these 2 equations

a:='a';b:='b';x:='x';
eqs:=[3*a+4*b = 3*x, 5*a+7*b = 7*x];

What I want is to solve for (a/x) and (b/x) from the above, and not for "a" and "b".

Currently, I do this manually as follows. First divide both equations by 'x' to obtain the ratio. I had to do this manually as writing eqs/x gave expression which was hard to work with for what I want to do. I could not simplify it for what I wanted. So I typed this

eqs2:=[3*(a/x)+4*(b/x)=3,5*(a/x)+7*(b/x)=7];   %manually typed !

Now used algsubs to replace (a/x) by new variable z1, and replace (b/x) by new variable z2, then solve for z1,z2 (btw, I had to do algsubs one at a time. (need to look at this later, but not impotant)

algsubs(a/x=z1,eqs2);
algsubs(b/x=z2,%);
solve(%,{z1,z2});

       {z1=-7,z2=6}

Is there a way or function(s) to automate this. The hard part is telling Maple to use the ratio as new variable starting from set of equations.

Please Wait...