问题描述:

I want to rewrite Integral of `10x^7-xy+y/x+2x^5`

as sum of integrals.

Something like

`Int(10x^7-xy+y/x+2x^5) = Int(10x^7)-Int(xy)+Int(y/x)+Int(2x^5)`

But sympy makes its own ordering and outputs

`Int(10x^7-xy+y/x+2x^5) = Int(2x^5)+Int(10x^7)+Int(y/x)-Int(xy)`

Where can I override this behaviour if Int is my own class?

This behaviour is deeply engraved into sympy and you won't be able to override it by making your own class of `Integral`

.

From the Sympy docs:

Finally, one last note. You may have noticed that the order we entered our expression and the order that it came out from

`srepr`

or in the graph were different [...] This because in SymPy, the arguments of the commutative operations`Add`

and`Mul`

are stored in an arbitrary (but consistent!) order, which is independent of the order inputted.

So, similar to a native python dictionary, the elements are in an arbitrary but consistent order. There is no easy way to change this.