Hi,
When I am trying to solve my ODE system I get a LinearAlgebra.SingularException(1) error and I am not sure why or what I can do about it. Here is my system:
using DifferentialEquations
const Nc = 100
const L = 1.
const θ = 5.
const c0 = 1.
const λm = 0.4
const tissue = range(0,L,length = Nc)
m(x) = c0*exp(-x/λm)
σ(I) = 1/(1+exp(θ-θ*I))
function ode_system!(dg,g,p,t)
w, λg, = p
@inbounds for j in 1:Nc
x = tissue[j]
dg[1,j] = σ(w[1,1]*g[1,j]+ w[1,2]*g[2,j] + w[1,3]*g[3,j] + w[1,4]*m(x)) - λg[1]*g[1,j]
dg[2,j] = σ(w[2,1]*g[1,j]+ w[2,2]*g[2,j] + w[2,3]*g[3,j] + w[2,4]*m(x)) - λg[2]*g[2,j]
dg[3,j] = σ(w[3,1]*g[1,j]+ w[3,2]*g[2,j] + w[3,3]*g[3,j] + w[3,4]*m(x)) - λg[3]*g[3,j]
end
end
w_ex = [-3.43445 1.66673 -0.562781 1.20563;
0.0 0.626765 -0.782956 0.0;
-7.24169 -6.14532 0.0 0.0]
λg_ex = 0.05 .* ones(3)
p = (w_ex,λg_ex)
g0 = 0.01 .* ones(3,Nc)
prob = ODEProblem(ode_system!,g0,(0,Inf),p)
sol = solve(prob,AutoTsit5(Rosenbrock23()),isoutofdomain=(u,p,t) -> any(x -> x < 0, u), callback = TerminateSteadyState(1e-5,1e-3),maxiters = 1e3, verbose = false, save_everystep = false)
Any help would be appreciated.
Thanks