Spaceman98
Spaceman98

Reputation: 9

Error using Latexify.jl: type LotkaVolterra has no field funcs

I'm trying to follow along with this tutorial https://www.youtube.com/watch?v=KPEqYtEd-zY and I encounter the error "type LotkaVolterra has no field funcs" when I run the latexalign function.

I installed ParameterizedFunctions as described here https://github.com/SciML/DiffEqDocs.jl/issues/340 but that did not solve this issue.

I am using Jupyter and I have installed the latest version of Latexify.

using DifferentialEquations
using Plots; gr()
using ParameterizedFunctions
using Latexify

lv! = @ode_def LotkaVolterra begin
    dx = a*x -b*x*y
    dy = -c*y + d*x*y
end a b c d
u0 = [1.0,1.0]
p = (1.5, 1.0, 3.0, 1.0)
tspan = (0.0, 10.0)
prob = ODEProblem(lv!, u0, tspan, p)
sol = solve(prob)
plot(sol)
latexalign(lv!)
print(latexalign(lv!))
display(lv!.Jex)

Upvotes: -1

Views: 50

Answers (1)

Chris Rackauckas
Chris Rackauckas

Reputation: 19132

That tutorial is just old. Things are much simpler now. Just call latexify on it:

using ParameterizedFunctions, Latexify

lotka_volterra = @ode_def begin
    dx = a*x -b*x*y
    dy = -c*y + d*x*y
end a b c d

latexify(lotka_volterra)

gives:

L"\begin{align}
\frac{\mathrm{d} x\left( t \right)}{\mathrm{d}t} =& a x\left( t \right) - b x\left( t \right) y\left( t \right) \\
\frac{\mathrm{d} y\left( t \right)}{\mathrm{d}t} =&  - c y\left( t \right) + d x\left( t \right) y\left( t \right)
\end{align}
"

Upvotes: 1

Related Questions