问题
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.
回答1:
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.
回答2:
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;
来源:https://stackoverflow.com/questions/36456544/how-to-order-variables-in-maxima