Prevent Sympy from rearranging the equation

后端 未结 2 1157
攒了一身酷
攒了一身酷 2020-12-04 01:40

Perhaps im overlooking the obvious but how do you prevent sympy from rearranging equations?

Im using Sympy in the iPython notebook so i can easily copy-paste the Lat

2条回答
  •  萌比男神i
    2020-12-04 02:08

    If you want the arguments of a product to appear in a given order you can create a Mul from those args and then tell the printer that you don't want them reordered as shown here for an Add. So for your example you could do

    >>> var('epsilon, sigma, T')
    (epsilon, sigma, T)
    >>> this = Mul(epsilon, sigma, T**4, evaluate=False)
    >>> StrPrinter({'order':'none'})._print_Mul(this)
    epsilon*sigma*T**4
    

提交回复
热议问题