Force SymPy to keep the order of terms

前端 未结 3 888
南笙
南笙 2020-12-20 15:15

I have the following code:

from sympy import *
init_printing()

x,y = symbols(\'x y\')
u = Function(\'u\')(x,y)
ux,uy,uxx,uxy,uyy = symbols(\"u_x u_y u_xx u_         


        
3条回答
  •  粉色の甜心
    2020-12-20 15:34

    Sadly, SymPy does not keep track of the input order (see the other question I linked in a comment on the question). You can define your own ordering function that orders expressions however you want, but there's no way to order things exactly as they were input, since that information isn't saved.

提交回复
热议问题