Difference between revisions of "File:Arctra1n3aT.jpg"
(Importing image file) |
|||
Line 1: | Line 1: | ||
+ | Agreement for the approximation of function [[ArcTra]] with 3 iterations by the [[Newton method]], using |
||
− | Importing image file |
||
+ | the primary approximation app1, which is Taylor expansion at unity. |
||
+ | |||
+ | ==[[C++]] generator of curves== |
||
+ | //<poem><nomathjax><nowiki> |
||
+ | #include <math.h> |
||
+ | #include <stdio.h> |
||
+ | #include <stdlib.h> |
||
+ | #define DB double |
||
+ | #define DO(x,y) for(x=0;x<y;x++) |
||
+ | using namespace std; |
||
+ | #include<complex> |
||
+ | typedef complex<double> z_type; |
||
+ | #define Re(x) x.real() |
||
+ | #define Im(x) x.imag() |
||
+ | #define I z_type(0.,1.) |
||
+ | #include "conto.cin" |
||
+ | //z_type zex(z_type z){ return z*exp(z);} |
||
+ | z_type tra(z_type z){ return z+exp(z);} |
||
+ | //#include "Tania.cin" |
||
+ | //#include "LambertW.cin" |
||
+ | //z_type ArcTra(z_type z){ return z-LambertW(exp(z));} |
||
+ | |||
+ | z_type arctra1(z_type z){ |
||
+ | static DB c[22]={0.,0.5,-0.0625,.005208333333333333, // 0 - 3 |
||
+ | 0.0003255208333333333, -0.00021158854166666667, //5 |
||
+ | 0.00003187391493055556, 1.7680819072420636e-6, //7 |
||
+ | -1.8520960732111855e-6, 3.5344398000673434e-7, //9 |
||
+ | 8.173825669330684e-9, -2.0624513960198102e-8, //11 |
||
+ | 4.727254469326131e-9, -5.254838295493782e-11, //13 |
||
+ | -2.5497322696797093e-10,6.897078914225712e-11, //15 |
||
+ | -3.004636375311634e-12,-3.313983848679892e-12, //17 |
||
+ | 1.054773386200646e-12,-7.811289918947213e-14, //19 |
||
+ | -4.391790189701172e-14, 1.6573692169992586e-14}; //21 |
||
+ | z_type t=z-1.; z_type s=c[21]*z; int n; |
||
+ | for(n=20;n>0;n--){ s+=c[n]; s*=t;} |
||
+ | return s;} |
||
+ | |||
+ | z_type arctra1n3(z_type z) { z_type t=arctra1(z); |
||
+ | t+=(z-t-exp(t))/(1.+exp(t)); |
||
+ | t+=(z-t-exp(t))/(1.+exp(t)); |
||
+ | t+=(z-t-exp(t))/(1.+exp(t)); |
||
+ | return t; |
||
+ | } |
||
+ | |||
+ | int main(){ int j,k,m,n; DB x1,x,y, p,q, t; z_type z,c,d, cu,cd; |
||
+ | int M=601,M1=M+1; |
||
+ | int N=601,N1=N+1; |
||
+ | DB X[M1],Y[N1]; |
||
+ | DB *g, *f, *w; // w is working array. |
||
+ | g=(DB *)malloc((size_t)((M1*N1)*sizeof(DB))); |
||
+ | f=(DB *)malloc((size_t)((M1*N1)*sizeof(DB))); |
||
+ | w=(DB *)malloc((size_t)((M1*N1)*sizeof(DB))); |
||
+ | char v[M1*N1]; // v is working array |
||
+ | FILE *o;o=fopen("arctra1tes3a.eps","w"); ado(o,1202,1202); |
||
+ | fprintf(o,"601 601 translate\n 100 100 scale\n"); |
||
+ | fprintf(o,"1 setlinejoin 2 setlinecap\n"); |
||
+ | DO(m,M1) X[m]=-6.+.02*(m-.5); |
||
+ | DO(n,N1) Y[n]=-6.+.02*(n-.5); |
||
+ | //for(n=0;n<N1;n++) { Y[n]=0.6*sinh((3./200.)*(n-200.5)); printf("%3d %9.6f\n",n,Y[n]); } |
||
+ | for(m=-6;m<7;m++) {M(m,-6)L(m,6)} |
||
+ | for(n=-6;n<7;n++) {M( -6,n)L(6,n)} fprintf(o,".006 W 0 0 0 RGB S\n"); |
||
+ | DO(m,M1)DO(n,N1){ g[m*N1+n]=999; |
||
+ | f[m*N1+n]=999;} |
||
+ | DO(m,M1){x=X[m]; if(m/10*10==m) printf("x=%6.3f\n",x); |
||
+ | DO(n,N1){y=Y[n]; z=z_type(x,y); |
||
+ | // c=ArcTra(z); |
||
+ | // c=Tania(z+1.); // WrightOmega(z); |
||
+ | // c=z-Tania(z-1.); |
||
+ | c=arctra1n3(z); |
||
+ | c=tra(c); |
||
+ | p=-log( abs(c-z)/(abs(c)+abs(z)) )/log(10.); |
||
+ | //p=Re(c); q=Im(c); |
||
+ | if(p>-19 && p<19 ) g[m*N1+n]=p; |
||
+ | // if(p>-19 && p<19 && fabs(q)>1.e-12 && fabs(p)>1.e-12) |
||
+ | //f[m*N1+n]=q; |
||
+ | }} |
||
+ | fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.;q=.1; |
||
+ | /* |
||
+ | for(m=-8;m<8;m++)for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q,q);fprintf(o,".007 W 0 .6 0 RGB S\n"); |
||
+ | for(m=0;m<8;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q,q);fprintf(o,".007 W .9 0 0 RGB S\n"); |
||
+ | for(m=0;m<8;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q,q);fprintf(o,".007 W 0 0 .9 RGB S\n"); |
||
+ | for(m= 1;m<17;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p);fprintf(o,".02 W .8 0 0 RGB S\n"); |
||
+ | for(m= 1;m<17;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p);fprintf(o,".02 W 0 0 .8 RGB S\n"); |
||
+ | conto(o,f,w,v,X,Y,M,N, (0. ),-p,p); fprintf(o,".02 W .5 0 .5 RGB S\n"); |
||
+ | for(m=-16;m<17;m++)conto(o,g,w,v,X,Y,M,N,(0.+m),-p,p);fprintf(o,".02 W 0 0 0 RGB S\n"); |
||
+ | |||
+ | M(-6, M_PI)L(-1, M_PI) |
||
+ | M(-6,-M_PI)L(-1,-M_PI) |
||
+ | fprintf(o,".01 W 1 1 1 RGB S\n"); |
||
+ | */ |
||
+ | |||
+ | conto(o,g,w,v,X,Y,M,N,(16. ),-p,p); fprintf(o,".01 W .5 0 .7 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (1. ),-p,p); fprintf(o,".06 W 1 .5 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (2. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (3. ),-p,p); fprintf(o,".04 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (4. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (5. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (6. ),-p,p); fprintf(o,".04 W 1 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (7. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (8. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N, (9. ),-p,p); fprintf(o,".04 W 0 .8 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N,(10. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N,(11. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N,(12. ),-p,p); fprintf(o,".04 W 0 0 1 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N,(13. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N,(14. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n"); |
||
+ | conto(o,g,w,v,X,Y,M,N,(15. ),-p,p); fprintf(o,".04 W .7 0 1 RGB S\n"); |
||
+ | |||
+ | |||
+ | fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%'); |
||
+ | fclose(o); free(f); free(g); free(w); |
||
+ | system("epstopdf arctra1tes3a.eps"); |
||
+ | system( "open arctra1tes3a.pdf"); //for macintosh |
||
+ | getchar(); system("killall Preview"); // For macintosh |
||
+ | } |
||
+ | </nowiki></nomathjax></poem> |
||
+ | |||
+ | ==[[Latex]] generator of labels== |
||
+ | %<poem><nomathjax><nowiki> |
||
+ | \documentclass[12pt]{article} |
||
+ | \paperheight 1228px |
||
+ | \paperwidth 1236px |
||
+ | \textwidth 1394px |
||
+ | \textheight 1300px |
||
+ | \topmargin -104px |
||
+ | \oddsidemargin -78px |
||
+ | \usepackage{graphics} |
||
+ | \usepackage{rotating} |
||
+ | \newcommand \sx {\scalebox} |
||
+ | \newcommand \rot {\begin{rotate}} |
||
+ | \newcommand \ero {\end{rotate}} |
||
+ | \newcommand \ing {\includegraphics} |
||
+ | \newcommand \rmi {\mathrm{i}} |
||
+ | \begin{document} |
||
+ | \newcommand \zoomax { |
||
+ | \put(18,1206){\sx{3.3}{$y$}} |
||
+ | \put(18,1113){\sx{3}{$5$}} |
||
+ | \put(18,1013){\sx{3}{$4$}} |
||
+ | \put(18, 913){\sx{3}{$3$}} |
||
+ | \put(18, 813){\sx{3}{$2$}} |
||
+ | \put(18, 713){\sx{3}{$1$}} |
||
+ | \put(18, 613){\sx{3}{$0$}} |
||
+ | \put(-6, 513){\sx{3}{$-1$}} |
||
+ | \put(-6, 413){\sx{3}{$-2$}} |
||
+ | \put(-6, 313){\sx{3}{$-3$}} |
||
+ | \put(-6, 213){\sx{3}{$-4$}} |
||
+ | \put(-6, 113){\sx{3}{$-5$}} |
||
+ | \put(-6, 013){\sx{3}{$-6$}} |
||
+ | \put(014, -5){\sx{3}{$-6$}} |
||
+ | \put(114, -5){\sx{3}{$-5$}} |
||
+ | \put(214, -5){\sx{3}{$-4$}} |
||
+ | \put(314, -5){\sx{3}{$-3$}} |
||
+ | \put(414, -5){\sx{3}{$-2$}} |
||
+ | \put(514, -5){\sx{3}{$-1$}} |
||
+ | \put(635, -5){\sx{3}{$0$}} |
||
+ | \put(735, -5){\sx{3}{$1$}} |
||
+ | \put(835, -5){\sx{3}{$2$}} |
||
+ | \put(935, -5){\sx{3}{$3$}} |
||
+ | \put(1035, -5){\sx{3}{$4$}} |
||
+ | \put(1135, -5){\sx{3}{$5$}} |
||
+ | \put(1227,-4){\sx{3}{$x$}} |
||
+ | } |
||
+ | \parindent 0pt |
||
+ | \sx{1}{\begin{picture}(1252,1220) |
||
+ | %\put(40,20){\ing{ArcTraMap}} |
||
+ | \put(40,20){\ing{arctra1tes3a}} |
||
+ | \zoomax |
||
+ | \put(1070,1158){\sx{6}{$\mathcal A\!<\!1$}} |
||
+ | \put(666,604){\sx{5}{$\mathcal A\!>\!15$}} |
||
+ | \end{picture}} |
||
+ | \end{document} |
||
+ | </nowiki></nomathjax></poem> |
||
+ | |||
+ | ==References== |
||
+ | <references/> |
||
+ | |||
+ | [[Category:ArcTra]] |
||
+ | [[Category:Approximation]] |
||
+ | [[Category:Taylor expansion]] |
||
+ | [[Category:Trappmann function]] |
||
+ | [[Category:Inverse function]] |
||
+ | [[Category:C++]] |
||
+ | [[Category:Latex]] |
||
+ | [[Category:Agreement map]] |
Latest revision as of 08:30, 1 December 2018
Agreement for the approximation of function ArcTra with 3 iterations by the Newton method, using the primary approximation app1, which is Taylor expansion at unity.
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++)
using namespace std;
#include<complex>
typedef complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "conto.cin"
//z_type zex(z_type z){ return z*exp(z);}
z_type tra(z_type z){ return z+exp(z);}
//#include "Tania.cin"
//#include "LambertW.cin"
//z_type ArcTra(z_type z){ return z-LambertW(exp(z));}
z_type arctra1(z_type z){
static DB c[22]={0.,0.5,-0.0625,.005208333333333333, // 0 - 3
0.0003255208333333333, -0.00021158854166666667, //5
0.00003187391493055556, 1.7680819072420636e-6, //7
-1.8520960732111855e-6, 3.5344398000673434e-7, //9
8.173825669330684e-9, -2.0624513960198102e-8, //11
4.727254469326131e-9, -5.254838295493782e-11, //13
-2.5497322696797093e-10,6.897078914225712e-11, //15
-3.004636375311634e-12,-3.313983848679892e-12, //17
1.054773386200646e-12,-7.811289918947213e-14, //19
-4.391790189701172e-14, 1.6573692169992586e-14}; //21
z_type t=z-1.; z_type s=c[21]*z; int n;
for(n=20;n>0;n--){ s+=c[n]; s*=t;}
return s;}
z_type arctra1n3(z_type z) { z_type t=arctra1(z);
t+=(z-t-exp(t))/(1.+exp(t));
t+=(z-t-exp(t))/(1.+exp(t));
t+=(z-t-exp(t))/(1.+exp(t));
return t;
}
int main(){ int j,k,m,n; DB x1,x,y, p,q, t; z_type z,c,d, cu,cd;
int M=601,M1=M+1;
int N=601,N1=N+1;
DB X[M1],Y[N1];
DB *g, *f, *w; // w is working array.
g=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
f=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
w=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
char v[M1*N1]; // v is working array
FILE *o;o=fopen("arctra1tes3a.eps","w"); ado(o,1202,1202);
fprintf(o,"601 601 translate\n 100 100 scale\n");
fprintf(o,"1 setlinejoin 2 setlinecap\n");
DO(m,M1) X[m]=-6.+.02*(m-.5);
DO(n,N1) Y[n]=-6.+.02*(n-.5);
//for(n=0;n<N1;n++) { Y[n]=0.6*sinh((3./200.)*(n-200.5)); printf("%3d %9.6f\n",n,Y[n]); }
for(m=-6;m<7;m++) {M(m,-6)L(m,6)}
for(n=-6;n<7;n++) {M( -6,n)L(6,n)} fprintf(o,".006 W 0 0 0 RGB S\n");
DO(m,M1)DO(n,N1){ g[m*N1+n]=999;
f[m*N1+n]=999;}
DO(m,M1){x=X[m]; if(m/10*10==m) printf("x=%6.3f\n",x);
DO(n,N1){y=Y[n]; z=z_type(x,y);
// c=ArcTra(z);
// c=Tania(z+1.); // WrightOmega(z);
// c=z-Tania(z-1.);
c=arctra1n3(z);
c=tra(c);
p=-log( abs(c-z)/(abs(c)+abs(z)) )/log(10.);
//p=Re(c); q=Im(c);
if(p>-19 && p<19 ) g[m*N1+n]=p;
// if(p>-19 && p<19 && fabs(q)>1.e-12 && fabs(p)>1.e-12)
//f[m*N1+n]=q;
}}
fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.;q=.1;
/*
for(m=-8;m<8;m++)for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q,q);fprintf(o,".007 W 0 .6 0 RGB S\n");
for(m=0;m<8;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q,q);fprintf(o,".007 W .9 0 0 RGB S\n");
for(m=0;m<8;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q,q);fprintf(o,".007 W 0 0 .9 RGB S\n");
for(m= 1;m<17;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p);fprintf(o,".02 W .8 0 0 RGB S\n");
for(m= 1;m<17;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p);fprintf(o,".02 W 0 0 .8 RGB S\n");
conto(o,f,w,v,X,Y,M,N, (0. ),-p,p); fprintf(o,".02 W .5 0 .5 RGB S\n");
for(m=-16;m<17;m++)conto(o,g,w,v,X,Y,M,N,(0.+m),-p,p);fprintf(o,".02 W 0 0 0 RGB S\n");
M(-6, M_PI)L(-1, M_PI)
M(-6,-M_PI)L(-1,-M_PI)
fprintf(o,".01 W 1 1 1 RGB S\n");
*/
conto(o,g,w,v,X,Y,M,N,(16. ),-p,p); fprintf(o,".01 W .5 0 .7 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (1. ),-p,p); fprintf(o,".06 W 1 .5 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (2. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (3. ),-p,p); fprintf(o,".04 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (4. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (5. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (6. ),-p,p); fprintf(o,".04 W 1 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (7. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (8. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N, (9. ),-p,p); fprintf(o,".04 W 0 .8 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N,(10. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N,(11. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N,(12. ),-p,p); fprintf(o,".04 W 0 0 1 RGB S\n");
conto(o,g,w,v,X,Y,M,N,(13. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N,(14. ),-p,p); fprintf(o,".01 W 0 0 0 RGB S\n");
conto(o,g,w,v,X,Y,M,N,(15. ),-p,p); fprintf(o,".04 W .7 0 1 RGB S\n");
fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%');
fclose(o); free(f); free(g); free(w);
system("epstopdf arctra1tes3a.eps");
system( "open arctra1tes3a.pdf"); //for macintosh
getchar(); system("killall Preview"); // For macintosh
}
Latex generator of labels
%
\documentclass[12pt]{article}
\paperheight 1228px
\paperwidth 1236px
\textwidth 1394px
\textheight 1300px
\topmargin -104px
\oddsidemargin -78px
\usepackage{graphics}
\usepackage{rotating}
\newcommand \sx {\scalebox}
\newcommand \rot {\begin{rotate}}
\newcommand \ero {\end{rotate}}
\newcommand \ing {\includegraphics}
\newcommand \rmi {\mathrm{i}}
\begin{document}
\newcommand \zoomax {
\put(18,1206){\sx{3.3}{$y$}}
\put(18,1113){\sx{3}{$5$}}
\put(18,1013){\sx{3}{$4$}}
\put(18, 913){\sx{3}{$3$}}
\put(18, 813){\sx{3}{$2$}}
\put(18, 713){\sx{3}{$1$}}
\put(18, 613){\sx{3}{$0$}}
\put(-6, 513){\sx{3}{$-1$}}
\put(-6, 413){\sx{3}{$-2$}}
\put(-6, 313){\sx{3}{$-3$}}
\put(-6, 213){\sx{3}{$-4$}}
\put(-6, 113){\sx{3}{$-5$}}
\put(-6, 013){\sx{3}{$-6$}}
\put(014, -5){\sx{3}{$-6$}}
\put(114, -5){\sx{3}{$-5$}}
\put(214, -5){\sx{3}{$-4$}}
\put(314, -5){\sx{3}{$-3$}}
\put(414, -5){\sx{3}{$-2$}}
\put(514, -5){\sx{3}{$-1$}}
\put(635, -5){\sx{3}{$0$}}
\put(735, -5){\sx{3}{$1$}}
\put(835, -5){\sx{3}{$2$}}
\put(935, -5){\sx{3}{$3$}}
\put(1035, -5){\sx{3}{$4$}}
\put(1135, -5){\sx{3}{$5$}}
\put(1227,-4){\sx{3}{$x$}}
}
\parindent 0pt
\sx{1}{\begin{picture}(1252,1220)
%\put(40,20){\ing{ArcTraMap}}
\put(40,20){\ing{arctra1tes3a}}
\zoomax
\put(1070,1158){\sx{6}{$\mathcal A\!<\!1$}}
\put(666,604){\sx{5}{$\mathcal A\!>\!15$}}
\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 | 06:10, 1 December 2018 | 2,575 × 2,558 (1.46 MB) | Maintenance script (talk | contribs) | Importing image file |
You cannot overwrite this file.
File usage
The following page uses this file: