Differential equation Symbolics.jl output using Latexify.jl

Hi! Enjoying using Julia greatly so far. I’ve been learning to use Symbolics.jl for differential equations, and rendering the output with Latexify.jl.

However, I was wondering if it was possible to get the latexify output to read more like standard Leibniz notation… To illustrate:

using Symbolics, Latexify

@variables x y
Dx = Differential(x)
Dxxx = Differential(x)^3

eq = Dxxx(y) + Dx(y)

latexify(eq)

This creates the output:

\begin{equation} \frac{\mathrm{d}}{\mathrm{d}x} y + \frac{\mathrm{d}}{\mathrm{d}x} \frac{\mathrm{d}}{\mathrm{d}x}\frac{\mathrm{d}}{\mathrm{d}x} y \end{equation}

Whereas, I’d prefer to have the output read something like:

\begin{equation} \frac{\mathrm{d}y}{\mathrm{d}x} + \frac{\mathrm{d}^3y}{\mathrm{d}x^3} \end{equation}

I’m still new to this so I’ve probably misunderstood something! I’m assuming it’s just due to the way symbols work… but is there a way to automatically tidy up this kind of math output?

Thank you!

You’re doing the symbolic side right. We just haven’t set that up in the symbolic latex generation yet. Someone would need to make this function smarter:

1 Like