Convert math model to latex

Hello,
I have a model based on a set of ordinary differential equations, wrapped in a function. Is it possible to convert it into latex?

For instance,

function X!(du, u, p, t)
    A = p[:a]   # parameter a
    B = p[:b]   # parameter b

    du[1] = (A*u[1]*(1/B)
    du[2] = (B*u[2]*(1/A)
end

Thank you

If you can define it using ParameterizedFunctions’ @ode_def, then the Latexify package can convert that into nice-looking LaTeX. See the Readme section and the docs page.

2 Likes

And if you want to roll your own, you can do

using Latexify 
@latexify du = [A/B B/A]*u

or

@latexify [du_1, du_2] = [A*u_1/B, B*u_2/A]
3 Likes