File:2020.03.10coronavirusForecastM.png

From TORI
Jump to navigation Jump to search

Original file(1,106 × 1,176 pixels, file size: 212 KB, MIME type: image/png)

Daily new cases of Coronavirus confirmed outside China mainland.

Pink bars: the experimental data by WorldMonitor.

Solid curves: the approximations with bells of various shapes and the forecast.

Description

Experimental data

C++ generator of curves

#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
int ado(FILE *O, int X, int Y)
{ fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%');
       fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y);
       fprintf(O,"/M {moveto} bind def\n");
       fprintf(O,"/L {lineto} bind def\n");
       fprintf(O,"/S {stroke} bind def\n");
       fprintf(O,"/s {show newpath} bind def\n");
       fprintf(O,"/C {closepath} bind def\n");
       fprintf(O,"/F {fill} bind def\n");
       fprintf(O,"/o {1 0 360 arc C F} bind def\n");
// fprintf(O,"/times-Roman-Bold findfont 20 scalefont setfont\n");
       fprintf(O,"/Helvetica-Bold findfont 2 scalefont setfont\n");
       fprintf(O,"/W {setlinewidth} bind def\n");
       fprintf(O,"/RGB {setrgbcolor} bind def\n");
return 0;
}
DB Gau(DB x) { x-=53.527; return 4.23628 + 67.8093*exp(-0.00416109*x*x);} // 174.593, 1.96973}
DB Seca(DB x){ x-=49.3091; return 3.18602 + 61.6406/cosh(0.13729*x);} //  164.2, 1.91021}
DB Lore(DB x){ x-=48.471; return 64.0383/(1. + 0.0120631*x*x);} //  188.91, 2.02651
DB Medi(DB x){DB a=0.584237 ; return a*Gau(x)+(1.-a)*Lore(x);} // , 159.902, 1.90634}
int main(){  DB x,y; int j,J,k,K,m,M,n,N,p,S; float d; FILE *i,*o; char c,s[99];
o=fopen("m17.eps","w");
ado(o,808,846);
#define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+x,0.+y); 
#define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+x,0.+y); 
fprintf(o,"%6.2f %6.2f o\n",0.+x,0.+y); 
fprintf(o,"2 2 translate 10 10 scale 1 setlinejoin\n");
DO(m,16){M(5*m,0)L(5*m,80)}
DO(n,9){M(0,10*n)L(75,10*n)}
fprintf(o,"0 0 0 RGB 2 setlinecap .1 W S\n");
float D[99]; int e0[99]; int f0[99]; DB f1[99];
//i=fopen("who.txt","r");
i=fopen("daily.txt","r");
e0[0]=0;
for(n=1;n<99;n++){
 j=fscanf(i,"%f%d",&d,&m); if(j<2) break;
 D[n]=d; f0[n]=m;
 fprintf(o,"%2d %5.2f %6d\n",n,D[n],f0[n]);
}
fclose(i);
N=n;
for(n=5;n<N;n+=5){ if(n<40) fprintf(o,"gsave %4.2f 55.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.0%4.02f)  show grestore\n",n-5.3,D[n]);
                       else fprintf(o,"gsave %4.2f 5.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.0%4.02f) show grestore\n",n-5.3,D[n]);
                       } 
e0[0]=0;  M=0;
for(n=1;n<N;n++) {M+=f0[n]; e0[n]=M; f1[n]=sqrt(double(f0[n]));}
for(n=0;n<N;n++) {printf("%2d %04.2f %6d %5d %7.3lf\n",n,D[n],e0[n],f0[n],f1[n]);}
n=50; fprintf(o,"gsave %4.2f 5.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.03.10) show grestore\n",n-5.3);
n=55; fprintf(o,"gsave %4.2f 5.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.03.15) show grestore\n",n-5.3);
n=60; fprintf(o,"gsave %4.2f 5.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.03.20) show grestore\n",n-5.3);
n=65; fprintf(o,"gsave %4.2f 55.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.03.25) show grestore\n",n-5.3);
n=70; fprintf(o,"gsave %4.2f 55.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.03.30) show grestore\n",n-5.3);
// M(0,0) for(n=1;n<N;n++) L(n,f1[n]);
for(n=1;n<N;n++) {y=f1[n]; M(n,y-1.5)L(n,y+1.5)};
fprintf(o,"1 0 1 RGB 1 setlinecap .8 W S\n");
M(0,Gau(0)); for(n=1;n<82;n++) L(n,Gau(n))  fprintf(o,".9 0 0 RGB 1 setlinecap .3 W S\n");
M(0,Seca(0));for(n=1;n<82;n++) L(n,Seca(n))  fprintf(o,"0 .7 0 RGB 1 setlinecap .3 W S\n");
M(0,Lore(0));for(n=1;n<82;n++) L(n,Lore(n))  fprintf(o,"0 0 .8 RGB 1 setlinecap .3 W S\n");
M(0,Medi(0));for(n=1;n<82;n++) L(n,Medi(n))  fprintf(o,"0 0 0 RGB 1 setlinecap .3 W S\n");
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
     system("epstopdf m17.eps");
     system( "open m17.pdf");
}

