# Solving differential equation gives complex number

Posted 8 months ago
1013 Views
|
2 Replies
|
1 Total Likes
|
 Differential Equation Modeling a DiseaseI have been trying to sole the following IVP but get an answer with complex solutions although ALL the parameters are real. eq = i'[t] + (\[Gamma] + \[Mu] - \[Lambda]) i[t] == -\[Lambda] i[t]^2 DSolve[{eq, i == i0}, i[t], t] How should I use the fact that all parameters are real as is i and t ? Thank you Attachments: Answer
2 Replies
Sort By:
Posted 8 months ago
 The solution uses complex numbers, but its values are real and correct: sol1 = DSolveValue[{eq, i == i0}, i, t] FullSimplify[{eq, i == i0} /. i -> sol1] Block[{\[Gamma] = 1, \[Mu] = 1, \[Lambda] = 1, i0 = 1}, Plot[sol1[t], {t, 0, 1}]] You can get an expression that uses only real objects this way: sol = DSolveValue[eq, i, t] param = Solve[sol == i0, C, Reals] mySol[t_] = FullSimplify[ sol[t] /. param[] /. ConditionalExpression -> (#1 &)] Simplify[{eq, i == i0} /. i -> mySol] Answer
Posted 7 months ago
 Dear Gianluca Giorni, Thank you so much. Answer