How to order variables in Maxima?

让人想犯罪 __ 提交于 2019-12-11 12:59:02

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!