Difference between revisions of "File:Linea.jpg"
Jump to navigation
Jump to search
(there was description from another figure.. Sorry..) |
|||
| Line 1: | Line 1: | ||
| ⚫ | |||
| − | == Summary == |
||
| ⚫ | |||
| − | Density \(F(t)\) of likelihood of the mean |
+ | Density \(F(t)\) of likelihood of the mean duration \(\bar D\) to have value \(t\) |
| − | evaluates with 5 examples from article [[Duration5]] |
+ | evaluates with 5 examples from article [[Duration5]]. |
| − | |||
| − | The figure is prepared for article [[Duration5]]. |
||
Input file: |
Input file: |
||
| Line 18: | Line 15: | ||
==Generator== |
==Generator== |
||
<pre> |
<pre> |
||
| + | |||
#include <stdio.h> |
#include <stdio.h> |
||
#include <math.h> |
#include <math.h> |
||
| Line 25: | Line 23: | ||
int main(){ int n,N=5; FILE *i,*o; |
int main(){ int n,N=5; FILE *i,*o; |
||
int Y1,M1,D1; |
int Y1,M1,D1; |
||
| − | int Y2,M2,D2; char s[N][4]; int D[N]; float d[N]; |
+ | int Y2,M2,D2; char s[N][4]; int D[N],Ya[N],Yb[N]; float d[N]; //L[N] |
float t, p,q,r,x,y,T,U,W; |
float t, p,q,r,x,y,T,U,W; |
||
| Line 32: | Line 30: | ||
{ |
{ |
||
fscanf(i,"%4d %2d %2d %4d %2d %2d %3s", &Y1,&M1,&D1, &Y2,&M2,&D2, s[n]); |
fscanf(i,"%4d %2d %2d %4d %2d %2d %3s", &Y1,&M1,&D1, &Y2,&M2,&D2, s[n]); |
||
| − | D[n]=daju24(Y2,M2,D2) - daju24(Y1,M1,D1) ; t=D[n]/365.2422; d[n]=t; L[n]=log2(t); |
+ | D[n]=daju24(Y2,M2,D2) - daju24(Y1,M1,D1) ; t=D[n]/365.2422; d[n]=t; // L[n]=log2(t); |
| + | Ya[n]=Y1; |
||
| ⚫ | |||
| + | Yb[n]=Y2; |
||
| ⚫ | |||
} fclose(i); |
} fclose(i); |
||
| − | p=0.; for(n=0;n<N;n++) p+= |
+ | p=0.; for(n=0;n<N;n++) p+=d[n]; p/=N; printf("p=%5.2f\n",p); |
| − | q=0.; for(n=0;n<N;n++) {r= |
+ | q=0.; for(n=0;n<N;n++) {r=d[n]-p; q+=r*r;} |
T=sqrt(q/(N-1.)); printf("T=%5.2f\n",T); |
T=sqrt(q/(N-1.)); printf("T=%5.2f\n",T); |
||
U=sqrt(q/(N*(N-1.))); printf("U=%5.2f\n",U); |
U=sqrt(q/(N*(N-1.))); printf("U=%5.2f\n",U); |
||
W=sqrt(q/(N*(N-3.))); printf("W=%5.2f\n",W); |
W=sqrt(q/(N*(N-3.))); printf("W=%5.2f\n",W); |
||
| − | o=fopen(" |
+ | o=fopen("Linea.tex","w"); |
fprintf(o,"\\documentclass{standalone}\n"); |
fprintf(o,"\\documentclass{standalone}\n"); |
||
fprintf(o,"\\usepackage{graphicx}\n"); |
fprintf(o,"\\usepackage{graphicx}\n"); |
||
| Line 48: | Line 48: | ||
//fprintf(o,"\\newcommand \\sx {\\scalebox}\n"); |
//fprintf(o,"\\newcommand \\sx {\\scalebox}\n"); |
||
fprintf(o,"\\begin{document}\n"); |
fprintf(o,"\\begin{document}\n"); |
||
| − | fprintf(o,"\\ |
+ | fprintf(o,"\\Huge\n"); |
| − | + | fprintf(o,"\\begin{tikzpicture}[scale=2]\n"); |
|
| − | fprintf(o,"\\ |
+ | fprintf(o,"\\draw [line width=0.981] (0,0) grid (24,4);\n"); |
| − | fprintf(o,"\\draw [line width= |
+ | fprintf(o,"\\draw [line width=2.3] (0,4.4) -- (0,0) -- (24.1,0) ;\n"); |
| − | fprintf(o,"\\draw [line width=2.3] (0,2.2) -- (0,0) -- (6.1,0) ;\n"); |
||
// fprintf(o,"\\draw(0,0) -- (0,3.2) ;\n"); |
// fprintf(o,"\\draw(0,0) -- (0,3.2) ;\n"); |
||
| ⚫ | |||
fprintf(o,"\\definecolor{light}{rgb}{1,1,.6};\n"); |
fprintf(o,"\\definecolor{light}{rgb}{1,1,.6};\n"); |
||
fprintf(o,"\\definecolor{dark}{rgb}{0,1,1};\n"); |
fprintf(o,"\\definecolor{dark}{rgb}{0,1,1};\n"); |
||
| − | fprintf(o,"\\draw[line width= |
+ | fprintf(o,"\\draw[line width=32, light] (8,0.03) -- (8,3.8) ;\n"); |
| − | + | fprintf(o,"\\draw (8,0.8) node[rotate=90,right] {\\bf Russia 2028};\n"); |
|
| − | fprintf(o,"\\draw ( |
+ | fprintf(o,"\\draw[line width=32, light] (22,0.03) -- (22,3.8) ;\n"); |
| − | fprintf(o,"\\draw |
+ | fprintf(o,"\\draw(22,0.8) node[rotate=90,right] {\\bf Moscow 2042};\n"); |
| ⚫ | |||
for(n=0;n<N;n++) |
for(n=0;n<N;n++) |
||
{ |
{ |
||
| − | fprintf(o,"\\draw[line width= |
+ | fprintf(o,"\\draw[line width=24, dark] (%5.3f,0.03) -- (%5.3f,3.3) ;\n",d[n], d[n]); |
| − | fprintf(o,"\\draw (%5.3f, |
+ | fprintf(o,"\\draw (%5.3f,3.2) node[rotate=90,left] {\\bf %s %4d-%4d};\n",d[n],s[n],Ya[n],Yb[n]); |
printf("%1d %s\n",n,s[n]); |
printf("%1d %s\n",n,s[n]); |
||
} |
} |
||
| − | fprintf(o,"\\ |
+ | for(n=0;n<5;n+=2) fprintf(o,"\\draw (0,%d) node[left] {%3.1f};\n",n,0.05*n); |
| − | fprintf(o,"\\draw ( |
+ | for(n=0;n<24;n++) fprintf(o,"\\draw (%d,0) node[below] {%d};\n",n,n); |
| − | + | fprintf(o,"\\draw (%d,0) node[below] {$t$};\n",n); |
|
| − | for(n=0;n<6;n++) fprintf(o,"\\draw (%d,0) node[below] {%d};\n",n,n); |
||
| ⚫ | |||
| − | |||
| − | int m=1; |
||
| − | //for(n=0;n<7;n++){ fprintf(o,"\\draw (%d,-.2 node[below] {%d};\n",n,m); m*=2;} |
||
| − | for(n=0;n<6;n++) {fprintf(o,"\\draw (%d,-0.2) node[below] {%d};\n",n,m); m*=2;} |
||
| − | fprintf(o,"\\draw (%d,-0.2) node[below] {$t$, y.};\n",n); |
||
fprintf(o,"\\draw[line width=5, red] (0,0)"); |
fprintf(o,"\\draw[line width=5, red] (0,0)"); |
||
| − | for(n=1;n< |
+ | for(n=1;n<241;n+=2){x=.1*n; y=20*Student(N-1,(x-p)/U)/U; fprintf(o," -- (%6.3f,%6.3f)",x,y);} |
fprintf(o,";\n"); |
fprintf(o,";\n"); |
||
//fprintf(o,"\\input \"Labels.tex\"\n"); |
//fprintf(o,"\\input \"Labels.tex\"\n"); |
||
| Line 88: | Line 80: | ||
fprintf(o,"\\end{document}\n"); |
fprintf(o,"\\end{document}\n"); |
||
fclose(o); |
fclose(o); |
||
| − | system("pdflatex |
+ | system("pdflatex Linea.tex"); |
| − | system("open |
+ | system("open Linea.pdf"); |
//system("convert Linear.pdf png8:Linear8.png"); |
//system("convert Linear.pdf png8:Linear8.png"); |
||
//system("convert Linear.pdf Linear.jpg"); |
//system("convert Linear.pdf Linear.jpg"); |
||
| + | //system("open Linear.jpg"); |
||
| ⚫ | |||
| − | printf(" |
+ | printf("p=0.; for(n=0;n<N;n++) p+=d[n]; p/=N; resulling p=%8.6f\n",p); |
| ⚫ | |||
printf("T=sqrt(q/(N-1.)) = %8.6f\n",T); |
printf("T=sqrt(q/(N-1.)) = %8.6f\n",T); |
||
printf("U=sqrt(q/(N*(N-1.))) = %8.6f\n",U); |
printf("U=sqrt(q/(N*(N-1.))) = %8.6f\n",U); |
||
printf("W=sqrt(q/(N*(N-3.))) = %8.6f\n",W); |
printf("W=sqrt(q/(N*(N-3.))) = %8.6f\n",W); |
||
| − | printf("g(d)=student%d((d-%8.6f)/%8.6f)/%6.6f\n",N |
+ | printf("g(d)=student%d((d-%8.6f)/%8.6f)/%6.6f\n",N,p,U,U); |
| − | printf("sqrt(T*T+W*W)=%8.6f \n",sqrt(T*T+W*W)); |
+ | printf("sqrt(T*T+W*W)=%8.6f years\n",sqrt(T*T+W*W)); |
| − | printf("p-sqrt(T*T+W*W))=%8.6f \n",p-sqrt(T*T+W*W) ); |
+ | printf("p-sqrt(T*T+W*W))=%8.6f years\n",p-sqrt(T*T+W*W) ); |
| − | printf("p+sqrt(T*T+W*W))=%8.6f \n",p+sqrt(T*T+W*W) ); |
+ | printf("p+sqrt(T*T+W*W))=%8.6f years\n",p+sqrt(T*T+W*W) ); |
| − | printf("p-2*sqrt(T*T+W*W))=%8.6f \n",p-2*sqrt(T*T+W*W) ); |
+ | printf("p-2*sqrt(T*T+W*W))=%8.6f years\n",p-2*sqrt(T*T+W*W) ); |
| − | printf("p+2*sqrt(T*T+W*W))=%8.6f \n",p+2*sqrt(T*T+W*W) ); |
+ | printf("p+2*sqrt(T*T+W*W))=%8.6f years\n",p+2*sqrt(T*T+W*W) ); |
| − | printf("2^p=%8.6f\n",pow(2.,p)); |
||
| − | printf("2^(p-2*sqrt(T*T+W*W)))=%8.6f \n",pow(2.,p-2*sqrt(T*T+W*W)) ); |
||
| − | printf("2^(p-sqrt(T*T+W*W)))=%8.6f \n",pow(2.,p-sqrt(T*T+W*W)) ); |
||
| − | printf("2^(p+sqrt(T*T+W*W)))=%8.6f \n",pow(2.,p+sqrt(T*T+W*W)) ); |
||
| − | printf("2^(p+2*sqrt(T*T+W*W)))=%8.6f \n",pow(2.,p+2*sqrt(T*T+W*W)) ); |
||
| − | |||
} |
} |
||
</pre> |
</pre> |
||
| Line 114: | Line 101: | ||
==Output text== |
==Output text== |
||
<pre> |
<pre> |
||
| − | Output written on |
+ | Output written on Linea.pdf (1 page, 35730 bytes). |
| − | Transcript written on |
+ | Transcript written on Linea.log. |
| + | 1653 12 16 1661 04 23 eng 2685 7.3513 |
||
| − | |||
| − | + | 1802 08 04 1815 11 20 fra 4856 13.2953 |
|
| ⚫ | |||
| − | 1802 08 04 1815 11 20 fra 4856 13.2953 3.7328 |
||
| + | 1933 03 24 1945 05 08 ger 4428 12.1235 |
||
| ⚫ | |||
| − | + | 1977 10 07 1991 08 20 sov 5065 13.8675 |
|
| + | p=13.25 |
||
| − | 1977 10 07 1991 08 20 sov 5065 13.8675 3.7936 |
||
| − | + | T= 4.39 |
|
| − | + | U= 1.96 |
|
| − | + | W= 2.77 |
|
| − | W= 0.32 |
||
0 eng |
0 eng |
||
1 fra |
1 fra |
||
| Line 131: | Line 117: | ||
3 ger |
3 ger |
||
4 sov |
4 sov |
||
| − | p=0.; for(n=0;n<N;n++) p+= |
+ | p=0.; for(n=0;n<N;n++) p+=d[n]; p/=N; resulling p=13.249838 |
| − | q=0.; for(n=0;n<N;n++) {r= |
+ | q=0.; for(n=0;n<N;n++) {r=d[n]-p; q+=r*r;} resulting q=76.917809 |
| − | T=sqrt(q/(N-1.)) = |
+ | T=sqrt(q/(N-1.)) = 4.385140 |
| − | U=sqrt(q/(N*(N-1.))) = |
+ | U=sqrt(q/(N*(N-1.))) = 1.961094 |
| − | W=sqrt(q/(N*(N-3.))) = |
+ | W=sqrt(q/(N*(N-3.))) = 2.773406 |
| − | g(d)=student4((d- |
+ | g(d)=student4((d-13.249838)/1.961094)/1.961094 |
| − | sqrt(T*T+W*W)= |
+ | sqrt(T*T+W*W)=5.188568 years |
| − | p-sqrt(T*T+W*W))= |
+ | p-sqrt(T*T+W*W))=8.061270 years |
| − | p+sqrt(T*T+W*W))= |
+ | p+sqrt(T*T+W*W))=18.438406 years |
| − | p-2*sqrt(T*T+W*W))=2. |
+ | p-2*sqrt(T*T+W*W))=2.872703 years |
| − | p+2*sqrt(T*T+W*W))= |
+ | p+2*sqrt(T*T+W*W))=23.626972 years |
| − | 2^p=12.636883 |
||
| − | 2^(p-2*sqrt(T*T+W*W)))=5.475622 |
||
| − | 2^(p-sqrt(T*T+W*W)))=8.318341 |
||
| − | 2^(p+sqrt(T*T+W*W)))=19.197436 |
||
| − | 2^(p+2*sqrt(T*T+W*W)))=29.163958 |
||
</pre> |
</pre> |
||
| − | |||
| − | ==Warning== |
||
| ⚫ | |||
==Output Latex== |
==Output Latex== |
||
<pre> |
<pre> |
||
| + | \documentclass{standalone} |
||
\usepackage{graphicx} |
\usepackage{graphicx} |
||
\usepackage{tikz} |
\usepackage{tikz} |
||
\begin{document} |
\begin{document} |
||
| ⚫ | |||
| − | \Large |
||
| − | \begin{tikzpicture}[scale= |
+ | \begin{tikzpicture}[scale=2] |
| − | \draw [line width=0.981] (0,0) grid ( |
+ | \draw [line width=0.981] (0,0) grid (24,4); |
| − | \draw [line width=2.3] (0, |
+ | \draw [line width=2.3] (0,4.4) -- (0,0) -- (24.1,0) ; |
| ⚫ | |||
\definecolor{light}{rgb}{1,1,.6}; |
\definecolor{light}{rgb}{1,1,.6}; |
||
\definecolor{dark}{rgb}{0,1,1}; |
\definecolor{dark}{rgb}{0,1,1}; |
||
| − | \draw[line width= |
+ | \draw[line width=32, light] (8,0.03) -- (8,3.8) ; |
| − | \draw ( |
+ | \draw (8,0.8) node[rotate=90,right] {\bf Russia 2028}; |
| − | \draw[line width= |
+ | \draw[line width=32, light] (22,0.03) -- (22,3.8) ; |
| − | \draw( |
+ | \draw(22,0.8) node[rotate=90,right] {\bf Moscow 2042}; |
| − | \draw[line width= |
+ | \draw[line width=24, dark] (7.351,0.03) -- (7.351,3.3) ; |
| − | \draw ( |
+ | \draw (7.351,3.2) node[rotate=90,left] {\bf eng 1653-1661}; |
| − | \draw[line width= |
+ | \draw[line width=24, dark] (13.295,0.03) -- (13.295,3.3) ; |
| − | \draw ( |
+ | \draw (13.295,3.2) node[rotate=90,left] {\bf fra 1802-1815}; |
| − | \draw[line width= |
+ | \draw[line width=24, dark] (19.612,0.03) -- (19.612,3.3) ; |
| − | \draw ( |
+ | \draw (19.612,3.2) node[rotate=90,left] {\bf ita 1928-1947}; |
| − | \draw[line width= |
+ | \draw[line width=24, dark] (12.123,0.03) -- (12.123,3.3) ; |
| − | \draw ( |
+ | \draw (12.123,3.2) node[rotate=90,left] {\bf ger 1933-1945}; |
| − | \draw[line width= |
+ | \draw[line width=24, dark] (13.868,0.03) -- (13.868,3.3) ; |
| − | \draw ( |
+ | \draw (13.868,3.2) node[rotate=90,left] {\bf sov 1977-1991}; |
| ⚫ | |||
| ⚫ | |||
| − | \draw ( |
+ | \draw (0,2) node[left] {0.1}; |
| − | \draw (0, |
+ | \draw (0,4) node[left] {0.2}; |
| ⚫ | |||
| ⚫ | |||
\draw (0,0) node[below] {0}; |
\draw (0,0) node[below] {0}; |
||
\draw (1,0) node[below] {1}; |
\draw (1,0) node[below] {1}; |
||
| Line 188: | Line 166: | ||
\draw (4,0) node[below] {4}; |
\draw (4,0) node[below] {4}; |
||
\draw (5,0) node[below] {5}; |
\draw (5,0) node[below] {5}; |
||
| − | \draw (6,0) node[below] { |
+ | \draw (6,0) node[below] {6}; |
| − | \draw ( |
+ | \draw (7,0) node[below] {7}; |
| − | \draw ( |
+ | \draw (8,0) node[below] {8}; |
| − | \draw ( |
+ | \draw (9,0) node[below] {9}; |
| − | \draw ( |
+ | \draw (10,0) node[below] {10}; |
| − | \draw ( |
+ | \draw (11,0) node[below] {11}; |
| − | \draw ( |
+ | \draw (12,0) node[below] {12}; |
| − | \draw ( |
+ | \draw (13,0) node[below] {13}; |
| + | \draw (14,0) node[below] {14}; |
||
| − | \draw[line width=5, red] (0,0) -- (0.0100,0.0000) -- (0.0300,0.0000) -- (0.0500,0.0001) -- (0.0700,0.0001) -- (0.0900,0.0001) -- (0.1100,0.0001) -- (0.1300,0.0001) -- (0.1500,0.0001) -- (0.1700,0.0001) -- (0.1900,0.0001) -- (0.2100,0.0001) -- (0.2300,0.0001) -- (0.2500,0.0001) -- (0.2700,0.0001) -- (0.2900,0.0001) -- (0.3100,0.0001) -- (0.3300,0.0001) -- (0.3500,0.0001) -- (0.3700,0.0001) -- (0.3900,0.0001) -- (0.4100,0.0001) -- (0.4300,0.0001) -- (0.4500,0.0001) -- (0.4700,0.0001) -- (0.4900,0.0001) -- (0.5100,0.0001) -- (0.5300,0.0001) -- (0.5500,0.0001) -- (0.5700,0.0001) -- (0.5900,0.0001) -- (0.6100,0.0001) -- (0.6300,0.0001) -- (0.6500,0.0001) -- (0.6700,0.0001) -- (0.6900,0.0001) -- (0.7100,0.0001) -- (0.7300,0.0001) -- (0.7500,0.0001) -- (0.7700,0.0002) -- (0.7900,0.0002) -- (0.8100,0.0002) -- (0.8300,0.0002) -- (0.8500,0.0002) -- (0.8700,0.0002) -- (0.8900,0.0002) -- (0.9100,0.0002) -- (0.9300,0.0002) -- (0.9500,0.0002) -- (0.9700,0.0002) -- (0.9900,0.0002) -- (1.0100,0.0002) -- (1.0300,0.0002) -- (1.0500,0.0002) -- (1.0700,0.0003) -- (1.0900,0.0003) -- (1.1100,0.0003) -- (1.1300,0.0003) -- (1.1500,0.0003) -- (1.1700,0.0003) -- (1.1900,0.0003) -- (1.2100,0.0003) -- (1.2300,0.0004) -- (1.2500,0.0004) -- (1.2700,0.0004) -- (1.2900,0.0004) -- (1.3100,0.0004) -- (1.3300,0.0004) -- (1.3500,0.0004) -- (1.3700,0.0005) -- (1.3900,0.0005) -- (1.4100,0.0005) -- (1.4300,0.0005) -- (1.4500,0.0006) -- (1.4700,0.0006) -- (1.4900,0.0006) -- (1.5100,0.0006) -- (1.5300,0.0007) -- (1.5500,0.0007) -- (1.5700,0.0007) -- (1.5900,0.0008) -- (1.6100,0.0008) -- (1.6300,0.0008) -- (1.6500,0.0009) -- (1.6700,0.0009) -- (1.6900,0.0010) -- (1.7100,0.0010) -- (1.7300,0.0011) -- (1.7500,0.0011) -- (1.7700,0.0012) -- (1.7900,0.0012) -- (1.8100,0.0013) -- (1.8300,0.0014) -- (1.8500,0.0014) -- (1.8700,0.0015) -- (1.8900,0.0016) -- (1.9100,0.0017) -- (1.9300,0.0018) -- (1.9500,0.0019) -- (1.9700,0.0020) -- (1.9900,0.0021) -- (2.0100,0.0022) -- (2.0300,0.0023) -- (2.0500,0.0025) -- (2.0700,0.0026) -- (2.0900,0.0028) -- (2.1100,0.0029) -- (2.1300,0.0031) -- (2.1500,0.0033) -- (2.1700,0.0035) -- (2.1900,0.0038) -- (2.2100,0.0040) -- (2.2300,0.0043) -- (2.2500,0.0045) -- (2.2700,0.0048) -- (2.2900,0.0052) -- (2.3100,0.0055) -- (2.3300,0.0059) -- (2.3500,0.0063) -- (2.3700,0.0068) -- (2.3900,0.0073) -- (2.4100,0.0078) -- (2.4300,0.0084) -- (2.4500,0.0090) -- (2.4700,0.0097) -- (2.4900,0.0104) -- (2.5100,0.0112) -- (2.5300,0.0121) -- (2.5500,0.0131) -- (2.5700,0.0141) -- (2.5900,0.0153) -- (2.6100,0.0165) -- (2.6300,0.0179) -- (2.6500,0.0194) -- (2.6700,0.0211) -- (2.6900,0.0230) -- (2.7100,0.0250) -- (2.7300,0.0273) -- (2.7500,0.0297) -- (2.7700,0.0325) -- (2.7900,0.0355) -- (2.8100,0.0389) -- (2.8300,0.0427) -- (2.8500,0.0468) -- (2.8700,0.0515) -- (2.8900,0.0566) -- (2.9100,0.0624) -- (2.9300,0.0688) -- (2.9500,0.0760) -- (2.9700,0.0840) -- (2.9900,0.0930) -- (3.0100,0.1030) -- (3.0300,0.1143) -- (3.0500,0.1269) -- (3.0700,0.1410) -- (3.0900,0.1569) -- (3.1100,0.1746) -- (3.1300,0.1946) -- (3.1500,0.2169) -- (3.1700,0.2419) -- (3.1900,0.2699) -- (3.2100,0.3012) -- (3.2300,0.3361) -- (3.2500,0.3749) -- (3.2700,0.4179) -- (3.2900,0.4655) -- (3.3100,0.5179) -- (3.3300,0.5752) -- (3.3500,0.6376) -- (3.3700,0.7051) -- (3.3900,0.7775) -- (3.4100,0.8543) -- (3.4300,0.9350) -- (3.4500,1.0187) -- (3.4700,1.1041) -- (3.4900,1.1898) -- (3.5100,1.2739) -- (3.5300,1.3545) -- (3.5500,1.4293) -- (3.5700,1.4961) -- (3.5900,1.5527) -- (3.6100,1.5970) -- (3.6300,1.6275) -- (3.6500,1.6428) -- (3.6700,1.6425) -- (3.6900,1.6265) -- (3.7100,1.5954) -- (3.7300,1.5505) -- (3.7500,1.4934) -- (3.7700,1.4263) -- (3.7900,1.3511) -- (3.8100,1.2703) -- (3.8300,1.1861) -- (3.8500,1.1004) -- (3.8700,1.0150) -- (3.8900,0.9315) -- (3.9100,0.8509) -- (3.9300,0.7743) -- (3.9500,0.7021) -- (3.9700,0.6348) -- (3.9900,0.5726) -- (4.0100,0.5155) -- (4.0300,0.4634) -- (4.0500,0.4160) -- (4.0700,0.3731) -- (4.0900,0.3345) -- (4.1100,0.2998) -- (4.1300,0.2687) -- (4.1500,0.2408) -- (4.1700,0.2159) -- (4.1900,0.1937) -- (4.2100,0.1738) -- (4.2300,0.1561) -- (4.2500,0.1404) -- (4.2700,0.1263) -- (4.2900,0.1137) -- (4.3100,0.1025) -- (4.3300,0.0926) -- (4.3500,0.0836) -- (4.3700,0.0756) -- (4.3900,0.0685) -- (4.4100,0.0621) -- (4.4300,0.0564) -- (4.4500,0.0513) -- (4.4700,0.0466) -- (4.4900,0.0425) -- (4.5100,0.0388) -- (4.5300,0.0354) -- (4.5500,0.0324) -- (4.5700,0.0296) -- (4.5900,0.0272) -- (4.6100,0.0249) -- (4.6300,0.0229) -- (4.6500,0.0210) -- (4.6700,0.0194) -- (4.6900,0.0179) -- (4.7100,0.0165) -- (4.7300,0.0152) -- (4.7500,0.0141) -- (4.7700,0.0130) -- (4.7900,0.0121) -- (4.8100,0.0112) -- (4.8300,0.0104) -- (4.8500,0.0096) -- (4.8700,0.0090) -- (4.8900,0.0083) -- (4.9100,0.0078) -- (4.9300,0.0072) -- (4.9500,0.0068) -- (4.9700,0.0063) -- (4.9900,0.0059) -- (5.0100,0.0055) -- (5.0300,0.0052) -- (5.0500,0.0048) -- (5.0700,0.0045) -- (5.0900,0.0043) -- (5.1100,0.0040) -- (5.1300,0.0038) -- (5.1500,0.0035) -- (5.1700,0.0033) -- (5.1900,0.0031) -- (5.2100,0.0029) -- (5.2300,0.0028) -- (5.2500,0.0026) -- (5.2700,0.0025) -- (5.2900,0.0023) -- (5.3100,0.0022) -- (5.3300,0.0021) -- (5.3500,0.0020) -- (5.3700,0.0019) -- (5.3900,0.0018) -- (5.4100,0.0017) -- (5.4300,0.0016) -- (5.4500,0.0015) -- (5.4700,0.0014) -- (5.4900,0.0014) -- (5.5100,0.0013) -- (5.5300,0.0012) -- (5.5500,0.0012) -- (5.5700,0.0011) -- (5.5900,0.0011) -- (5.6100,0.0010) -- (5.6300,0.0010) -- (5.6500,0.0009) -- (5.6700,0.0009) -- (5.6900,0.0008) -- (5.7100,0.0008) -- (5.7300,0.0008) -- (5.7500,0.0007) -- (5.7700,0.0007) -- (5.7900,0.0007) -- (5.8100,0.0006) -- (5.8300,0.0006) -- (5.8500,0.0006) -- (5.8700,0.0006) -- (5.8900,0.0005) -- (5.9100,0.0005) -- (5.9300,0.0005) -- (5.9500,0.0005) -- (5.9700,0.0004) -- (5.9900,0.0004); |
||
| + | \draw (15,0) node[below] {15}; |
||
| + | \draw (16,0) node[below] {16}; |
||
| + | \draw (17,0) node[below] {17}; |
||
| + | \draw (18,0) node[below] {18}; |
||
| + | \draw (19,0) node[below] {19}; |
||
| + | \draw (20,0) node[below] {20}; |
||
| + | \draw (21,0) node[below] {21}; |
||
| + | \draw (22,0) node[below] {22}; |
||
| + | \draw (23,0) node[below] {23}; |
||
| ⚫ | |||
| + | \draw[line width=5, red] (0,0) -- ( 0.100, 0.007) -- ( 0.300, 0.008) -- ( 0.500, 0.008) -- ( 0.700, 0.009) -- ( 0.900, 0.010) -- ( 1.100, 0.010) -- ( 1.300, 0.011) -- ( 1.500, 0.012) -- ( 1.700, 0.013) -- ( 1.900, 0.014) -- ( 2.100, 0.015) -- ( 2.300, 0.017) -- ( 2.500, 0.018) -- ( 2.700, 0.020) -- ( 2.900, 0.021) -- ( 3.100, 0.023) -- ( 3.300, 0.025) -- ( 3.500, 0.028) -- ( 3.700, 0.030) -- ( 3.900, 0.033) -- ( 4.100, 0.036) -- ( 4.300, 0.040) -- ( 4.500, 0.044) -- ( 4.700, 0.048) -- ( 4.900, 0.053) -- ( 5.100, 0.059) -- ( 5.300, 0.065) -- ( 5.500, 0.072) -- ( 5.700, 0.080) -- ( 5.900, 0.088) -- ( 6.100, 0.098) -- ( 6.300, 0.110) -- ( 6.500, 0.122) -- ( 6.700, 0.137) -- ( 6.900, 0.153) -- ( 7.100, 0.172) -- ( 7.300, 0.193) -- ( 7.500, 0.217) -- ( 7.700, 0.245) -- ( 7.900, 0.276) -- ( 8.100, 0.312) -- ( 8.300, 0.353) -- ( 8.500, 0.400) -- ( 8.700, 0.454) -- ( 8.900, 0.515) -- ( 9.100, 0.585) -- ( 9.300, 0.664) -- ( 9.500, 0.755) -- ( 9.700, 0.857) -- ( 9.900, 0.972) -- (10.100, 1.102) -- (10.300, 1.247) -- (10.500, 1.408) -- (10.700, 1.584) -- (10.900, 1.776) -- (11.100, 1.983) -- (11.300, 2.202) -- (11.500, 2.429) -- (11.700, 2.661) -- (11.900, 2.891) -- (12.100, 3.112) -- (12.300, 3.317) -- (12.500, 3.496) -- (12.700, 3.643) -- (12.900, 3.749) -- (13.100, 3.810) -- (13.300, 3.823) -- (13.500, 3.786) -- (13.700, 3.701) -- (13.900, 3.574) -- (14.100, 3.410) -- (14.300, 3.217) -- (14.500, 3.003) -- (14.700, 2.776) -- (14.900, 2.545) -- (15.100, 2.314) -- (15.300, 2.091) -- (15.500, 1.878) -- (15.700, 1.678) -- (15.900, 1.494) -- (16.100, 1.325) -- (16.300, 1.172) -- (16.500, 1.035) -- (16.700, 0.913) -- (16.900, 0.804) -- (17.100, 0.708) -- (17.300, 0.623) -- (17.500, 0.549) -- (17.700, 0.483) -- (17.900, 0.426) -- (18.100, 0.376) -- (18.300, 0.332) -- (18.500, 0.294) -- (18.700, 0.260) -- (18.900, 0.231) -- (19.100, 0.205) -- (19.300, 0.182) -- (19.500, 0.162) -- (19.700, 0.145) -- (19.900, 0.129) -- (20.100, 0.116) -- (20.300, 0.104) -- (20.500, 0.093) -- (20.700, 0.084) -- (20.900, 0.076) -- (21.100, 0.068) -- (21.300, 0.062) -- (21.500, 0.056) -- (21.700, 0.051) -- (21.900, 0.046) -- (22.100, 0.042) -- (22.300, 0.038) -- (22.500, 0.035) -- (22.700, 0.032) -- (22.900, 0.029) -- (23.100, 0.026) -- (23.300, 0.024) -- (23.500, 0.022) -- (23.700, 0.020) -- (23.900, 0.019); |
||
\end{tikzpicture} |
\end{tikzpicture} |
||
\end{document} |
\end{document} |
||
</pre> |
</pre> |
||
| + | ==Wartning== |
||
| ⚫ | |||
==References== |
==References== |
||
{{ref}} |
{{ref}} |
||
| Line 207: | Line 198: | ||
==Kywords== |
==Kywords== |
||
| − | «[[Bridging Probability Theory and Statistical Estimation]]», |
||
«[[Duration5]]», |
«[[Duration5]]», |
||
«[[ju24da.cin]]», |
«[[ju24da.cin]]», |
||
Revision as of 07:38, 16 July 2025
Density \(F(t)\) of likelihood of the mean duration \(\bar D\) to have value \(t\) evaluates with 5 examples from article Duration5.
Input file:
1653 12 16 1661 04 23 eng 1802 08 04 1815 11 20 fra 1928 05 17 1947 12 27 ita 1933 03 24 1945 05 08 ger 1977 10 07 1991 08 20 sov
Generator
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "ju24da.cin"
#include "Student.cin"
int main(){ int n,N=5; FILE *i,*o;
int Y1,M1,D1;
int Y2,M2,D2; char s[N][4]; int D[N],Ya[N],Yb[N]; float d[N]; //L[N]
float t, p,q,r,x,y,T,U,W;
i=fopen("i.txt","r");
for(n=0;n<N;n++)
{
fscanf(i,"%4d %2d %2d %4d %2d %2d %3s", &Y1,&M1,&D1, &Y2,&M2,&D2, s[n]);
D[n]=daju24(Y2,M2,D2) - daju24(Y1,M1,D1) ; t=D[n]/365.2422; d[n]=t; // L[n]=log2(t);
Ya[n]=Y1;
Yb[n]=Y2;
printf("%4d %02d %02d %04d %02d %02d %3s %04d %6.4f\n", Y1,M1,D1, Y2,M2,D2, s[n], D[n], d[n]);
} fclose(i);
p=0.; for(n=0;n<N;n++) p+=d[n]; p/=N; printf("p=%5.2f\n",p);
q=0.; for(n=0;n<N;n++) {r=d[n]-p; q+=r*r;}
T=sqrt(q/(N-1.)); printf("T=%5.2f\n",T);
U=sqrt(q/(N*(N-1.))); printf("U=%5.2f\n",U);
W=sqrt(q/(N*(N-3.))); printf("W=%5.2f\n",W);
o=fopen("Linea.tex","w");
fprintf(o,"\\documentclass{standalone}\n");
fprintf(o,"\\usepackage{graphicx}\n");
fprintf(o,"\\usepackage{tikz}\n");
//fprintf(o,"\\newcommand \\sx {\\scalebox}\n");
fprintf(o,"\\begin{document}\n");
fprintf(o,"\\Huge\n");
fprintf(o,"\\begin{tikzpicture}[scale=2]\n");
fprintf(o,"\\draw [line width=0.981] (0,0) grid (24,4);\n");
fprintf(o,"\\draw [line width=2.3] (0,4.4) -- (0,0) -- (24.1,0) ;\n");
// fprintf(o,"\\draw(0,0) -- (0,3.2) ;\n");
fprintf(o,"\\draw (-.08,4.3) node[right] {\\(f(t)\\)};\n");
fprintf(o,"\\definecolor{light}{rgb}{1,1,.6};\n");
fprintf(o,"\\definecolor{dark}{rgb}{0,1,1};\n");
fprintf(o,"\\draw[line width=32, light] (8,0.03) -- (8,3.8) ;\n");
fprintf(o,"\\draw (8,0.8) node[rotate=90,right] {\\bf Russia 2028};\n");
fprintf(o,"\\draw[line width=32, light] (22,0.03) -- (22,3.8) ;\n");
fprintf(o,"\\draw(22,0.8) node[rotate=90,right] {\\bf Moscow 2042};\n");
for(n=0;n<N;n++)
{
fprintf(o,"\\draw[line width=24, dark] (%5.3f,0.03) -- (%5.3f,3.3) ;\n",d[n], d[n]);
fprintf(o,"\\draw (%5.3f,3.2) node[rotate=90,left] {\\bf %s %4d-%4d};\n",d[n],s[n],Ya[n],Yb[n]);
printf("%1d %s\n",n,s[n]);
}
for(n=0;n<5;n+=2) fprintf(o,"\\draw (0,%d) node[left] {%3.1f};\n",n,0.05*n);
for(n=0;n<24;n++) fprintf(o,"\\draw (%d,0) node[below] {%d};\n",n,n);
fprintf(o,"\\draw (%d,0) node[below] {$t$};\n",n);
fprintf(o,"\\draw[line width=5, red] (0,0)");
for(n=1;n<241;n+=2){x=.1*n; y=20*Student(N-1,(x-p)/U)/U; fprintf(o," -- (%6.3f,%6.3f)",x,y);}
fprintf(o,";\n");
//fprintf(o,"\\input \"Labels.tex\"\n");
fprintf(o,"\\end{tikzpicture}\n");
fprintf(o,"\\end{document}\n");
fclose(o);
system("pdflatex Linea.tex");
system("open Linea.pdf");
//system("convert Linear.pdf png8:Linear8.png");
//system("convert Linear.pdf Linear.jpg");
//system("open Linear.jpg");
printf("p=0.; for(n=0;n<N;n++) p+=d[n]; p/=N; resulling p=%8.6f\n",p);
printf("q=0.; for(n=0;n<N;n++) {r=d[n]-p; q+=r*r;} resulting q=%8.6f\n",q);
printf("T=sqrt(q/(N-1.)) = %8.6f\n",T);
printf("U=sqrt(q/(N*(N-1.))) = %8.6f\n",U);
printf("W=sqrt(q/(N*(N-3.))) = %8.6f\n",W);
printf("g(d)=student%d((d-%8.6f)/%8.6f)/%6.6f\n",N,p,U,U);
printf("sqrt(T*T+W*W)=%8.6f years\n",sqrt(T*T+W*W));
printf("p-sqrt(T*T+W*W))=%8.6f years\n",p-sqrt(T*T+W*W) );
printf("p+sqrt(T*T+W*W))=%8.6f years\n",p+sqrt(T*T+W*W) );
printf("p-2*sqrt(T*T+W*W))=%8.6f years\n",p-2*sqrt(T*T+W*W) );
printf("p+2*sqrt(T*T+W*W))=%8.6f years\n",p+2*sqrt(T*T+W*W) );
}
Output text
Output written on Linea.pdf (1 page, 35730 bytes).
Transcript written on Linea.log.
1653 12 16 1661 04 23 eng 2685 7.3513
1802 08 04 1815 11 20 fra 4856 13.2953
1928 05 17 1947 12 27 ita 7163 19.6116
1933 03 24 1945 05 08 ger 4428 12.1235
1977 10 07 1991 08 20 sov 5065 13.8675
p=13.25
T= 4.39
U= 1.96
W= 2.77
0 eng
1 fra
2 ita
3 ger
4 sov
p=0.; for(n=0;n<N;n++) p+=d[n]; p/=N; resulling p=13.249838
q=0.; for(n=0;n<N;n++) {r=d[n]-p; q+=r*r;} resulting q=76.917809
T=sqrt(q/(N-1.)) = 4.385140
U=sqrt(q/(N*(N-1.))) = 1.961094
W=sqrt(q/(N*(N-3.))) = 2.773406
g(d)=student4((d-13.249838)/1.961094)/1.961094
sqrt(T*T+W*W)=5.188568 years
p-sqrt(T*T+W*W))=8.061270 years
p+sqrt(T*T+W*W))=18.438406 years
p-2*sqrt(T*T+W*W))=2.872703 years
p+2*sqrt(T*T+W*W))=23.626972 years
Output Latex
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\Huge
\begin{tikzpicture}[scale=2]
\draw [line width=0.981] (0,0) grid (24,4);
\draw [line width=2.3] (0,4.4) -- (0,0) -- (24.1,0) ;
\draw (-.08,4.3) node[right] {\(f(t)\)};
\definecolor{light}{rgb}{1,1,.6};
\definecolor{dark}{rgb}{0,1,1};
\draw[line width=32, light] (8,0.03) -- (8,3.8) ;
\draw (8,0.8) node[rotate=90,right] {\bf Russia 2028};
\draw[line width=32, light] (22,0.03) -- (22,3.8) ;
\draw(22,0.8) node[rotate=90,right] {\bf Moscow 2042};
\draw[line width=24, dark] (7.351,0.03) -- (7.351,3.3) ;
\draw (7.351,3.2) node[rotate=90,left] {\bf eng 1653-1661};
\draw[line width=24, dark] (13.295,0.03) -- (13.295,3.3) ;
\draw (13.295,3.2) node[rotate=90,left] {\bf fra 1802-1815};
\draw[line width=24, dark] (19.612,0.03) -- (19.612,3.3) ;
\draw (19.612,3.2) node[rotate=90,left] {\bf ita 1928-1947};
\draw[line width=24, dark] (12.123,0.03) -- (12.123,3.3) ;
\draw (12.123,3.2) node[rotate=90,left] {\bf ger 1933-1945};
\draw[line width=24, dark] (13.868,0.03) -- (13.868,3.3) ;
\draw (13.868,3.2) node[rotate=90,left] {\bf sov 1977-1991};
\draw (0,0) node[left] {0.0};
\draw (0,2) node[left] {0.1};
\draw (0,4) node[left] {0.2};
\draw (0,0) node[below] {0};
\draw (1,0) node[below] {1};
\draw (2,0) node[below] {2};
\draw (3,0) node[below] {3};
\draw (4,0) node[below] {4};
\draw (5,0) node[below] {5};
\draw (6,0) node[below] {6};
\draw (7,0) node[below] {7};
\draw (8,0) node[below] {8};
\draw (9,0) node[below] {9};
\draw (10,0) node[below] {10};
\draw (11,0) node[below] {11};
\draw (12,0) node[below] {12};
\draw (13,0) node[below] {13};
\draw (14,0) node[below] {14};
\draw (15,0) node[below] {15};
\draw (16,0) node[below] {16};
\draw (17,0) node[below] {17};
\draw (18,0) node[below] {18};
\draw (19,0) node[below] {19};
\draw (20,0) node[below] {20};
\draw (21,0) node[below] {21};
\draw (22,0) node[below] {22};
\draw (23,0) node[below] {23};
\draw (24,0) node[below] {$t$};
\draw[line width=5, red] (0,0) -- ( 0.100, 0.007) -- ( 0.300, 0.008) -- ( 0.500, 0.008) -- ( 0.700, 0.009) -- ( 0.900, 0.010) -- ( 1.100, 0.010) -- ( 1.300, 0.011) -- ( 1.500, 0.012) -- ( 1.700, 0.013) -- ( 1.900, 0.014) -- ( 2.100, 0.015) -- ( 2.300, 0.017) -- ( 2.500, 0.018) -- ( 2.700, 0.020) -- ( 2.900, 0.021) -- ( 3.100, 0.023) -- ( 3.300, 0.025) -- ( 3.500, 0.028) -- ( 3.700, 0.030) -- ( 3.900, 0.033) -- ( 4.100, 0.036) -- ( 4.300, 0.040) -- ( 4.500, 0.044) -- ( 4.700, 0.048) -- ( 4.900, 0.053) -- ( 5.100, 0.059) -- ( 5.300, 0.065) -- ( 5.500, 0.072) -- ( 5.700, 0.080) -- ( 5.900, 0.088) -- ( 6.100, 0.098) -- ( 6.300, 0.110) -- ( 6.500, 0.122) -- ( 6.700, 0.137) -- ( 6.900, 0.153) -- ( 7.100, 0.172) -- ( 7.300, 0.193) -- ( 7.500, 0.217) -- ( 7.700, 0.245) -- ( 7.900, 0.276) -- ( 8.100, 0.312) -- ( 8.300, 0.353) -- ( 8.500, 0.400) -- ( 8.700, 0.454) -- ( 8.900, 0.515) -- ( 9.100, 0.585) -- ( 9.300, 0.664) -- ( 9.500, 0.755) -- ( 9.700, 0.857) -- ( 9.900, 0.972) -- (10.100, 1.102) -- (10.300, 1.247) -- (10.500, 1.408) -- (10.700, 1.584) -- (10.900, 1.776) -- (11.100, 1.983) -- (11.300, 2.202) -- (11.500, 2.429) -- (11.700, 2.661) -- (11.900, 2.891) -- (12.100, 3.112) -- (12.300, 3.317) -- (12.500, 3.496) -- (12.700, 3.643) -- (12.900, 3.749) -- (13.100, 3.810) -- (13.300, 3.823) -- (13.500, 3.786) -- (13.700, 3.701) -- (13.900, 3.574) -- (14.100, 3.410) -- (14.300, 3.217) -- (14.500, 3.003) -- (14.700, 2.776) -- (14.900, 2.545) -- (15.100, 2.314) -- (15.300, 2.091) -- (15.500, 1.878) -- (15.700, 1.678) -- (15.900, 1.494) -- (16.100, 1.325) -- (16.300, 1.172) -- (16.500, 1.035) -- (16.700, 0.913) -- (16.900, 0.804) -- (17.100, 0.708) -- (17.300, 0.623) -- (17.500, 0.549) -- (17.700, 0.483) -- (17.900, 0.426) -- (18.100, 0.376) -- (18.300, 0.332) -- (18.500, 0.294) -- (18.700, 0.260) -- (18.900, 0.231) -- (19.100, 0.205) -- (19.300, 0.182) -- (19.500, 0.162) -- (19.700, 0.145) -- (19.900, 0.129) -- (20.100, 0.116) -- (20.300, 0.104) -- (20.500, 0.093) -- (20.700, 0.084) -- (20.900, 0.076) -- (21.100, 0.068) -- (21.300, 0.062) -- (21.500, 0.056) -- (21.700, 0.051) -- (21.900, 0.046) -- (22.100, 0.042) -- (22.300, 0.038) -- (22.500, 0.035) -- (22.700, 0.032) -- (22.900, 0.029) -- (23.100, 0.026) -- (23.300, 0.024) -- (23.500, 0.022) -- (23.700, 0.020) -- (23.900, 0.019);
\end{tikzpicture}
\end{document}
Wartning
The C++ code numerates the cases beginning with zero.
References
Kywords
«Duration5», «ju24da.cin», «Student Distribution», «Student.cin»,
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 07:17, 16 July 2025 | 1,417 × 295 (63 KB) | T (talk | contribs) |
You cannot overwrite this file.
File usage
There are no pages that use this file.