maxima

How to order variables in Maxima?


I want to give variables a specific order in an equation in Maxima. This is display purposes only.

For example:

(%i1) E=(h*c)/%lambda;
                                c h
(%o1)                     E = -------
                              %lambda

I want the h and c variables to be in that order when displayed. I looked at ratvars() and ordergreat() but they don't appear to be relevant here.

Thanks for your help.


Solution

  • It appears that declare(<var>, mainvar) was what I was looking for. When mainvar attribute is declared for a variable it "succeeds all other constants and variables".

    I was trying this using the STACK plugin for Moodle. I needed to remove the mainvar keyword from the forbidden list in the file casstring.class.php.