Search code examples
maxima

Prevent evaluation of the sum of two vectors while still displaying the vectors in Maxima


I am trying to achieve the following in Maxima (to be precise: I am using STACK for Moodle which uses Maxima):

v1:matrix([1],[0],[0]);
v2:matrix([0],[1],[0]);
v3:r*v1+s*v2;

I now want the summation in v3 not to be evaluated while still the previously defined vectors v1 and v2 to be substituted in, that is for my output I want to have something like

   [1]   [0]
 r*[0]+s*[1]
   [0]   [0]

While I can suppress the evaluation of the sum using

v3:'(r*v1+s*v2)

this results in

rv1+sv2

Is there a way to achieve that?

If it helps:

 [r] [0]
 [0]+[s]
 [0] [0]

would also be ok for the output.


Solution

  • v1:matrix([1],[0],[0]);
    v2:matrix([0],[1],[0]);
    simp:false$
    v3:r*v1+s*v2;
    simp:true$
    

    This will do fine in Maxima, in STACK it seems that for some reason the

    simp:true$
    

    can't be used because it will also simplify everything again. So I just moved everything I do not want to be simplified to the bottom of the code. Also the notation in stack would be

    simp:false;
    

    since $ can't be used.