Use LaTeX Symbols in Simplex Expressions

I would like to do some calculations and then print them using sympy. I want to use sequential notation, so I need to define the character to be printed as $ \ Delta_l ^ y $.

What I have tried so far:

delta__i_0 = sympy.symbols('Delta__i_0')
sympy.pprint(delta__i_0)

      

which works great. Unfortunately,

delta__y_l = sympy.symbols('Delta__y_l')
sympy.pprint(delta__y_l)

      

doesn't really look pretty. Any ideas?

+3


source to share


1 answer


In the Python interpreter, from the command line, you can use sympy.printing.latex

. For example,

import sympy as sym
import sympy.printing as printing
delta__y_l = sym.symbols('Delta__y_l')
print(printing.latex(delta__y_l))

      

prints



\Delta^{y}_{l}

      


Or, using IPython notebook, call sym.init_printing()

to enable pretty-typing: enter image description here

+6


source







All Articles