Latex generator of labels

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{color}
%\definecolor{pink}{RGB}{255,127,255}
%\paperwidth 620pt
%\paperheight 870pt
\paperwidth 800pt
\paperheight 850pt
\textwidth 800pt
\textheight 1200pt
\topmargin -108pt
\oddsidemargin -72pt
\newcommand \ing {\includegraphics}
\newcommand \sx {\scalebox}
\newcommand \rot {\begin{rotate}}
 \newcommand \ero {\end{rotate}}
\pagestyle{empty}
\begin{document}
 \parindent 0pt
 %\sx{1}[.9]{\begin{picture}(530,830)
 {\begin{picture}(730,836)
 \put(30,10){\ing{m17.pdf}}
 %\put(  0,815){\sx{1.7}{$\sqrt{n}$}} \put(60,817){\sx{1.7}{$n$, number of new cases}}
 \put(8,815){\sx{2.1}{$y$}} \put(56,820){\sx{1.7}{$n\!=\!y^2$, number of new cases}}
 \put(4,707){\sx{2}{70}} \put(33,707){\sx{1.7}{4900}}
 \put(4,607){\sx{2}{60}} \put(33,607){\sx{1.7}{3600}}
 \put(4,507){\sx{2}{50}} \put(33,507){\sx{1.7}{2500}}
 \put(4,407){\sx{2}{40}} \put(33,407){\sx{1.7}{1600}}
 \put(4,307){\sx{2}{30}} \put(33,307){\sx{1.7}{~900}}
 \put(4,207){\sx{2}{20}} \put(33,207){\sx{1.7}{~400}}
 \put(4,107){\sx{2}{10}} \put(33,107){\sx{1.7}{~100}}
 \put(4,07){\sx{2}{~0}} 
 \put(26,-7){\sx{2}{0}} 
 \put(120,-7){\sx{2}{10}} 
 \put(221,-7){\sx{2}{20}} 
 \put(321,-7){\sx{2}{30}} 
 \put(421,-7){\sx{2}{40}} 
 \put(521,-7){\sx{2}{50}} 
 \put(621,-7){\sx{2}{60}} 
 %\put(521,-7){\sx{2}{70}} 
 %\put(575,-7){\sx{2}{$t$,days}} 
 \put(735,-7){\sx{2}{$t$,days}} 
 \put(524,738){\rot{-4}\sx{3}{$y\!=\!\mathrm{Gau}(t)$}\ero}
 \put(560,678){\rot{-65}\sx{3}{$y\!=\!\mathrm{Medi}(t)$}\ero}
 \put(618,420){\rot{-74}\sx{3}{$y\!=\!\mathrm{Seca}(t)$}\ero}
 \put(578,358){\rot{-75}\sx{3}{$y\!=\!\mathrm{Lore}(t)$}\ero}
 \end{picture}}
\end{document}

References

https://www.worldometers.info/coronavirus/coronavirus-cases/ Outside of China 2020.03.10

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:21, 10 March 2020Thumbnail for version as of 22:21, 10 March 20201,106 × 1,176 (212 KB)T (talk | contribs)

There are no pages that use this file.

Metadata