Difference between revisions of "File:Itelin125T.jpg"
(Iterates of the linear function $T(z)=A+B z$ for $A\!=\!1$, $B\!=\!2. $y=T^n(x)$ is plotted versus $x$ for various values of $n$. Category:Linear function Category:Iteration Category:Explicit plot Category:C++ Cateogry:Latex) |
|||
(4 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
$T(z)=A+B z$ |
$T(z)=A+B z$ |
||
− | for $A\!=\!1$, $B\!=\!2 |
+ | for $A\!=\!1$, $B\!=\!2$ |
$y=T^n(x)$ is plotted versus $x$ for various values of $n$. |
$y=T^n(x)$ is plotted versus $x$ for various values of $n$. |
||
+ | ==[[C++]] Generator of lines== |
||
− | [[Category:Linear function]] |
||
+ | // File [[ado.cin]] should be loaded in the working directory in order to compile the [[C++]] code below |
||
− | [[Category:Iteration]] |
||
+ | //<nomathjax><poem><nowiki> |
||
− | [[Category:Explicit plot]] |
||
+ | #include<math.h> |
||
+ | #include<stdio.h> |
||
+ | #include<stdlib.h> |
||
+ | #define DO(x,y) for(x=0;x<y;x++) |
||
+ | #define DB double |
||
+ | #include"ado.cin" |
||
+ | |||
+ | DB A=1.0000; |
||
+ | DB B=2.000; |
||
+ | DB T(DB c,DB x){ DB Bc=pow(B,c); return A*(Bc-1.)/(B-1.) + Bc*x; } |
||
+ | DB U(DB c,DB x){ DB Bc=pow(B,c); return (x-A*(Bc-1.)/(B-1.))/Bc; } |
||
+ | |||
+ | int main(){ FILE *o; int m,n,k; DB c, x,y,t; |
||
+ | o=fopen("itelin125.eps","w"); |
||
+ | ado(o,1002,1002); |
||
+ | #define M(x,y) fprintf(o,"%7.4f %7.4f M\n",0.+x,0.+y); |
||
+ | #define L(x,y) fprintf(o,"%7.4f %7.4f L\n",0.+x,0.+y); |
||
+ | fprintf(o,"501 501 translate 100 100 scale 2 setlinecap\n"); |
||
+ | for(n=-5;n<6;n++) { M(-5,n)L(5,n)} |
||
+ | for(m=-5;m<6;m++) { M(m,-5)L(m,5)} |
||
+ | fprintf(o,".004 W S\n"); |
||
+ | c= 40.001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | c= 4.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | c= 3.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | c= 2.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | c= 1.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | c= 0.000001; x=-5.;y=T(c,x); if(y<-7.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".02 W 0 0 0 RGB S\n"); |
||
+ | c=-1.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | c=-2.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | c=-3.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | c=-4.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | c=-40.0001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | DO(n,31){c=-3.000001+.2*n; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);} |
||
+ | fprintf(o,".012 W 0 0 0 RGB S\n"); |
||
+ | fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%'); |
||
+ | fclose(o); |
||
+ | system("epstopdf itelin125.eps"); |
||
+ | system( "open itelin125.pdf"); |
||
+ | } |
||
+ | //</nowiki></poem></nomathjax> |
||
+ | |||
+ | |||
+ | ==[[Latex]] generator of curves== |
||
+ | %<nomathjax><poem><nowiki> |
||
+ | \documentclass[12pt]{article} |
||
+ | \paperwidth 1006pt |
||
+ | \paperheight 1006pt |
||
+ | \textwidth 1800pt |
||
+ | \textheight 1800pt |
||
+ | \topmargin -108pt |
||
+ | \oddsidemargin -72pt |
||
+ | \parindent 0pt |
||
+ | \pagestyle{empty} |
||
+ | \usepackage {graphics} |
||
+ | \usepackage{rotating} |
||
+ | \newcommand \rot {\begin{rotate}} |
||
+ | \newcommand \ero {\end{rotate}} |
||
+ | \newcommand \ing {\includegraphics} |
||
+ | \newcommand \sx {\scalebox} |
||
+ | \begin{document} |
||
+ | \begin{picture}(1004,1004) |
||
+ | \put(0,0){\ing{itelin125}} |
||
+ | \put(480,984){\sx{3}{$y$}} |
||
+ | \put(480,892){\sx{3}{$4$}} |
||
+ | \put(480,792){\sx{3}{$3$}} |
||
+ | \put(480,692){\sx{3}{$2$}} |
||
+ | \put(480,592){\sx{3}{$1$}} |
||
+ | \put(479,492){\sx{3}{$0$}} |
||
+ | \put(454,391){\sx{3}{$-1$}} |
||
+ | \put(454,291){\sx{3}{$-2$}} |
||
+ | \put(454,191){\sx{3}{$-3$}} |
||
+ | \put(454,91){\sx{3}{$-4$}} |
||
+ | |||
+ | \put(70,475){\sx{3}{$-4$}} |
||
+ | \put(170,475){\sx{3}{$-3$}} |
||
+ | \put(270,475){\sx{3}{$-2$}} |
||
+ | \put(370,475){\sx{3}{$-1$}} |
||
+ | \put(495,475){\sx{3}{$0$}} |
||
+ | \put(595,475){\sx{3}{$1$}} |
||
+ | \put(695,475){\sx{3}{$2$}} |
||
+ | \put(795,475){\sx{3}{$3$}} |
||
+ | \put(895,475){\sx{3}{$4$}} |
||
+ | \put(984,476){\sx{3.1}{$x$}} |
||
+ | |||
+ | \put(410,870){\rot{89}\sx{3.1}{$n\!\rightarrow\!\infty$}\ero} |
||
+ | \put(440,870){\rot{84}\sx{3.1}{$n\!=\!4$}\ero} |
||
+ | \put(470,870){\rot{82}\sx{3.1}{$n\!=\!3$}\ero} |
||
+ | \put(530,870){\rot{74}\sx{3.1}{$n\!=\!2$}\ero} |
||
+ | \put(616,870){\rot{65}\sx{3.1}{$n\!=\!1.2$}\ero} |
||
+ | \put(646,870){\rot{62}\sx{3.1}{$n\!=\!1$}\ero} |
||
+ | \put(682,870){\rot{59}\sx{3.1}{$n\!=\!0.8$}\ero} |
||
+ | \put(724,870){\rot{57}\sx{3.1}{$n\!=\!0.6$}\ero} |
||
+ | \put(768,870){\rot{53}\sx{3.1}{$n\!=\!0.4$}\ero} |
||
+ | \put(822,870){\rot{48}\sx{3.1}{$n\!=\!0.2$}\ero} |
||
+ | \put(880,867){\rot{45}\sx{3.1}{$n\!=\!0$}\ero} |
||
+ | \put(890,813){\rot{41}\sx{3.1}{$n\!=\!-0.2$}\ero} |
||
+ | \put(889,760){\rot{36}\sx{3.1}{$n\!=\!-0.4$}\ero} |
||
+ | \put(889,712){\rot{32}\sx{3.1}{$n\!=\!-0.6$}\ero} |
||
+ | \put(889,671){\rot{29}\sx{3.1}{$n\!=\!-0.8$}\ero} |
||
+ | \put(889,633){\rot{26}\sx{3.1}{$n\!=\!-1$}\ero} |
||
+ | \put(905,518){\rot{13}\sx{3.1}{$n\!=\!-2$}\ero} |
||
+ | \put(900,422){\rot{4}\sx{3.1}{$n\!=\!-4$}\ero} |
||
+ | \put(874,392){\rot{.01}\sx{3.1}{$n\!\rightarrow\!-\infty$}\ero} |
||
+ | \end{picture} |
||
+ | \end{document} |
||
+ | |||
+ | %</nowiki></poem></nomathjax> |
||
+ | |||
+ | ==References== |
||
+ | |||
+ | [[Category:Book]] |
||
+ | [[Category:BookPlot]] |
||
[[Category:C++]] |
[[Category:C++]] |
||
+ | [[Category:Explicit plot]] |
||
− | [[Cateogry:Latex]] |
||
+ | [[Category:Iteration]] |
||
+ | [[Category:Latex]] |
||
+ | [[Category:Linear function]] |
Latest revision as of 08:38, 1 December 2018
Iterates of the linear function
$T(z)=A+B z$
for $A\!=\!1$, $B\!=\!2$
$y=T^n(x)$ is plotted versus $x$ for various values of $n$.
C++ Generator of lines
// File ado.cin should be loaded in the working directory in order to compile the C++ code below
//
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#define DO(x,y) for(x=0;x<y;x++)
#define DB double
#include"ado.cin"
DB A=1.0000;
DB B=2.000;
DB T(DB c,DB x){ DB Bc=pow(B,c); return A*(Bc-1.)/(B-1.) + Bc*x; }
DB U(DB c,DB x){ DB Bc=pow(B,c); return (x-A*(Bc-1.)/(B-1.))/Bc; }
int main(){ FILE *o; int m,n,k; DB c, x,y,t;
o=fopen("itelin125.eps","w");
ado(o,1002,1002);
#define M(x,y) fprintf(o,"%7.4f %7.4f M\n",0.+x,0.+y);
#define L(x,y) fprintf(o,"%7.4f %7.4f L\n",0.+x,0.+y);
fprintf(o,"501 501 translate 100 100 scale 2 setlinecap\n");
for(n=-5;n<6;n++) { M(-5,n)L(5,n)}
for(m=-5;m<6;m++) { M(m,-5)L(m,5)}
fprintf(o,".004 W S\n");
c= 40.001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n");
c= 4.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n");
c= 3.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n");
c= 2.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n");
c= 1.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 0 1 0 RGB S\n");
c= 0.000001; x=-5.;y=T(c,x); if(y<-7.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".02 W 0 0 0 RGB S\n");
c=-1.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n");
c=-2.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n");
c=-3.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n");
c=-4.000001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n");
c=-40.0001; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);fprintf(o,".03 W 1 0 1 RGB S\n");
DO(n,31){c=-3.000001+.2*n; x=-5.;y=T(c,x); if(y<-5.){y=-5.;x=U(c,y);} M(x,y);x=5.;y=T(c,x); if(y>5.){y=5.;x=U(c,y);}L(x,y);}
fprintf(o,".012 W 0 0 0 RGB S\n");
fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%');
fclose(o);
system("epstopdf itelin125.eps");
system( "open itelin125.pdf");
}
//
Latex generator of curves
%
\documentclass[12pt]{article}
\paperwidth 1006pt
\paperheight 1006pt
\textwidth 1800pt
\textheight 1800pt
\topmargin -108pt
\oddsidemargin -72pt
\parindent 0pt
\pagestyle{empty}
\usepackage {graphics}
\usepackage{rotating}
\newcommand \rot {\begin{rotate}}
\newcommand \ero {\end{rotate}}
\newcommand \ing {\includegraphics}
\newcommand \sx {\scalebox}
\begin{document}
\begin{picture}(1004,1004)
\put(0,0){\ing{itelin125}}
\put(480,984){\sx{3}{$y$}}
\put(480,892){\sx{3}{$4$}}
\put(480,792){\sx{3}{$3$}}
\put(480,692){\sx{3}{$2$}}
\put(480,592){\sx{3}{$1$}}
\put(479,492){\sx{3}{$0$}}
\put(454,391){\sx{3}{$-1$}}
\put(454,291){\sx{3}{$-2$}}
\put(454,191){\sx{3}{$-3$}}
\put(454,91){\sx{3}{$-4$}}
\put(70,475){\sx{3}{$-4$}}
\put(170,475){\sx{3}{$-3$}}
\put(270,475){\sx{3}{$-2$}}
\put(370,475){\sx{3}{$-1$}}
\put(495,475){\sx{3}{$0$}}
\put(595,475){\sx{3}{$1$}}
\put(695,475){\sx{3}{$2$}}
\put(795,475){\sx{3}{$3$}}
\put(895,475){\sx{3}{$4$}}
\put(984,476){\sx{3.1}{$x$}}
\put(410,870){\rot{89}\sx{3.1}{$n\!\rightarrow\!\infty$}\ero}
\put(440,870){\rot{84}\sx{3.1}{$n\!=\!4$}\ero}
\put(470,870){\rot{82}\sx{3.1}{$n\!=\!3$}\ero}
\put(530,870){\rot{74}\sx{3.1}{$n\!=\!2$}\ero}
\put(616,870){\rot{65}\sx{3.1}{$n\!=\!1.2$}\ero}
\put(646,870){\rot{62}\sx{3.1}{$n\!=\!1$}\ero}
\put(682,870){\rot{59}\sx{3.1}{$n\!=\!0.8$}\ero}
\put(724,870){\rot{57}\sx{3.1}{$n\!=\!0.6$}\ero}
\put(768,870){\rot{53}\sx{3.1}{$n\!=\!0.4$}\ero}
\put(822,870){\rot{48}\sx{3.1}{$n\!=\!0.2$}\ero}
\put(880,867){\rot{45}\sx{3.1}{$n\!=\!0$}\ero}
\put(890,813){\rot{41}\sx{3.1}{$n\!=\!-0.2$}\ero}
\put(889,760){\rot{36}\sx{3.1}{$n\!=\!-0.4$}\ero}
\put(889,712){\rot{32}\sx{3.1}{$n\!=\!-0.6$}\ero}
\put(889,671){\rot{29}\sx{3.1}{$n\!=\!-0.8$}\ero}
\put(889,633){\rot{26}\sx{3.1}{$n\!=\!-1$}\ero}
\put(905,518){\rot{13}\sx{3.1}{$n\!=\!-2$}\ero}
\put(900,422){\rot{4}\sx{3.1}{$n\!=\!-4$}\ero}
\put(874,392){\rot{.01}\sx{3.1}{$n\!\rightarrow\!-\infty$}\ero}
\end{picture}
\end{document}
%
References
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 19:00, 18 September 2013 | 2,088 × 2,088 (893 KB) | T (talk | contribs) | Iterates of the linear function $T(z)=A+B z$ for $A\!=\!1$, $B\!=\!2. $y=T^n(x)$ is plotted versus $x$ for various values of $n$. Category:Linear function Category:Iteration Category:Explicit plot Category:C++ Cateogry:Latex |
You cannot overwrite this file.
File usage
The following page uses this file: