File:2020.03.12wFit.png

From TORI
Revision as of 08:32, 15 March 2020 by T (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Original file(1,162 × 1,452 pixels, file size: 248 KB, MIME type: image/png)

Data about the coronavirus by CoronavirusWho [1], daily new cases outside China and and the approximations from 2020.03.12; at the moment of fitting, the datum for 2020.03.12 is not yet available

Description

Assuming that the random statistical deviation of number \(n\) of cases is of order of \( \sqrt{n} \), quantify \( y = \sqrt{n} \) is chosen as ordinate axis. So, all the "error bars" are of the same length.

The four thick curves represent the approximations from 2020.03.12:

{3.3258 + 70.9632 E^(-0.00329804 (-56.3936 + x)^2), 240.057, 2.28443}

{2.09163 + 64.2955 Sech[0.121898 (-51.6063 + x)], 246.714, 2.31589}

{64.9087/(1 + 0.0110225 (-50.1457 + x)^2), 303.508, 2.54119}

{0.809398 (3.3258 + 70.9632 E^(-0.00329804 (-56.3936 + x)^2)) + 12.3717/(1 + 0.0110225 (-50.1457 + x)^2), 236.332, 2.26664}

They are denoted wG, wS, wL and wM, respectively.

The thin black curve shows the exponential approximation adjusted 2020.03.14:

y = 1.18209*exp(0.0833794*x)

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 wE(DB x){return 1.18209*exp(0.0833794*x);} //                           498.839, 3.19067}
DB wE(DB x){return 1.109772*exp(0.0829075*x);} //                          , 495.713, 3.08755}
DB wG(DB x){ x-=56.3936; return 3.3258 + 70.9632*exp(-0.00329804*x*x);} // 240.057, 2.28443
DB wS(DB x){ x-=51.6063; return 2.09163 + 64.2955/cosh(0.121898*x);}    // 246.714, 2.31589
DB wL(DB x){ x-=50.1457; return 64.9087/(1 + 0.0110225*x*x);}          //, 303.508, 2.54119
DB wM(DB x){ DB a=0.809398; return a*wG(x) + (1.-a)*wL(x);}            // 236.332, 2.26664} 
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("20w.eps","w");
//o=fopen("20200312w.eps","w");
ado(o,808,1046);
#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,100)}
DO(n,11){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");
N=0; e0[0]=0;
for(k=1;k<99;k++){
 j=fscanf(i,"%d%f%d",&n,&d,&m); if(j<3) break;
 printf("%2d n=%2d d=%5.2f m=%5d ",k,n,d,m);
 j=fscanf(i,"%s",s); printf(" %10s",s);
 j=fscanf(i,"%c",&c); printf(" %c",c);
 j=fscanf(i,"%c",&c); printf(" %c",c);
 j=fscanf(i,"%d",&p); printf("%5d ",p);
 fgets(s,99,i);
 printf("%s",s);
if(n>0 && n<99) { D[n]=d; e0[n]=m; if(n>N) N=n;}
// fprintf(o,"%2d %5.2f %6d\n",n,D[n],e0[n]);}
}
fclose(i); N++;
for(n=5;n<N; n+=5) { if(n<40) fprintf(o,"gsave %4.2f 25.2 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.2 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; for(n=1;n<N;n++) {f0[n]=e0[n]-e0[n-1]; f1[n]=sqrt(double(f0[n]));}
for(n=1;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.2 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.2 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.2 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  5.2 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);
n=75; fprintf(o,"gsave %4.2f 55.5 translate 90 rotate 0 -6 M 0 0 0 RGB (2020.04.04) show grestore\n",n-5.3);
// M(0,0) for(n=1;n<50;n++) L(n,f1[n]);
for(n=1;n<52;n++) {y=f1[n]; M(n,y-1.5)L(n,y+1.5)};
fprintf(o,"0 1 0 RGB 1 setlinecap .8 W S\n");
M(0,wG(0)); for(n=1;n<82;n++) L(n,wG(n)) fprintf(o,".8 0 0 RGB .4 W S\n");
M(0,wS(0)); for(n=1;n<82;n++) L(n,wS(n)) fprintf(o,"0 .7 0 RGB .4 W S\n");
M(0,wL(0)); for(n=1;n<82;n++) L(n,wL(n)) fprintf(o,"0 0 .8 RGB .4 W S\n");
M(0,wM(0)); for(n=1;n<82;n++) L(n,wM(n)) fprintf(o,"0 0 0 RGB .4 W S\n");
for(n=52;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,wE(0)); for(n=1;n<82;n++){L(n,wE(n)); if(wE(n)>100.) break;} fprintf(o,"0 0 0 RGB .1 W S\n");
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
     system("epstopdf 20w.eps");
     system( "open 20w.pdf");
}

Latex generator of labels

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{color} 
%\definecolor{pink}{RGB}{255,127,255}
\paperwidth 840pt
\paperheight 1050pt
\textwidth 900pt
\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}(530,1036)
 \put(30,10){\ing{20w.pdf}} 
 %\put(30,10){\ing{20200312w}}
 %\put(30,10){\ing{2020.03.11w.pdf}}
 %\put(  0,815){\sx{1.7}{$\sqrt{n}$}} \put(60,817){\sx{1.7}{$n$, number of new cases}}
 %\put(8,830){\sx{2.1}{$y$}} \put(56,826){\sx{1.7}{$n\!=\!y^2$, number of new cases outside China by Who}}
 \put(8,1020){\sx{2.2}{$y$}} \put(56,1020){\sx{1.7}{$n\!=\!y^2$, number of new cases outside China by Who}}
 \put(4,907){\sx{2}{90}} \put(33,907){\sx{1.7}{8100}}
 \put(4,807){\sx{2}{80}} \put(33,807){\sx{1.7}{6400}}
 \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(721,-7){\sx{2}{70}} 
 %\put(575,-7){\sx{2}{$t$,days}} 
 \put(775,-7){\sx{2}{$t$,days}} 
 \put(696,600){\rot{-72}\sx{3}{$y\!=\!\mathrm{G}(t)$}\ero}
 \put(652,540){\rot{-74}\sx{3}{$y\!=\!\mathrm{M}(t)$}\ero}
 \put(620,460){\rot{-74}\sx{3}{$y\!=\!\mathrm{S}(t)$}\ero}
 \put(592,388){\rot{-79}\sx{3}{$y\!=\!\mathrm{L}(t)$}\ero}
 \end{picture}}
\end{document}

References

File history

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

Date/TimeThumbnailDimensionsUserComment
current08:31, 15 March 2020Thumbnail for version as of 08:31, 15 March 20201,162 × 1,452 (248 KB)T (talk | contribs)add thin curve
12:52, 14 March 2020Thumbnail for version as of 12:52, 14 March 20201,162 × 1,314 (227 KB)T (talk | contribs)

The following 3 pages use this file:

Metadata