File:2015.01.05rudo.png

From TORI
Jump to: navigation, search
Original file(1,867 × 747 pixels, file size: 271 KB, MIME type: image/png)

Value $y$ of 100 Russian roubles measured in the USA cents, versus time $x$, measured in days since the beginning of the project (2014.10.27).

The experimental data cover the interval since 2014.01.01 to 2015.01.05, id est, $-300<x<70$.

Experimental data

The red bars represent the data by https://www.mataf.net/en/currency/converter-USD-RUB

The blue bars represent the data by www.cbr.ru/scripts/XML_dynamic.asp?date_req1=01/01/2014&date_req2=01/05/2015&VAL_NM_RQ=R01235

Linear approximations and pink arc

The upper linear approximation $y=240-0.48x$ had been suggested 2014.10.31; it is shown also in figure http://mizugadro.mydns.jp/t/index.php/File:Rusa2014.10.28t.jpg

This linear approximation is called also "program 500 days" (Программа 500 дней)


The second linear fit $y=227.37−0.5833x$ had been suggested 2014.12.30; it is shown also in figure http://mizugadro.mydns.jp/t/index.php/File:2014.12.31rudo.png

The pink arc represents the approximation $y=\mathrm{Arc}(x)=\sqrt{(123−x)(471+x)}$ , made 2014.10.29; this approximation is shown also in figure http://mizugadro.mydns.jp/t/index.php/File:RubleArc.png

Black ellipse

The black ellipse shows the approximation

$y=\mathrm{Ellipse}(x)=1.20375 \sqrt{(100.639 - x)(381.547 + x)}$

In figure http://mizugadro.mydns.jp/t/index.php/File:2015.01.03rudo.png the same approximation is shorn with green ellipse.

The vertical green line at $x=-225$ shows the limit of this approximation.

Thick green line

The thick green line shows the approximation

$y=\mathrm{Exc}(x)= 235.352 \exp\big( -0.00382233 x - 0.0000232779 x^2 -4.40514\!\times\!10^{-8} x^3\big)$

Generator of First set of data


// The content of the input file dollardat.txt
// is loaded from https://www.mataf.net/en/currency/converter-USD-RUB

#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
#include"daju24.cin"

int main(){
int M=1024;
int t[M];
DB g[M];
DB z;
int j,jd,n,m,N; FILE *i,*o; int di; DB dr, x,y;

int zero=daju24(2014,10,27); //Date of beginning of the project

i=fopen("dollardat.txt","r");
DO(n,M) { int Y,M,D; char c1,c2,c3;
j=fscanf(i,"%4d%c%2d%c%2d%2d%lf",&Y,&c1,&M,&c2,&D, &di,&dr); if(j<3) break;
t[n]=daju24(Y,M,D)-zero;
z=di+dr/1000.;
g[n]=10000./z; //printf("%4d %2d %2d %9.0f %9.3f\n",Y, M, D, t[n],f[n]);
}
fclose(i); N=n; printf("N=%4d\n",N);

o=fopen("ddat.txt","w");
//DO(n,N) fprintf(o,"%4d %4.2lf\n",t[n],g[n]);
for(n=N-1;n>=0;n--) fprintf(o,"%4d %4.2lf\n",t[n],g[n]);
fclose(o);

}

Generator of Second set of data


// The content of the input file data01.txt is loaded from
// www.cbr.ru/scripts/XML_dynamic.asp?date_req1=01/01/2014&date_req2=01/05/2015&VAL_NM_RQ=R01235

#include<math.h>
#include<stdio.h>

int daju24(int Y,int M, int D) { int a, y,m; a=(14-M)/12; y=Y+4800-a; m=M+12*a-3;
          return D + (153*m+2)/5 +365*y + y/4 - y/100 + y/400 -32045 - 2400000;}

int main(){ int j, n,m,k,K; char a; FILE*i,*o; int b,c,d,e,f,g,h;

K=daju24(2014,10,27);

i=fopen("data01.txt","r");
o=fopen("datao.txt","w");
for(n=0;n<800;n++){
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&b); if(j>0) break;j=fscanf(i,"%c",&a); if(j<1) goto end;} printf(" %4d ",b);
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&c); if(j>0) break;j=fscanf(i,"%c",&a);} printf(" %4d ",c);
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&d); if(j>0) break;j=fscanf(i,"%c",&a);} printf(" %4d ",d);
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&e); if(j>0) break;j=fscanf(i,"%c",&a);} printf(" %4d ",e);
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&f); if(j>0) break;j=fscanf(i,"%c",&a);} printf(" %4d ",f);
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&g); if(j>0) break;j=fscanf(i,"%c",&a);} printf(" %4d ",g);
        for(m=0;m<80;m++){ j=fscanf(i,"%d",&h); if(j>0) break;j=fscanf(i,"%c",&a);} printf(" %4d\n",h);
k=daju24(d,c,b); fprintf(o,"%4d %6.4lf\n",k-K,10000./(g+.0001*h) );
        }
end:
fclose(o);
fclose(i);
}

Generator of of dates


#include<stdio.h>
#include<math.h>

void ju24da(int Mjd, int *Year, int *Month, int *Day) { int J, C, Y, M;
    J = Mjd + 2400000 + 68569;
    C = 4 * J / 146097;
    J = J - (146097 * C + 3) / 4;
    Y = 4000 * (J + 1) / 1461001;
    J = J - 1461 * Y / 4 + 31;
    M = 80 * J / 2447;
    *Day = J - 2447 * M / 80;
    J = M / 11;
    *Month = M + 2 - (12 * J);
    *Year = 100 * (C - 49) + Y + J;
// http://www.leapsecond.com/tools/gpsdate.c
}

int daju24(int Y,int M, int D)
{ int a, y,m;
  a=(14-M)/12;
  y=Y+4800-a;
  m=M+12*a-3;
  return D + (153*m+2)/5 +365*y + y/4 - y/100 + y/400 -32045 - 2400000;
}

int main(){int j, k, n, y,m,d;
k=daju24(2014,10,27);
ju24da(k,&y,&m,&d); printf("%4d %4d %2d %2d\n",k,y,m,d);

n=-2300,ju24da(k+n,&y,&m,&d); printf("%4d %4d %2d %2d\n",n,y,m,d);
n=-2200,ju24da(k+n,&y,&m,&d); printf("%4d %4d %2d %2d\n",n,y,m,d);
n=-2100,ju24da(k+n,&y,&m,&d); printf("%4d %4d %2d %2d\n",n,y,m,d);
n=-2000,ju24da(k+n,&y,&m,&d); printf("%4d %4d %2d %2d\n",n,y,m,d);
ju24da(k-226,&y,&m,&d); printf("%4d %4d %2d %2d\n",-226,y,m,d);

for(n=-300;n<600;n+=50){
        ju24da(k+n,&y,&m,&d);
        j=daju24(y,m,d);
        printf("%4d %4d %2d %2d %4d\n",n,y,m,d,j-k); }
}

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++)
//#include"ado.cin"
void 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 {5 0 360 arc C F} bind def\n");
        fprintf(O,"/times-Roman findfont 20 scalefont setfont\n");
        fprintf(O,"/W {setlinewidth} bind def\n");
        fprintf(O,"/RGB {setrgbcolor} bind def\n");}

//DB fit(DB x){ return 1.1882*sqrt((100.669 - x)*(389.828 + x));}
//DB fitos(DB x){ return fit(x) + 1.65997*exp(0.0477215*x)*sin(0.190509*(-53.7302 + x));} // 3.32858, 4.46385

//DB fit(DB x){ return 1.18052*sqrt((102.851 - x)*(388.552 + x));}
//DB fitos(DB x){ return fit(x) + 2.34457*exp(0.0379563*x)*sin(0.190307*(-54.7326 + x));} // 3.16919, 4.28327

//DB fit(DB x){ return 1.20375*sqrt((100.639 - x)*(381.547 + x));}
//DB fitos(DB x){ return fit(x) + exp(0.0319302*x)*
// (1.88239*sin(0.348703*(-93.3026 + x)) +
// 3.06092*sin(0.191964*(-53.3159 + x)) );} //, 2.87243, 3.92725}

DB fit(DB x){ return 1.19131*sqrt((102.09 - x)*(384.876 + x));}

DB fitos(DB x){ return fit(x) + exp(0.0390021*x)*
   (1.05514*sin(0.407951*(-71.052 + x)) +
    2.35622*sin(0.176673*(-55.1381+ x)));} // , 2.92204, 4.04111}

DB cubic(DB x){return 235.352 * exp( x*(-0.00382233 + x*(-0.0000232779 + x*(-4.40514e-8))));}

DB arc(DB x){return sqrt((123-x)*(471+x));}

DB lin0(DB x) {return 240.-.480*x;}

DB lin1(DB x) {return 227.37 - 0.583304*x;}

FILE *i,*o;

int main(){ int j,n,m,N,M; DB x,y,u,v,s,c;

o=fopen("21.eps","w"); ado(o,870,340);
#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);
#define O(x,y) fprintf(o,"%6.4f %6.4f O\n",0.+x,0.+y);
fprintf(o,"360 10 translate\n");
//fprintf(o,"460 10 translate\n");
for(n=0;n<301;n+=50) {M(-350,n)L(500,n)}
for(n=-350;n<501;n+=50) {M(n,0)L(n,300)}
fprintf(o,"0 0 0 RGB 2 setlinecap 1 setlinejoin .6 W S\n");

DO(n,840){ x=-340.+n; y=cubic(x); if(y>0) { if(n==0)M(x,y) else L(x,y)} else break;} fprintf(o,"0 1 0 RGB 12 W S\n");

DO(n,8002){ x=-350.+.1*n; y=arc(x); if(y>0) { if(n==0)M(x,y) else L(x,y)} else break;} fprintf(o,"0 0 1 RGB .1 W S\n");

M(-220,lin0(-220)) L(500,lin0(500)) fprintf(o,"0 0 0 RGB .6 W S\n");

M(-220,lin1(-229)) L(400,lin1(400)) fprintf(o,"0 0 .6 RGB .6 W S\n");

//M(-235,0)L(-235,300) fprintf(o,"0 .7 0 RGB 2 W S\n");
//M(T[37],0)L(T[37],300) fprintf(o,"0 .7 0 RGB 2 W S\n");
M(-226,0)L(-226,300) fprintf(o,"0 .7 0 RGB 2 W S\n");


DO(n,8024){ x=-352+.1*n; y=fit(x); if(y>0) { if(n==0)M(x,y) else L(x,y)} else break;} fprintf(o,"0 0 0 RGB 1 W S\n");

DB X[1024],Y[1024];
DB T[1024],F[1024];
//i=fopen("ddat.txt","r");


fprintf(o,"1 0 0 RGB 1 setlinecap\n");
i=fopen("ddat.txt","r");
DO(n,1024){j=fscanf(i,"%d%lf",&m,&y); X[n]=x=m; Y[n]=y; if(j<2) break;
M(x,y-3) L(x,y+3);
}
fclose(i); N=n; printf("N=%3d\n",N);
fprintf(o,"1 W S\n");
fclose(i);

fprintf(o,"0 0 1 RGB 1 setlinecap\n");
i=fopen("datao.txt","r");
//i=fopen("ddat.txt","r");
DO(n,1024){j=fscanf(i,"%d%lf",&m,&y); T[n]=x=m; F[n]=y; if(j<2) break;
M(x,y-3)L(x,y+3);
//if(n==0)M(x,y) else L(x,y);
}
fclose(i); M=n; printf("M=%3d\n",M);
fprintf(o,"1 W S\n");
fclose(i);

/*
s=c=0.;
DO(m,N){if (X[m] >= -236) break;}
int K=0;
for(n=m;n<N;n++){ x=X[n]; y=Y[n]; u=fitos(x); v=u-y; s+=fabs(v); c+=v*v; K++;}
s/=K; c/=K; c=sqrt(c);
printf("%8.4f %8.4f K=%3d\n",s,c, K);
*/
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
      system("epstopdf 21.eps");
      system( "open 21.pdf");
}

Latex generator of labels


\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{color}
\definecolor{pink}{RGB}{255,160,255}
\paperwidth 900pt
\paperheight 360pt
\textwidth 800pt
\textheight 400pt
\topmargin -92pt
\oddsidemargin -68pt
\newcommand \sx {\scalebox}
\newcommand \rot {\begin{rotate}}
\newcommand \ero {\end{rotate}}
\begin{document}
\begin{picture}(900,336)
%\put(-4,20){\sx{14.9}{\color{pink} \circle{50}}}
\put(196,20){\sx{14.9}{\color{pink} \circle{50}}}
%\put(296,20){\sx{14.9}{\color{pink} \circle{50}}}
%\put(10,10){\includegraphics{dollarplot}}
\put(10,10){\includegraphics{21}}
%\put(-10,0){\circle(200)}
%\put(0,-40){\sx{16}{\color{magenta} \circle{50}}}
%\put(-4,308){\sx{1.3}{Ruble}}
%\put(-4,296){\sx{1.3}{in cents}}
%\put(-4,282){\sx{1.3}{of USA}}
\put(-8,341){\sx{2.2}{$y$}}
\put(-22,312){\sx{2.2}{300}}
\put(-22,262){\sx{2.2}{250}}
\put(-22,212){\sx{2.2}{200}}
\put(-22,162){\sx{2.2}{150}}
\put(-22,112){\sx{2.2}{100}}
\put(-12,62){\sx{2.2}{50}}
\put(-5,12){\sx{2.2}{0}}
\put( 30,-2){\sx{2.2}{$-300$}}
\put(130,-2){\sx{2.2}{$-200$}}
\put(230,-2){\sx{2.2}{$-100$}}
\put(364,-2){\sx{2.2}{$0$}}
\put(452,-2){\sx{2.2}{$100$}}
\put(552,-2){\sx{2.2}{$200$}}
\put(652,-2){\sx{2.2}{$300$}}
%\put(600,-2){\sx{2.5}{$400$}}
\put(796,-1){\sx{2.2}{$x$, days}}
\put( 76, 22){\sx{1.5}{\rot{90}{\bf 2013.12.31}\ero}}%
\put(127, 22){\sx{1.5}{\rot{90}{\bf 2014.02.19}\ero}}%
%\put(40, 122){\sx{1.5}{\rot{90}{\bf 2014.03.06}\ero}}%
\put(150, 22){\sx{1.5}{\rot{90}{\bf 2014.03.06}\ero}}%
\put(176, 22){\sx{1.5}{\rot{90}{\bf 2014.04.10}\ero}}%
\put(227, 22){\sx{1.5}{\rot{90}{\bf 2014.05.30}\ero}}%
\put(276, 22){\sx{1.5}{\rot{90}{\bf 2014.07.19}\ero}}%
\put(326,22){\sx{1.5}{\rot{90}{\bf 2014.09.07}\ero}}%
\put(376,22){\sx{1.5}{\rot{90}{\bf 2014.10.27}\ero}}%
\put(426,22){\sx{1.5}{\rot{90}{\bf 2014.12.16}\ero}}
\put(476,224){\sx{1.5}{\rot{90}{\bf 2015.02.04}\ero}}
\put(526,224){\sx{1.5}{\rot{90}{\bf 2015.03.26}\ero}}
\put(576,224){\sx{1.5}{\rot{90}{\bf 2015.05.15}\ero}}
\put(626,224){\sx{1.5}{\rot{90}{\bf 2015.07.04}\ero}}
\put(676,224){\sx{1.5}{\rot{90}{\bf 2015.08.23}\ero}}
\put(726,224){\sx{1.5}{\rot{90}{\bf 2015.10.12}\ero}}
\put(776,224){\sx{1.5}{\rot{90}{\bf 2015.12.01}\ero}}
\put(826,224){\sx{1.5}{\rot{90}{\bf 2016.03.10}\ero}}
\put(876,224){\sx{1.5}{\rot{90}{\bf 2016.04.29}\ero}}
\put(596,160){\sx{2.1}{\rot{-26} $y = 240 - 0.48 x$\ero}}
\put(580,132){\sx{2.1}{\rot{-30} $y\!=\!227.37\! -\! 0.5833x$\ero}}
\put( 20,239){\sx{1.8}{\rot{29} $y\!=\!\mathrm{Arc}(x)$\ero}}
\put( 36,178){\sx{2}{\rot{45} $y\!=\!\mathrm{Ellipse}(x)$\ero}}
\put( 526,98){\sx{2}{\rot{-33} $y\!=\!\mathrm{Exc}(x)$\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
current06:09, 1 December 2018Thumbnail for version as of 06:09, 1 December 20181,867 × 747 (271 KB)Maintenance script (talk | contribs)Importing image file
  • You cannot overwrite this file.

There are no pages that link to this file.

Metadata