Difference between revisions of "File:Lognot300.jpg"
(Importing image file) |
|||
Line 1: | Line 1: | ||
+ | [[Explicit plot]] of [[Lognormal distribution]] |
||
− | Importing image file |
||
+ | $\displaystyle F(r)=\frac{1}{r\sqrt{\pi}} \exp\!\Big(\!-\ln(r)^2 \Big)$ |
||
+ | versus $r$. |
||
+ | |||
+ | ==[[C++]] generator of curve== |
||
+ | |||
+ | <poem><nomathjax><nowiki> |
||
+ | #include<math.h> |
||
+ | #include<stdio.h> |
||
+ | #include <stdlib.h> |
||
+ | //#include <complex> |
||
+ | //#define DB double |
||
+ | #define DB float |
||
+ | //typedef std::complex<DB> z_type; |
||
+ | //#define Re(x) x.real() |
||
+ | //#define Im(x) x.imag() |
||
+ | //#define RI(x) x.real(),x.imag() |
||
+ | //#define I z_type(0.,1.) |
||
+ | #define DO(x,y) for(x=0;x<y;x++) |
||
+ | #include "ado.cin" |
||
+ | //#include"fafo.cin" |
||
+ | |||
+ | //DB F(DB x,DB t){ return exp(-x*x/(4.*t))/sqrt(t);} |
||
+ | //DB F(DB x){ x-=.1; return exp(-x*x*4.);} |
||
+ | |||
+ | DB distribu(DB z) { DB L=log(z); return (1./sqrt(M_PI))*exp(-L*L)/z;} |
||
+ | |||
+ | int main(){ int j,m,n, N=128; FILE *o; DB x,y; |
||
+ | o=fopen("logno.eps","w"); ado(o,404,104); |
||
+ | fprintf(o,"2 2 translate 100 100 scale\n"); |
||
+ | #define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+x,0.+y); |
||
+ | #define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+x,0.+y); |
||
+ | #define o(x,y) fprintf(o,"%6.4f %6.4f o\n",0.+x,0.+y); |
||
+ | for(m=0;m<5;m++) { M(m,1) if(m==0) L(m,-.1) else L(m,0) } |
||
+ | for(n=0;n<2;n++) {M(0,n) L(4,n)} fprintf(o,".004 W S\n"); |
||
+ | DO(m,501){x=.001+.01*m; |
||
+ | y=distribu(x); |
||
+ | if(m==0)M(x,y)else L(x,y); |
||
+ | printf("%8.4f %8.4f\n",x,y); |
||
+ | } |
||
+ | fprintf(o,".02 W 0 0 1 RGB S\n"); // initial |
||
+ | fprintf(o,"showpage\n%cTrailer",'%'); fclose(o); |
||
+ | printf("close o\n"); |
||
+ | system("epstopdf logno.eps"); |
||
+ | system( "open logno.pdf"); |
||
+ | } |
||
+ | </nowiki></nomathjax></poem> |
||
+ | |||
+ | ==[[Latex]] generator of curve== |
||
+ | <poem><nomathjax><nowiki> |
||
+ | \documentclass[12pt]{article} |
||
+ | \usepackage{geometry} |
||
+ | \usepackage{graphics} |
||
+ | \paperwidth 410pt |
||
+ | \paperheight 118pt |
||
+ | \textwidth 420pt |
||
+ | \textheight 300pt |
||
+ | \topmargin -108pt |
||
+ | \oddsidemargin -73pt |
||
+ | \newcommand \ds {\displaystyle} |
||
+ | \newcommand \sx {\scalebox} |
||
+ | \newcommand \rme {\mathrm{e}} |
||
+ | \newcommand \rot {\begin{rotate}} |
||
+ | \newcommand \ero {\end{rotate}} |
||
+ | \newcommand \ing {\includegraphics} |
||
+ | \newcommand \rmi {\mathrm{i}} |
||
+ | \newcommand \iL[1] {~ \label{#1} ~{~}~{\rm [#1]}\!{\!}\!} % make labels visible |
||
+ | %\newcommand \iL[1] {~ \label{#1} } % hide the labels |
||
+ | \newcommand \be {\begin{eqnarray}} |
||
+ | \newcommand \ee {\end{eqnarray}} |
||
+ | \newcommand \eL[1] {\iL{#1} \end{eqnarray}} |
||
+ | \newcommand \rf[1] {(\ref{#1})} |
||
+ | \newcommand \JP[1] {} % Japanese is not supported |
||
+ | \pagestyle{empty} |
||
+ | \parindent 0pt |
||
+ | \begin{document} |
||
+ | \begin{picture}(410,114) |
||
+ | \put(6,8){\ing{logno}} |
||
+ | \put(0,105){\sx{1.3}{$1$}} |
||
+ | \put(0, 5){\sx{1.3}{$0$}} |
||
+ | \put(105,-2){\sx{1.3}{$1$}} |
||
+ | \put(205,-2){\sx{1.3}{$2$}} |
||
+ | \put(305,-2){\sx{1.3}{$3$}} |
||
+ | \put(403,-2){\sx{1.3}{$r$}} |
||
+ | \put(43,89){\sx{1.2}{$\displaystyle F(r)\!=\!\frac{1}{r \sqrt{\pi}} \exp\!\Big(\!-\ln(r)^2 \Big)$}} |
||
+ | \end{picture} |
||
+ | \end{document} |
||
+ | </nowiki></nomathjax></poem> |
||
+ | |||
+ | ==References== |
||
+ | http://en.wikipedia.org/wiki/Log-normal_distribution |
||
+ | |||
+ | [[Category:Lognormal distribution]] |
||
+ | [[Category:Explicit plot]] |
||
+ | [[Category:Roux]] |
||
+ | [[Category:C++]] |
||
+ | [[Category:Latex]] |
Latest revision as of 08:42, 1 December 2018
Explicit plot of Lognormal distribution $\displaystyle F(r)=\frac{1}{r\sqrt{\pi}} \exp\!\Big(\!-\ln(r)^2 \Big)$ versus $r$.
C++ generator of curve
#include<math.h>
#include<stdio.h>
#include <stdlib.h>
//#include <complex>
//#define DB double
#define DB float
//typedef std::complex<DB> z_type;
//#define Re(x) x.real()
//#define Im(x) x.imag()
//#define RI(x) x.real(),x.imag()
//#define I z_type(0.,1.)
#define DO(x,y) for(x=0;x<y;x++)
#include "ado.cin"
//#include"fafo.cin"
//DB F(DB x,DB t){ return exp(-x*x/(4.*t))/sqrt(t);}
//DB F(DB x){ x-=.1; return exp(-x*x*4.);}
DB distribu(DB z) { DB L=log(z); return (1./sqrt(M_PI))*exp(-L*L)/z;}
int main(){ int j,m,n, N=128; FILE *o; DB x,y;
o=fopen("logno.eps","w"); ado(o,404,104);
fprintf(o,"2 2 translate 100 100 scale\n");
#define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+x,0.+y);
#define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+x,0.+y);
#define o(x,y) fprintf(o,"%6.4f %6.4f o\n",0.+x,0.+y);
for(m=0;m<5;m++) { M(m,1) if(m==0) L(m,-.1) else L(m,0) }
for(n=0;n<2;n++) {M(0,n) L(4,n)} fprintf(o,".004 W S\n");
DO(m,501){x=.001+.01*m;
y=distribu(x);
if(m==0)M(x,y)else L(x,y);
printf("%8.4f %8.4f\n",x,y);
}
fprintf(o,".02 W 0 0 1 RGB S\n"); // initial
fprintf(o,"showpage\n%cTrailer",'%'); fclose(o);
printf("close o\n");
system("epstopdf logno.eps");
system( "open logno.pdf");
}
Latex generator of curve
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphics}
\paperwidth 410pt
\paperheight 118pt
\textwidth 420pt
\textheight 300pt
\topmargin -108pt
\oddsidemargin -73pt
\newcommand \ds {\displaystyle}
\newcommand \sx {\scalebox}
\newcommand \rme {\mathrm{e}}
\newcommand \rot {\begin{rotate}}
\newcommand \ero {\end{rotate}}
\newcommand \ing {\includegraphics}
\newcommand \rmi {\mathrm{i}}
\newcommand \iL[1] {~ \label{#1} ~{~}~{\rm [#1]}\!{\!}\!} % make labels visible
%\newcommand \iL[1] {~ \label{#1} } % hide the labels
\newcommand \be {\begin{eqnarray}}
\newcommand \ee {\end{eqnarray}}
\newcommand \eL[1] {\iL{#1} \end{eqnarray}}
\newcommand \rf[1] {(\ref{#1})}
\newcommand \JP[1] {} % Japanese is not supported
\pagestyle{empty}
\parindent 0pt
\begin{document}
\begin{picture}(410,114)
\put(6,8){\ing{logno}}
\put(0,105){\sx{1.3}{$1$}}
\put(0, 5){\sx{1.3}{$0$}}
\put(105,-2){\sx{1.3}{$1$}}
\put(205,-2){\sx{1.3}{$2$}}
\put(305,-2){\sx{1.3}{$3$}}
\put(403,-2){\sx{1.3}{$r$}}
\put(43,89){\sx{1.2}{$\displaystyle F(r)\!=\!\frac{1}{r \sqrt{\pi}} \exp\!\Big(\!-\ln(r)^2 \Big)$}}
\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:13, 1 December 2018 | 1,701 × 489 (77 KB) | Maintenance script (talk | contribs) | Importing image file |
You cannot overwrite this file.
File usage
The following page uses this file: