@ in function declartion

Hi, I am currently going through the DifferentialEquations documentation and am trying to run an example. Unfortunately, I am failing to achieve liftoff:

f = @ode_def_nohes LotkaVolterraTest begin
  dx = a*x - b*x*y
  dy = -c*y + d*x*y
end a=>1.5 b=1.0 c=3.0 d=1.0

u0 = [1.0;1.0]
tspan = (0.0,10.0)
prob = ODEProblem(f,u0,tspan)

Gives:

UndefVarError: @ode_def_nohes not defined

I don’t really understand this type of function declaration, so I am not sure how to tweak it appropriately (besides just rewriting the DE in the “standard” way).

Any explanations would be greatly appreciated.

Thanks,

DS

Generally, @ denotes a macro. However, if you are new to Julia, I would suggest leaving metaprogramming for later, and just focusing on this specific macro. I think that the @ode_def macros are defined in

https://github.com/JuliaDiffEq/ParameterizedFunctions.jl

but note that the new recommended approach is

https://github.com/JuliaDiffEq/ModelingToolkit.jl

I imagine that docs are in the process of being updated.

2 Likes

Thanks, Tamas_Papp. Hopefully this will clear things up for me.

Appreciate it,

DS