Skip to content

Error trying modelingtoolkitize for single equation ODE #1004

@ricfrod

Description

@ricfrod

Hello! I've been dabbling with ModelingToolkit.jl for a few days and was putting together a presentation for my thesis advisors when I encountered this error:

f(x,p,t) = 0.98x
x0 = 1.0
tspan = (0.0,1.0)
prob = ODEProblem(f,x0,tspan)
sys = modelingtoolkitize(prob)

MethodError: no method matching similar(::Float64, ::Type{Num})
Closest candidates are:
  similar(::Union{LinearAlgebra.Adjoint{T, var"#s832"}, LinearAlgebra.Transpose{T, var"#s832"}} where {T, var"#s832"<:(AbstractVector{T} where T)}, ::Type{T}) where T at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:230
  similar(::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}, ::Type{T}) where T at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:234
  similar(::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}, ::Type{T}, ::Tuple{Vararg{Int64, N}}) where {T, N} at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:235
  ...

I know it's a simple system, but I was surprised to find this problem. Other attempts for systems of multiple ODEs worked fine before this. Am I missing something?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions