You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it grammatical to construct a system of differential equations in this way? What does this error mean?
function eee!(u, p, t)
x, y = u
a,b,c = p
for i=2:1:99
dx[i] = ax[i-1]+(i+1)x[i+1]-by[i]
dy[i] = (i+1)y[i+1]-iy[i]-cy[i]+bx[i]
end
end
using DifferentialEquations
u1 = []
u2 = []
for i =1:100
push!(u1,0)
push!(u2,0)
end
tspan = (0.0, 20.0)
p = [0.2, 0.04, 20]
u0=[u1,u2]
prob = ODEProblem(eee!, u0, tspan,p)
solve(prob)
ERROR: MethodError: no method matching oneunit(::Type{Any})
Closest candidates are:
oneunit(::Type{Union{Missing, T}}) where T
@ Base missing.jl:105
oneunit(::Type{T}) where T
@ Base number.jl:370
oneunit(::T) where T
@ Base number.jl:369
...
The text was updated successfully, but these errors were encountered:
Your issue here is that you don't have a Number element type, you have an array of arrays, which is non-concrete. I recommend turning that array of arrays into a type that has a valid interpretation as a vector, such as as a VectorOfArray from RecursiveArrayTools, or a ComponentArray via ComponentArrays.jl.
Is it grammatical to construct a system of differential equations in this way? What does this error mean?
function eee!(u, p, t)
x, y = u
a,b,c = p
for i=2:1:99
dx[i] = ax[i-1]+(i+1)x[i+1]-by[i]
dy[i] = (i+1)y[i+1]-iy[i]-cy[i]+bx[i]
end
end
using DifferentialEquations
u1 = []
u2 = []
for i =1:100
push!(u1,0)
push!(u2,0)
end
tspan = (0.0, 20.0)
p = [0.2, 0.04, 20]
u0=[u1,u2]
prob = ODEProblem(eee!, u0, tspan,p)
solve(prob)
ERROR: MethodError: no method matching oneunit(::Type{Any})
Closest candidates are:
oneunit(::Type{Union{Missing, T}}) where T
@ Base missing.jl:105
oneunit(::Type{T}) where T
@ Base number.jl:370
oneunit(::T) where T
@ Base number.jl:369
...
The text was updated successfully, but these errors were encountered: