File:Linea.jpg
Jump to navigation
Jump to search
Size of this preview: 800 × 167 pixels. Other resolutions: 320 × 67 pixels | 1,417 × 295 pixels.
Original file (1,417 × 295 pixels, file size: 63 KB, MIME type: image/jpeg)
Summary
Density \(F(t)\) of likelihood of the mean logarithm of Duration to have value \(:\) evaluates with 5 examples from article Duration5 for the Second model (moral distribution of logarithm of Duration).
The figure is prepared for 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]; float d[N]; float 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);
printf("%4d %02d %02d %04d %02d %02d %3s %04d %6.4f %6.4f\n", Y1,M1,D1, Y2,M2,D2, s[n], D[n], d[n], L[n]);
} fclose(i);
p=0.; for(n=0;n<N;n++) p+=L[n]; p/=N; printf("p=%5.2f\n",p);
q=0.; for(n=0;n<N;n++) {r=L[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("Duration5Logari.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,"\\Large\n");
//fprintf(o,"\\begin{tikzpicture}[scale=2]\n");
fprintf(o,"\\begin{tikzpicture}[scale=5]\n");
fprintf(o,"\\draw [line width=0.981] (0,0) grid (6,2);\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,"\\definecolor{light}{rgb}{1,1,.6};\n");
fprintf(o,"\\definecolor{dark}{rgb}{0,1,1};\n");
fprintf(o,"\\draw[line width=12, light] (3,0.03) -- (3,1.4) ;\n");
//fprintf(o,"\\draw (8,0.6) node[rotate=90,right] {\\bf Russia 2028};\n");
fprintf(o,"\\draw (3,0.6) node[rotate=90,right] {\\bf Russia 2028};\n");
fprintf(o,"\\draw[line width=12, light] (%4.2f,0.03) -- (%4.2f,1.4) ;\n",log2(22.),log2(22.));
fprintf(o,"\\draw(%4.2f,0.6) node[rotate=90,right] {\\bf Moscow 2042};\n", log2(22.));
for(n=0;n<N;n++)
{
fprintf(o,"\\draw[line width=8, dark] (%5.3f,0.04) -- (%5.3f,0.4) ;\n",L[n], L[n]);
fprintf(o,"\\draw (%5.3f,0.3) node[rotate=90,left] {\\bf %s};\n",L[n],s[n]);
printf("%1d %s\n",n,s[n]);
}
fprintf(o,"\\Huge\n");
fprintf(o,"\\draw (.04,2.1) node[right] {\\(F(L)\\)};\n");
for(n=0;n<3;n+=1) fprintf(o,"\\draw (0,%d) node[left] {%d};\n",n,n);
for(n=0;n<6;n++) fprintf(o,"\\draw (%d,0) node[below] {%d};\n",n,n);
fprintf(o,"\\draw (%d,0) node[below] {$L$};\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)");
for(n=1;n<601;n+=2){x=.01*n; y=Student(N-1,(x-p)/U)/U; fprintf(o," -- (%6.4f,%6.4f)",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 Duration5Logari.tex");
system("open Duration5Logari.pdf");
//system("convert Linear.pdf png8:Linear8.png");
//system("convert Linear.pdf Linear.jpg");
printf("p=0.; for(n=0;n<N;n++) p+=L[n]; p/=N; resulling p=%8.6f\n",p);
printf("q=0.; for(n=0;n<N;n++) {r=L[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-1,p,U,U);
printf("sqrt(T*T+W*W)=%8.6f \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 \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 \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)) );
}
Output text
Output written on Duration5Logari.pdf (1 page, 33280 bytes).
Transcript written on Duration5Logari.log.
1653 12 16 1661 04 23 eng 2685 7.3513 2.8780
1802 08 04 1815 11 20 fra 4856 13.2953 3.7328
1928 05 17 1947 12 27 ita 7163 19.6116 4.2936
1933 03 24 1945 05 08 ger 4428 12.1235 3.5997
1977 10 07 1991 08 20 sov 5065 13.8675 3.7936
p= 3.66
T= 0.51
U= 0.23
W= 0.32
0 eng
1 fra
2 ita
3 ger
4 sov
p=0.; for(n=0;n<N;n++) p+=L[n]; p/=N; resulling p=3.659569
q=0.; for(n=0;n<N;n++) {r=L[n]-p; q+=r*r;} resulting q=1.039824
T=sqrt(q/(N-1.)) = 0.509859
U=sqrt(q/(N*(N-1.))) = 0.228016
W=sqrt(q/(N*(N-3.))) = 0.322463
g(d)=student4((d-3.659569)/0.228016)/0.228016
sqrt(T*T+W*W)=0.603273
p-sqrt(T*T+W*W))=3.056296
p+sqrt(T*T+W*W))=4.262842
p-2*sqrt(T*T+W*W))=2.453023
p+2*sqrt(T*T+W*W))=4.866115
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
Warning
Warning: the code numerates the cases beginning with zero.
Output Latex
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\Large
\begin{tikzpicture}[scale=5]
\draw [line width=0.981] (0,0) grid (6,2);
\draw [line width=2.3] (0,2.2) -- (0,0) -- (6.1,0) ;
\definecolor{light}{rgb}{1,1,.6};
\definecolor{dark}{rgb}{0,1,1};
\draw[line width=12, light] (3,0.03) -- (3,1.4) ;
\draw (3,0.6) node[rotate=90,right] {\bf Russia 2028};
\draw[line width=12, light] (4.46,0.03) -- (4.46,1.4) ;
\draw(4.46,0.6) node[rotate=90,right] {\bf Moscow 2042};
\draw[line width=8, dark] (2.878,0.04) -- (2.878,0.4) ;
\draw (2.878,0.3) node[rotate=90,left] {\bf eng};
\draw[line width=8, dark] (3.733,0.04) -- (3.733,0.4) ;
\draw (3.733,0.3) node[rotate=90,left] {\bf fra};
\draw[line width=8, dark] (4.294,0.04) -- (4.294,0.4) ;
\draw (4.294,0.3) node[rotate=90,left] {\bf ita};
\draw[line width=8, dark] (3.600,0.04) -- (3.600,0.4) ;
\draw (3.600,0.3) node[rotate=90,left] {\bf ger};
\draw[line width=8, dark] (3.794,0.04) -- (3.794,0.4) ;
\draw (3.794,0.3) node[rotate=90,left] {\bf sov};
\Huge
\draw (.04,2.1) node[right] {\(F(L)\)};
\draw (0,0) node[left] {0};
\draw (0,1) node[left] {1};
\draw (0,2) node[left] {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] {$L$};
\draw (0,-0.2) node[below] {1};
\draw (1,-0.2) node[below] {2};
\draw (2,-0.2) node[below] {4};
\draw (3,-0.2) node[below] {8};
\draw (4,-0.2) node[below] {16};
\draw (5,-0.2) node[below] {32};
\draw (6,-0.2) node[below] {$t$, y.};
\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);
\end{tikzpicture}
\end{document}
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.