Difference between revisions of "File:Fracit20t150.jpg"
(C++) |
|||
Line 10: | Line 10: | ||
$y=f^n(x)$ is plotted versus $x$ for various values of $n$. |
$y=f^n(x)$ is plotted versus $x$ for various values of $n$. |
||
+ | ==Generator of curves== |
||
⚫ | |||
+ | //<poem><nomathjax><nowiki> |
||
⚫ | |||
+ | #include<stdio.h> |
||
⚫ | |||
+ | #include<stdlib.h> |
||
+ | #define DO(x,y) for(x=0;x<y;x++) |
||
+ | #define DB double |
||
+ | #include"ado.cin" |
||
+ | DB c=2.; |
||
+ | //DB F(DB n,DB x){ DB cn=pow(c,n); DB r=(1.-cn)/(1.-c); return x/( cn + r*x); } |
||
+ | DB F(DB n,DB x){ if(c==1.) return x/(1.+n*x); DB cn=pow(c,n); DB r=(1.-cn)/(1.-c); return x/( cn + r*x); } |
||
+ | |||
+ | main(){ FILE *o; int m,n,k; DB x,y,t; |
||
+ | o=fopen("fracit20.eps","w"); |
||
+ | ado(o,702,702); |
||
+ | #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,"101 101 translate 100 100 scale 2 setlinecap\n"); |
||
+ | for(n=-1;n<7;n++) { M(-1,n)L(6,n)} |
||
+ | for(m=-1;m<7;m++) { M(m,-1)L(m,6)} |
||
+ | fprintf(o,".01 W S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-4.,x);if(y>-10.4&&y<10.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-3.,x);if(y>-8.4&&y<8.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-2.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-1.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 1.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 2.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 3.,x);if(y>-8.4&&y<8.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 4.,x);if(y>-10.4&&y<10.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n"); |
||
+ | DO(k,41){ t=-2.+.1*k; |
||
+ | n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(t,x);if(y>-7.2&&y<7.2){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | } |
||
+ | fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%'); |
||
+ | fclose(o); |
||
+ | system("epstopdf fracit20.eps"); |
||
+ | system( "open fracit20.pdf"); |
||
+ | } |
||
+ | //</nowiki></nomathjax></poem> |
||
+ | |||
+ | ==Latex generator of labels== |
||
+ | |||
+ | ==References== |
||
+ | <references/> |
||
+ | |||
+ | [[Category:C++]] |
||
[[Category:Elementary function]] |
[[Category:Elementary function]] |
||
[[Category:Explicit plot]] |
[[Category:Explicit plot]] |
||
⚫ | |||
⚫ | |||
+ | [[Category:Latex]] |
||
⚫ |
Revision as of 21:08, 4 August 2013
$\displaystyle f(z)=\frac{x}{c+z}$ at $c\!=\!2$.
In general the $n$th iterate of $f$ can be expressed as follows:
$\displaystyle f^n(z)=\frac{z}{c^n+\frac{1-c^n}{1-c} z}$
$y=f^n(x)$ is plotted versus $x$ for various values of $n$.
Generator of curves
//
#include<stdio.h>
#include<stdlib.h>
#define DO(x,y) for(x=0;x<y;x++)
#define DB double
#include"ado.cin"
DB c=2.;
//DB F(DB n,DB x){ DB cn=pow(c,n); DB r=(1.-cn)/(1.-c); return x/( cn + r*x); }
DB F(DB n,DB x){ if(c==1.) return x/(1.+n*x); DB cn=pow(c,n); DB r=(1.-cn)/(1.-c); return x/( cn + r*x); }
main(){ FILE *o; int m,n,k; DB x,y,t;
o=fopen("fracit20.eps","w");
ado(o,702,702);
#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,"101 101 translate 100 100 scale 2 setlinecap\n");
for(n=-1;n<7;n++) { M(-1,n)L(6,n)}
for(m=-1;m<7;m++) { M(m,-1)L(m,6)}
fprintf(o,".01 W S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-4.,x);if(y>-10.4&&y<10.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-3.,x);if(y>-8.4&&y<8.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-2.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(-1.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 1 0 1 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 1.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 2.,x);if(y>-7.4&&y<7.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 3.,x);if(y>-8.4&&y<8.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n");
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F( 4.,x);if(y>-10.4&&y<10.4){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".03 W 0 1 0 RGB S\n");
DO(k,41){ t=-2.+.1*k;
n=0;DO(m,1401){x=-1.+.005*(m-.5);y=F(t,x);if(y>-7.2&&y<7.2){ if(n==0){M(x,y) n=1;}else L(x,y)} else n=0;} fprintf(o,".01 W 0 0 0 RGB S\n");
}
fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%');
fclose(o);
system("epstopdf fracit20.eps");
system( "open fracit20.pdf");
}
//
Latex generator of labels
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 | 20:59, 4 August 2013 | 1,466 × 1,466 (463 KB) | T (talk | contribs) | Iterate of the linear fraction function $\displaystyle f(z)=\frac{x}{c+z}$ at $c\!=\!2$. In general the $n$th iterate of $f$ can be expressed as follows: $\displaystyle f^n(z)=\frac{z}{c^n+\frac{1-c^n}{1-c} z}$ $y=f^n(x)$ is plotted versus $x$... |
You cannot overwrite this file.
File usage
The following page uses this file: