Search code examples
symbolic-mathmaxima

How to combine expressions in Maxima?


Following is MACSYMA expressions

eq1: a*x - b*y = 0;
eq2: c*x +d*z = 0;
eq3: y+z = 0;

subst([eq1,eq2],[eq3]);

I am expecting result as a/b = c/d after cancelling common x.

But I did not get expected result. And MACSYMfl also has trouble cancelling a common term from right and left hand sides.

How does one get around this?


Solution

  • IIUC, what you want is to solve eq1 for y, eq2 for z, and substitute those values into eq3. If I do that by hand, I get

    (%i14) solve(a*x-b*y=0,y);
    
                                            a x
    (%o14)                             [y = ---]
                                             b
    (%i15) solve(c*x+d*z=0,z);
    
                                             c x
    (%o15)                            [z = - ---]
                                              d
    (%i16) %o14+%o15;
    
                                           a x   c x
    (%o16)                        [z + y = --- - ---]
                                            b     d
    

    And since z+y = 0, a*x/b-c*x/d is zero, which produces your desired a/b=c/d.

    One way of doing this is to use eliminate:

    (%i24) eliminate([eq1,eq2,eq3],[y,z]);
    (%o24)                         [- (b c - a d) x]
    

    Setting this to zero gives b*c-a*d is zero, which is equivalent to your expected a/b=c/d.