Search code examples
maxima

symbolically replace expressions in maxima


I'm having trouble finding out how to do this:

x=a+b
y=c+d
z=x*y

I would like the output to be

z=ac+ad+bc+bd

not

z=xy

Solution

  • Like this?

    (%i1) x: a+b;
    (%o1)                                b + a
    (%i2) y: c+d;
    (%o2)                                d + c
    (%i3) z: x*y;
    (%o3)                           (b + a) (d + c)
    (%i4) z: expand (z);
    (%o4)                        b d + a d + b c + a c
    (%i5) 
    

    Assignment in maxima is done by :, not = (which is used for checking for equality)