Differential equation Symbolics.jl output using Latexify.jl

jpg1
Tue, 28 Jan 2025 16:14:20 +0000
New to Julia

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!

2 posts - 2 participants