Reputation: 73
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.
Upvotes: 1
Views: 1436
Reputation: 153
An alternate answer: you can also set Maxima (and STACK-Moodle) to display in canonical ordering (rather than its default reverse canonical ordering) by setting powerdisp:true.
Upvotes: 0
Reputation: 622
Actually, I think ordergreat() is the function you need, maybe you did a sorting before that needed unorder() first ro reset things. Try
unorder()$ ordergreat (h, c)$ E=(h*c)/%lambda;
and
unorder()$ ordergreat (c, h)$ E=(h*c)/%lambda;
Upvotes: 2
Reputation: 73
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.
Upvotes: 2