ModelingToolkit.jl: ERROR: LoadError: UndefVarError: Sym not defined

I’m just getting started with SciML and am looking at ModelingToolkit.jl. The macros work:

@variables x y

But in docs there is a macro free usage . The above code should also be equivalent to:

x = Num(Sym{Float64}(:x))
y = Num(Sym{Float64}(:y))

but then I get an error:

ERROR: LoadError: UndefVarError: Sym not defined

What am I missing? Thanks for the help.

Instead use:

x = (Variable{Number}(:x))()
y = (Variable{Number}(:y))()

Found this using @macroexpand

What version? Seems like a really old version (though things are moving fast right now)

Sorry for slow reply,
Julia Version 1.4.2
ModelingToolkit v3.20.1

Yes it was @variables back then. I would highly recommend using the latest Julia if you’re using ModelingToolkit.jl since it’s still under very active development. It’s on v5 now so you were just reading different version documentation than what you were using.

Thank you. Will do