## Mathematical Modeling and Simulation of Diamond Princess

The mathematical model is described by the following equations

`#include `
#include
usingnamespace std;
intmain()
{
// files
ofstream susceptible, infected;
susceptible.open("Susceptible.txt");
infected.open("Infected.txt");
// Define the number of people in the curise
int N =3711;
// Define the time-step
float dt =1.0f; // 1 day
// Define the alpha value
float alpha =0.1f; // so 1/alpha = 3
// Define the number of days for the study
constint days =150; // 150 days
// We need to calculate the value of R0
// Inside Diamond Princess cruise, the numbers of infected went from 1 to 621 in 31 days
float R0 =3.231f;
float beta = alpha * R0 /static_cast(N);
std::cout <<"Alpha: "<< alpha << std::endl;
std::cout <<"beta: "<< beta << std::endl;
std::cout <<"R0: "<< R0 << std::endl << std::endl;
// Now, define the initial conditions for S and I
float S, I, R, T;
float Snew, Inew;
S = N-1; // 0 susceptible persons at day 0
I =1; // 1 infected person at day 0
R =0;
T = R + I;
// Now, start the simulations
int day =1;
/*
ANSWERS:
1) For alpha = 1/3, R must be 1.6103
2) For alpha = 1/6, R0 must be 2.298
3) for alpha = 1/10, R0 must be 3.231
// For alpha = 1/3, the day at which the number of infected reached a max was at day 39 with a total of 329 infected
// For alpha = 1/6, the day at which the number of infected reached a max was at day 42 with a total of 790 infected
// For alpha = 1/10, the day at which the number of infected reached a max was at day 44 with a total of 1267 infected
For alpha = 1/6, the earliest date that it would be safe to allow all the passengers to disembark is at day 104, when there are no more infected
// The chance of being susceptible is calculated as the number of remaining susceptible persons, divided
// by the total number of passengers
For alpha = 1/3, the chance of being susceptible after the number if infected is zero is: 33.93%
For alpha = 1/6, the chance of being susceptible after the number if infected is zero is: 12.72%
For alpha = 1/10, the chance of being susceptible after the number if infected is zero is: 3.98%
*/
susceptible <(S) << endl;
infected <(I) << endl;
std::cout <<"Day\t Susceptible\t Infected\t Recovered\t\tI+R"<< std::endl;
std::cout <<"------------------------------------------------------------------"<< std::endl;
std::cout <<0<<"->\t|\t"<< (int)S <<"\t|\t"<< (int)I <<"\t|\t"<< (int)R <<"\t|\t"<< (int)T << std::endl;
for (int i =0; i < days; i++)
{
Snew= S - beta * I*S;
Inew = I + beta * I*S - alpha * I;
R = N - Snew - I;
T = R + I;
std::cout << day <<"->\t|\t"<< (int)Snew <<"\t|\t"<< (int)Inew <<"\t|\t"<< (int)R <<"\t|\t"<< (int)T;
if (day ==31)
cout <<" **";
cout << endl;
susceptible <(Snew) << endl;
infected <(Inew) << endl;
S = Snew;
I = Inew;
day++;
}
susceptible.close();
infected.close();
}