File:EncPlot100.png
Jump to navigation
Jump to search

Size of this preview: 401 × 599 pixels. Other resolutions: 161 × 240 pixels | 1,121 × 1,674 pixels.
Original file (1,121 × 1,674 pixels, file size: 40 KB, MIME type: image/png)
Explicit plot of function Enc:
\( \displaystyle y = \mathrm{Enc}(n,x) \) \( \displaystyle = \left(\frac{\mathrm e^x\!-\!1}{x}\right)^{\!n}-1 \)
versus \(x\) for \(n=1\), \(n=2\), \(n=3\) and \(n=4\).
For comparison, the thin line shows \( y=\mathrm e^x \).
Requirements
For generation of the image, file ado.cin should be loaded. Then, one by one, the two files below can be compiled.
EncP.cc
#include <math.h> #include <stdio.h> #include <stdlib.h> #define DB double #define DO(x,y) for(x=0;x<y;x++) #include <complex> typedef std::complex<double> z_type; #define Re(x) x.real() #define Im(x) x.imag() #define I z_type(0.,1.) #include "ado.cin" int main(){ int j,k,m,n; DB f,x,y, p,q, t,r; //z_type z,c,d; FILE *o;o=fopen("encP.eps","w");ado(o,808,1308); #define M(x,y) fprintf(o,"%6.3f %6.3f M\n", 0.+x,0.+y); #define L(x,y) fprintf(o,"%6.3f %6.3f L\n", 0.+x,0.+y); fprintf(o,"404 104 translate\n 100 100 scale 2 setlinecap\n"); for(m=-4;m<5;m++){M(m,-1)L(m,12)} for(n=-1;n<13;n++){M( -4,n)L(4,n)} fprintf(o,".008 W 0 0 0 RGB S\n"); for(n=0;n<161;n++){x=-4.05+.1*n; y=exp(x); ;if(n==0)M(x,y) else L(x,y) if(y>12.) break;} fprintf(o,".007 W 0 0 0 RGB S\n"); for(n=0;n<161;n++){x=-4.05+.1*n; f=(exp(x)-1.)/x; y=f-1. ;if(n==0)M(x,y) else L(x,y) if(y>12.) break;} fprintf(o,".02 W 0 0 0 RGB S\n"); for(n=0;n<161;n++){x=-4.05+.1*n; f=(exp(x)-1.)/x; y=f*f-1. ;if(n==0)M(x,y) else L(x,y) if(y>12.) break;} fprintf(o,".02 W .9 0 0 RGB S\n"); for(n=0;n<161;n++){x=-4.05+.1*n; f=(exp(x)-1.)/x; y=f*f*f-1. ;if(n==0)M(x,y) else L(x,y) if(y>12.) break;} fprintf(o,".02 W 0 .8 0 RGB S\n"); for(n=0;n<261;n++){x=-4.05+.1*n; f=(exp(x)-1.)/x; y=f*f*f*f-1.;if(n==0)M(x,y) else L(x,y) if(y>12.) break;} fprintf(o,".02 W 0 0 .9 RGB S\n"); fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o); system("epstopdf encP.eps"); system( "xpdf encP.pdf"); }
EncPlot.tex
\documentclass[12pt]{article} \usepackage{geometry} \paperwidth 810pt \paperheight 1210pt \textheight 2000pt \usepackage{graphicx} \newcommand \sx {\scalebox} \newcommand \ing {\includegraphics} \usepackage{rotating} \newcommand \rot {\begin{rotate}} \newcommand \ero {\end{rotate}} \topmargin -108pt \oddsidemargin -72pt \parindent 0pt \begin{document} \begin{picture}(602,1210) \put(0,0){\ing{encP.pdf}} \put(380,1187){\sx{4.1}{$y$}} %\put(358,1192){\sx{4}{$11$}} \put(358,1092){\sx{4}{$10$}} \put(380,992){\sx{4}{$9$}} \put(380,892){\sx{4}{$8$}} \put(380,792){\sx{4}{$7$}} \put(380,692){\sx{4}{$6$}} \put(380,592){\sx{4}{$5$}} \put(380,492){\sx{4}{$4$}} \put(380,392){\sx{4}{$3$}} \put(380,292){\sx{4}{$2$}} \put(380,192){\sx{4}{$1$}} %\put(368,92){\sx{4}{$0$}} \put(62,66){\sx{4}{$-3$}} \put(163,66){\sx{4}{$-2$}} \put(264,66){\sx{4}{$-1$}} \put(395,66){\sx{4}{$0$}} \put(494,68){\sx{4}{$1$}} \put(595,68){\sx{4}{$2$}} \put(696,66){\sx{4}{$3$}} \put(782,68){\sx{4.1}{$x$}} \put(527,1108){\rot{87}\sx{4}{$n\!=\!4$}\ero} \put(562,1108){\rot{86}\sx{4}{$n\!=\!3$}\ero} \put(624,1108){\rot{85}\sx{4}{$n\!=\!2$}\ero} \put(640,880){\rot{82}\sx{3.8}{$y\!=\!\exp(x)$}\ero} \put(793,1108){\rot{83}\sx{4}{$n\!=\!1$}\ero} \put(140,122){\rot{1}\sx{3.8}{$y\!=\!\mathrm e^x$}\ero} \end{picture} \end{document}
Generation
make EncP ./EncP pdflatex EncPlot.tex convert -density 100 EncPlot.pdf PNG8:EncPlot100.png
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 | 12:50, 19 August 2020 | ![]() | 1,121 × 1,674 (40 KB) | T (talk | contribs) |
You cannot overwrite this file.
File usage
There are no pages that use this file.