Hello,

I'm trying to solve a system of ODE in a model of infectious disease. But, unfortunately, when I try to plot the curves, I get the following error message: Error, (in fproc) unable to store '-1.*HFloat(0.0)[1]' when datatype=float[8]. The code is here

restart;

with(plots);

Q := 1000; a := .9; b := 0.8e-3; mu := 0.247e-2; k := .2; y := 0.2e-1; e := .5; g := .5; T := 8; n := 100;

sigma[1] := 0.5e-1; sigma[2] := 0.9e-1; alpha[1] := 0.52e-2; alpha[2] := 0.52e-2; delta[1] := .8; delta[2] := .904; delta[3] := .8; c[1] := 50; c[2] := 250; c[3] := 50; w[1] := 140; w[2] := 130; w[3] := 150; w[4] := 160;

u[1] := min(max(0, z), 1); z := (a*i[p](t)*(i[p](t)+i[pm](t))*(lambda[4](t)-lambda[3](t))+a*s(t)*(i[p](t)+i[pm](t))*(lambda[1](t)-lambda[2](t)))/(n.w[1]); u[2] := min(max(0, c), 1); c := (b*(i[m](t)+i[pm](t))*s(t)*(lambda[3](t)-lambda[1](t))+b*(i[m](t)+i[pm](t))*i[p](t)*(lambda[4](t)-lambda[2](t)))/(n.w[2]); u[3] := min(max(0, j), 1); j := (i[p](t)*lambda[2](t)+i[pm](t)*(lambda[4](t)-lambda[7](t))-(i[p](t)+i[pm](t))*lambda[5](t))/w[3]; u[4] := min(max(0, o), 1); o := (i[m](t)*lambda[3](t)-i[pm](t)*(lambda[4](t)-lambda[7](t))-(i[m](t)+i[pm](t))*lambda[6](t))/w[4]; u[2] := 0; u[3] := 0;

;

sys := diff(s(t), t) = Q+delta[1]*r[p](t)+delta[2]*r[m](t)+delta[3]*r[pm](t)-(a*(1-u[1])*(i[p](t)+i[pm](t))/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+mu)*s(t), diff(i[p](t), t) = (1-u[1])*a*(i[p](t)+i[pm](t))*s(t)/n-(1-u[2])*b*(i[m](t)+i[pm](t))*i[p](t)/n-(sigma[1]+u[3])*i[p](t)-(alpha[1]+mu)*i[p](t), diff(i[m](t), t) = (1-u[2])*b*(i[m](t)+i[pm](t))*s(t)/n-(1-u[1])*a*(i[p](t)+i[pm](t))*i[m](t)/n-(sigma[2]+u[4])*i[m](t)-(alpha[2]+mu)*i[m](t), diff(i[pm](t), t) = (1-u[2])*b*(i[m](t)+i[pm](t))*i[p](t)/n+(1-u[1])*a*(i[p](t)+i[pm](t))*i[m](t)/n-(y+u[3]+u[4])*i[pm](t)-(alpha[1]+alpha[2]+mu)*i[pm](t), diff(r[p](t), t) = (sigma[1]+u[3])*i[p](t)+(e*y+u[3])*i[pm](t)-(delta[1]+mu)*r[p](t), diff(r[m](t), t) = (sigma[2]+u[4])*i[m](t)+(y*g*(1-e)+u[4])*i[pm](t)-(delta[2]+mu)*r[m](t), diff(r[pm](t), t) = (y*(1-g)*(1-e)+u[3]+u[4])*i[pm](t)-(delta[3]+mu)*r[pm](t), diff(lambda[1](t), t) = lambda[1](t)*(a*(1-u[1])*(i[p](t)+i[pm](t))/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+mu)-lambda[2](t)*(1-u[1])*a*(i[p](t)+i[pm](t))/n-lambda[3](t)*(1-u[2])*b*(i[m](t)+i[pm](t))/n, diff(lambda[2](t), t) = -c[1]+lambda[1](t)*(1-u[1])*a*s(t)/n-lambda[2](t)*((1-u[1])*a*s(t)/n+b*(1-u[2])*(i[m](t)+i[pm](t))/n+sigma[1]+u[3]+alpha[1]+mu)-lambda[4](t)*(b*(1-u[2])*(i[m](t)+i[pm](t))/n+(1-u[1])*a*i[m](t)/n)-lambda[5](t)*(sigma[1]+u[3]), diff(lambda[3](t), t) = -c[2]+lambda[1](t)*(1-u[2])*b*s(t)/n+lambda[2](t)*(1-u[2])*b*i[p](t)/n-lambda[3](t)*(u[4]+alpha[2]+sigma[2]+a*(1-u[1])*(i[p](t)+i[pm](t))/n-(1-u[2])*b*s(t)/n)-lambda[4](t)*((1-u[2])*b*i[p](t)/n+a*(1-u[1])*(i[p](t)+i[pm](t))/n)-lambda[6](t)*(sigma[2]+u[4]), diff(lambda[4](t), t) = -c[3]+lambda[1](t)*((1-u[1])*a*s(t)/n+(1-u[2])*b*s(t)/n)-lambda[2](t)*((1-u[2])*b*i[p](t)/n+(1-u[1])*a*s(t)/n)-lambda[2](t)*((1-u[2])*a*i[m](t)/n+b*(1-u[1])*s(t)/n)-lambda[4](t)*(y+u[3]+u[4]+alpha[1]+alpha[2]+mu-(1-u[2])*b*i[p](t)/n-b*(1-u[1])*i[m](t)/n)-lambda[5](t)*(e*y+u[3])-lambda[6](t)*(y*g*(1-e)+u[4])-lambda[7](t)*(y*(1-g)*(1-e)+u[3]+u[4]), diff(lambda[5](t), t) = -lambda[1](t)*delta[1]+lambda[5](t)*(delta[1]+mu), diff(lambda[6](t), t) = -lambda[1](t)*delta[2]+lambda[6](t)*(delta[2]+mu), diff(lambda[7](t), t) = -lambda[1](t)*delta[3]+lambda[7](t)*(delta[3]+mu), i[p](0) = 300, i[m](0) = 200, i[pm](0) = 150, r[p](0) = 200, r[m](0) = 150, r[pm](0) = 150, s(0) = 1000, lambda[1](T) = 0, lambda[2](T) = 0, lambda[3](T) = 0, lambda[4](T) = 0, lambda[5](T) = 0, lambda[6](T) = 0, lambda[7](T) = 0;

p1 := dsolve({sys}, type = numeric, method = bvp[midrich], abserr = 0.1e-5, maxmesh = 2400);

Error, (in fproc) unable to store '-1.*HFloat(0.0)[1]' when datatype=float[8]

p2o := odeplot(p1, [t, i[p](t)], 0 .. 3, numpoints = 100, labels = ["Time (Months)", " Population"], labeldirections = [horizontal, vertical], style = line, color = green, axes = boxed);

Can anyone help me please? I read some related problems here, but couldnt find a solution yet.

Thanks for your time

Best regards