1

I use sympy latex to print an equation in the latex...

My question is , can I specify the order of the terms printed?

for example:

from sympy import *
import random
x = symbols('@x')
y = symbols('@y')
st0 = latex(c*y**2+b*x*y+a*x**2)
print(st0)

the result of print was:

7 @x^{2} - 9 @x @y + 3 @y^{2}

what I'd like to do is display it the order I wrote it, like that:

3 @y^{2} - 9 @x @y + 7 @x^{2}

Is there a way around that?

Reblochon Masque
  • 35,405
  • 10
  • 55
  • 80
M Ezzat
  • 11
  • 2

0 Answers0