File:LambertWplotT.png
Original file (1,267 × 839 pixels, file size: 81 KB, MIME type: image/png)
Explicit plot of the LambertW function, in compare to its inverse function zex.
$y=\mathrm{zex}(x)=x\, \exp(x)$, light green curve
$y=\mathrm{LambertW}(x)=\mathrm{zex}^{-1}(x)$, dark brown curve
C++ Generator of curves
// Files ado.cin, tania.cin, LambertWoCoe.inc, LambertWeCoe.cin should be loaded to the working directory in order to compile the code below
#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(z) z.real() #define Im(z) z.imag() #define I z_type(0.,1.)
#include"ado.cin" #define M(x,y) fprintf(o,"%5.3f %5.3f M\n",0.+x,0.+y); #define L(x,y) fprintf(o,"%5.3f %5.3f L\n",0.+x,0.+y);
#include "tania.cin"
z_type zex(z_type z) { return z*exp(z) ; }
z_type LambertWo(z_type z){ int n,m=48; z_type d=-z; #include "LambertWoCoe.inc" z_type s=LambertWoCoe[m]*d; for(n=m-1;n>0;n--){ s+=LambertWoCoe[n]; s*=d;} return z*(1.+s); }
z_type LambertWe(z_type z){ int n,m=100; z_type t=1./M_E+z; t*=2*M_E; t=sqrt(t); #include "LambertWeCoe.cin" z_type s=LambertWeCoe[m]*t; for(n=m-1; n>0; n--) { s+=LambertWeCoe[n]; s*=t;} return -1.+s;}
z_type LambertW(z_type z){ if( abs(z)<.2 ) return LambertWo(z); if( abs(1./M_E+z)<.2 ) return LambertWe(z); return Tania(log(z)-1.);} // Except the negative part of the real axis, Tania does the LambertW well.
main(){ int j,k,m,n; DB x,y, a; z_type z; FILE *o;o=fopen("LambertWplot.eps","w");ado(o,610,410); fprintf(o,"204 104 translate\n 100 100 scale\n"); for(m=-2;m<5;m++){ M(m,-1)L(m,3)} for(n=-1;n<4;n++){ M(-2,n)L(4,n)} fprintf(o,"2 setlinecap 1 setlinejoin .01 W 0 0 0 RGB S 1 setlinecap\n"); for(n=0;n<310;n+=2){x=-2.02+.01*n; y=x*exp(x); if(n==0)M(x,y) else L(x,y) } fprintf(o,".03 W 0 .8 0 RGB S\n"); DO(n,500){ x=-1./M_E+.01*n; y=Re(LambertW(x)); if(n==0)M(x,y) else L(x,y) if(x>4.04) break; } fprintf(o,".03 W .5 0 0 RGB S\n"); M( 1, M_E) L(0, M_E) M(-1,-1./M_E) L(0,-1./M_E) M( M_E,1) L( M_E,0) M(-1./M_E,-1) L(-1./M_E,0) fprintf(o,"0 setlinecap .005 W 0 0 0 RGB S\n"); fprintf(o,"showpage\n%cTrailer",'%'); fclose(o); system("epstopdf LambertWplot.eps"); system( "open LambertWplot.pdf"); //these 2 commands may be specific for macintosh getchar(); system("killall Preview");// if run at another operational sysetm, may need to modify }
Generator of lables
% % Copyleft 2012 by Dmitrii Kouznetsov%<br> \documentclass[12pt]{article} %<br> \usepackage{geometry} %<br> \usepackage{graphicx} %<br> \usepackage{rotating} %<br> \paperwidth 610pt %<br> \paperheight 404pt %<br> \topmargin -102pt %<br> \oddsidemargin -92pt %<br> \textwidth 1200pt %<br> \textheight 600pt %<br> \pagestyle {empty} %<br> \newcommand \sx {\scalebox} %<br> \newcommand \rot {\begin{rotate}} %<br> \newcommand \ero {\end{rotate}} %<br> \newcommand \ing {\includegraphics} %<br> \begin{document} %<br> { \begin{picture}(508,408) %<br> %\put(1,9){\ing{arclambertw}} %<br> \put(1,9){\ing{LambertWplot}} %<br> \put(187,398){\sx{2.9}{$y$}} %<br> \put(209,378){\sx{3.1}{$\mathrm e$}} %<br> \put(186,304){\sx{2.8}{$2$}} %<br> \put(186,204){\sx{2.8}{$1$}} %<br> \put(184,103){\sx{2.8}{$0$}} %<br> \put(209,70){\sx{2.6}{$-\!1/\mathrm e$}} %<br> \put( 86, 90){\sx{2.5}{$-\!1$}} %<br> \put(200,90){\sx{2.5}{$0$}} %<br> \put(300,90){\sx{2.5}{$1$}} %<br> \put(400,90){\sx{2.5}{$2$}} %<br> \put(471,96){\sx{2.9}{$\mathrm e$}} %<br> \put(500,90){\sx{2.5}{$3$}} %<br> % \put(300,-9){\sx{2.5}{$0$}} %<br> \put(590,90){\sx{2.6}{$x$}} %<br> \put(282,270){\sx{3.4}{$y\!=\!x\, \mathrm e^{x}$}} %<br> \put(312,190){\sx{3.4}{\rot{11}$y\!=\!\mathrm{LambertW}(x)$\ero}} %<br> \end{picture} %<br> } %<br> \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 | 17:50, 20 June 2013 | 1,267 × 839 (81 KB) | Maintenance script (talk | contribs) | Importing image file |
You cannot overwrite this file.
File usage
The following page uses this file: