Skip to content

Instantly share code, notes, and snippets.

@rezamarzban
Created February 15, 2024 10:14
Show Gist options
  • Save rezamarzban/d27a5ba2e806999615146cfc72d5ae12 to your computer and use it in GitHub Desktop.
Save rezamarzban/d27a5ba2e806999615146cfc72d5ae12 to your computer and use it in GitHub Desktop.
LaTeX output of sympy formulas
from sympy import *
from sympy.printing.mathml import mathml
init_printing(use_unicode=True) # allow LaTeX printing
# independent variables
x, y, z = symbols('x y z', real = True)
# parameters
nu, rho = symbols('nu rho', real = True, constant = True, positive = True)
# dependent variables
u, v, w = symbols('u v w', real = True, cls = Function)
print(latex(diff(u(x,y,z),x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment