some of you know that I have been working on my dissertation of Game-Theoretic Modelling of Cybersecurity (Thank you again to everyone who has helped me with Mathematica so far).

The differential equation I have been trying to solve is $\frac{\mathrm{d}x(t) }{\mathrm{d} t} = cv_{H} (1-x) + \beta x(1-x) - (\gamma_{min} + v_{D}(\gamma_{max} - \gamma_{min}))x$. with the following conditions.

$\beta < \gamma_{max}$ : Contact Transmission Rate less than maximum recovery rate.

$v_{D}, v_{H} \in [0,1]$: Strategies of both players in [0,1]

$c, \beta, \gamma_{min}, \gamma_{max} > 0$: All parameters positive.

This is the code I have used to gain the solution $x(t)$:

sol = FullSimplify [x[t] /. DSolve[
x'[t] == c*v1*(1 - x[t]) + b*x[t]*(1 - x[t]) - (ymin + v2*(ymax - ymin))*x[t], x[t], 

and the answer returned is:

(1/(2b))(b - c*v1 - v2*ymax + (-1 + v2)*ymin + 
Sqrt[-b^2 + 
2b (-c*v1 + v2*ymax + ymin - v2 ymin) - (c*v1 + v2*ymax + ymin - v2*ymin)^2]
Tan[(1/2)*Sqrt[-b^2 + 2b(-c*v1 + v2*ymax + ymin - v2*ymin) - (c*v1 + v2*ymax + 
    ymin - v2*ymin)^2] (-t + C[1])])

But the issue is, for certain values of $v_{H}, v_{D} \in [0,1]$, the output returned by $x(t, v_{H}, v_{D})$ is a complex number - and that doesn't make any sense in this context.

Is there any way I could specify the conditions I have stated and/or find a way not to produce a complex number? (Caused by the expression inside the sqrt, obviously). My supervisor has told me that it should not be complex.


Let Reduce try to find the conditions that make your square root Real.

Reduce[-b^2+2 b (-c v1+v2 ymax+ymin-v2 ymin)-(c v1+v2 ymax+ymin-v2 ymin)^2>0
  && 0<b<ymax && 0<v2<1 && 0<v1<1 && c>0 && ymax>0 && ymin>0, {b,c,ymax,ymin,v1,v2}]

That should return a perhaps complicated boolean combination of conditions which satisfy your requirement.

Yet that returns


Is there anything incorrect in those conditions given to Reduce?

Substituting random values, within your described domain, for your variables and trying a few hundred times always seems to produce a negative result.

Something is wrong.

  • $\begingroup$ Apologies, there is also $\gamma_{max} > \gamma_{min}$, I shall just try that now $\endgroup$ – AlistairLR112 Jan 14 '16 at 22:56
  • $\begingroup$ hmm, still false. If it is any help, here is the research paper $\endgroup$ – AlistairLR112 Jan 14 '16 at 23:19
  • $\begingroup$ @AlistarLR112 In section 4 of his paper he seems to start with dx(t)/dt==c vH x(t)(1-x(t)) while you seem to start with dx(t)/dt==c vH (1-x(t)). That is where I would start looking. $\endgroup$ – Bill Jan 14 '16 at 23:56
  • $\begingroup$ That's because the strategies $v_{H}$ and $v_{D}$ are functions of $x(t)$ $\endgroup$ – AlistairLR112 Jan 15 '16 at 8:34
  • $\begingroup$ @AlistairLR112 Have you informed Mathematiica that vH and vD are functions of x(t) and what those functions are? Or is it supposed to know that without being told? Or did those just not get included in your question? I'm confused. $\endgroup$ – Bill Jan 15 '16 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.