# Defining a function then using it in DSolve

Probably a pretty simple question but I've been stumped for awhile looking around. I'm trying to solve four diff. eq.'s using DSolve and some of these equations depend on a function B[t] which I try to define before using it in DSolve. I'm sure my problem has to do with this B[t] function but I'm too new to Mathematica to know what to do. Here's my code:

bZero = 1575.0
bOne = 0.28
u = 0.02
a = 1/0.0279
g = 1/0.01
B[t_] = (bZero*(1 + (bOne*Cos[2*Pi*t])))
DSolve[{(u - (B[t]*Inf[t]*S[t]) - (u*S[t])) ==
S'[t], ((B[t]*Inf[t]*S[t]) - ((a + u)*Expo[t])) ==
Expo'[t], ((a*Expo[t]) - ((g + u)*Inf[t])) ==
Inf'[t], ((g*Inf[t]) - (u*R[t])) == R'[t]}, {S[t], Expo[t], Inf[t],
R[t]}, t]


And the output:

DSolve[{0.02 - 0.02 S[t] -
1575. (1 + 0.28 Cos[2 \[Pi] t]) Inf[t] S[t] ==
Derivative[S][t], -35.8623 Expo[t] +
1575. (1 + 0.28 Cos[2 \[Pi] t]) Inf[t] S[t] ==
Derivative[Expo][t],
35.8423 Expo[t] - 100.02 Inf[t] == Derivative[Inf][t],
100. Inf[t] - 0.02 R[t] == Derivative[R][t]}, {S[t], Expo[t],
Inf[t], R[t]}, t]


Something just isn't working. It's not popping up any errors or anything. I realize it's probably a simple question, but any help is appreciated. Thanks!

• Do you have initial conditions? – Dr. belisarius Mar 17 '15 at 5:56

If DSolve can't solve it, it returns unevaluated. NDSolve can solve it, but need some IC. Here is an example

bZero = 1575.0;
bOne = 0.28;
u = 0.02;
a = 1/0.0279;
g = 1/0.01;
B[t_] := bZero (1 + bOne Cos[2 Pi t]);
eq1 = u - B[t] Inf[t] S[t] - u S[t] == S'[t]
eq2 = B[t]*Inf[t] S[t] - (a + u) Expo[t] == Expo'[t]
eq3 = a Expo[t] - (g + u) Inf[t] == Inf'[t]
eq4 = g Inf[t] - u R[t] == R'[t]
NDSolve[{eq1, eq2, eq3, eq4, S == 1, Expo == 4,
Inf == 3, R == 5}, {S[t], Expo[t], Inf[t], R[t]}, {t, 0, 10}] I tried the analytical dsolve in Maple 2015, and it generated 2 solutions.

restart;
bZero := 1575.0;
bOne := 0.28;
u := 0.02;
a := 1/0.0279;
g := 1/0.01;
B:= t-> (bZero*(1 + (bOne*cos(2*Pi*t))));
eq1 := u - B(t)* Inf(t)* S(t) - u* S(t) =diff(S(t),t);
eq2 := B(t)*Inf(t)* S(t) - (a + u)* Expo(t) = diff(Expo(t),t);
eq3 := a* Expo(t) - (g + u)* Inf(t) = diff(Inf(t),t);
eq4 := g *Inf(t) - u* R(t) = diff(R(t),t);
sol:=dsolve({eq1,eq2,eq3,eq4},{S(t),Expo(t),Inf(t),R(t)});

sol; The second one is too large to post. I am not sure why DSolve could not solve it analytically or if even Maple solution is correct, but you can verify these now and see. Notice that 2 solutions are trivial in the above.