Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oneunit(::Type{Any} #1003

Open
Li-shiyue opened this issue Nov 28, 2023 · 1 comment
Open

oneunit(::Type{Any} #1003

Li-shiyue opened this issue Nov 28, 2023 · 1 comment
Labels

Comments

@Li-shiyue
Copy link

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]-i
y[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
...

@ChrisRackauckas
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants