diff options
author | Karl Berry <karl@freefriends.org> | 2010-01-27 01:42:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-01-27 01:42:29 +0000 |
commit | af846fbe6248cf5ca88c380c243617524dba6773 (patch) | |
tree | cd222ab9829996c5d375f56f216310631600f92b /Master/texmf-dist | |
parent | 6558da0729e1c500bec9acbfaa748066b84b02f4 (diff) |
pst-func update (26jan10)
git-svn-id: svn://tug.org/texlive/trunk@16830 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/Changes | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf | bin | 2849314 -> 2877597 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex | 79 | ||||
-rw-r--r-- | Master/texmf-dist/source/generic/pst-func/Makefile | 1 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-func/pst-func.tex | 86 |
5 files changed, 167 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes index 6321e0e8dd6..24fd17e3ec2 100644 --- a/Master/texmf-dist/doc/generic/pst-func/Changes +++ b/Master/texmf-dist/doc/generic/pst-func/Changes @@ -1,4 +1,8 @@ ..... pst-func.tex +0.66 2010-01-26 - new optional argument for the Gini + coefficient of \psLorenz +0.65 2010-01-25 - new distribution \psCauchy + - new macro psLorenz for the Lorenz curve 0.64 2010-01-19 - new optional argument for \psplotImp to insert predefined PS code 0.63 2010-01-04 - fixed bug with Bezier definition diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf Binary files differindex b37bb2a36ba..588343f385c 100644 --- a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf +++ b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex index c9310fcfd91..e41c8a5eaaf 100644 --- a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex @@ -1351,6 +1351,41 @@ and has the syntax (with a default setting of $\alpha=1$ and $\beta=1$): \end{LTXexample} +\clearpage +\subsection{Cauchy distribution} +The \Index{Cauchy distribution}, also called the \Index{Lorentz distribution}, is a continuous distribution +describing resonance behavior. It also describes the distribution of horizontal distances at +which a line segment tilted at a random angle cuts the $x$-axis. + +The general Cauchy distribution and its cumulative distribution can be written as +\begin{align} +P(x) &= \frac{1}{\pi} \frac{b}{\left(x-m\right)^2+b^2}\\ +D(x) &= \frac12 +\frac{1}{\pi} \arctan\left(\frac{x-m}{b}\right) +\end{align} + +where \Lkeyword{b} is the half width at half maximum and \Lkeyword{m} is the statistical median. +The macro has the syntax (with a default setting of $m=0$ and $b=1$): + +\begin{BDef} +\Lcs{psCauchy}\OptArgs\Largb{x0}\Largb{x1}\\ +\Lcs{psCauchyI}\OptArgs\Largb{x0}\Largb{x1}\\ +\end{BDef} + +\Lcs{psCauchyI} is the integral or the cumulative distribution and often named as $D(x)$. + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=2,yunit=3cm} +\begin{pspicture*}(-3,-0.3)(3.1,2.1) +\psset{linewidth=1pt} +\multido{\rb=0.1+0.2,\rm=0.0+0.2}{4}{% + \psCauchy[b=\rb,m=\rm,linecolor=red]{-2.5}{2.5} + \psCauchyI[b=\rb,m=\rm,linecolor=blue]{-2.5}{2.5}} +\psaxes[Dy=0.4,dy=0.4,Dx=0.5,dx=0.5]{->}(0,0)(-3,0)(3,2) +\end{pspicture*} +\end{LTXexample} + + + \iffalse \clearpage \subsection{Bose-Einstein distribution} @@ -1368,6 +1403,50 @@ and has the syntax (with a default setting of $s=1$ and $\mu=1$): \clearpage +\section{The Lorenz curve} + +The so-called \Index{Lorenz curve} is used in economics to describe inequality in +wealth or size. The Lorenz curve is a function of the cumulative proportion of +\textit{ordered individuals} mapped onto the corresponding cumulative proportion +of their size. Given a sample of n ordered individuals with $x_i^{\prime}$ the size of +individual $i$ and $x_1^{\prime}<x_2^{\prime}<\cdots<x_n^{\prime}$, then the sample Lorenz curve is +the \textit{polygon} joining the points $(h/n,L_h/L_n)$, where $h=0, 1, 2,\ldots n, L_0=0$, and +$L_h=sum_(i=1)^(h)x_i^{\prime}$. + +\begin{BDef} +\LcsStar{psLorenz}\OptArgs\Largb{data file} +\end{BDef} + + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{filecontents*}{Lorenz.dat} +0.50 0.025 +0.10 0.275 +0.3 0.2 +0.09 0.270 +0.01 0.230 +\end{filecontents*} +\psset{lly=-6mm,llx=-5mm} +\psgraph[Dx=0.2,Dy=0.2,axesstyle=frame](0,0)(1,1){6cm}{6cm} +\psline[linestyle=dashed](1,1) +\psLorenz*[linecolor=blue!30,linewidth=1.5pt]{Lorenz.dat} +\endpsgraph +\end{LTXexample} + +There exists an optional argument \Lkeyword{Gini} for the output of the \Index{Gini coefficient}. +It is by default set to \false. With \true the value is caculated and printed below the +origin of the coordinate system. + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{lly=-13mm,llx=-5mm} +\psgraph[Dx=0.2,Dy=0.2,axesstyle=frame](0,0)(1,1){6cm}{6cm} +\psline[linestyle=dashed](1,1) +\psLorenz[linewidth=1.5pt,Gini]{Lorenz.dat} +\psLorenz[plotstyle=dots,dotstyle=square,dotscale=1.5]{Lorenz.dat} +\endpsgraph +\end{LTXexample} + +\clearpage \section{\nxLcs{psLame} -- Lam\'e Curve, a superellipse} A superellipse is a curve with Cartesian equation % diff --git a/Master/texmf-dist/source/generic/pst-func/Makefile b/Master/texmf-dist/source/generic/pst-func/Makefile index 295ae61a24e..17a844cd104 100644 --- a/Master/texmf-dist/source/generic/pst-func/Makefile +++ b/Master/texmf-dist/source/generic/pst-func/Makefile @@ -39,6 +39,7 @@ $(MAIN).dvi : $(MAIN).tex clean : $(RM) $(addprefix $(MAIN), .log .aux .bbl .blg .glg .glo .gls .ilg .idx .ind .tmp .toc .out ) $(RM) $(addprefix $(MAIN), .dvi .ps .xcp) + rm *.dat veryclean : clean $(RM) $(addprefix $(MAIN), .pdf .bbl .blg) diff --git a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex index 863d4bfd28b..02b786a0df4 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -30,8 +30,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} % -\def\fileversion{0.64} -\def\filedate{2010/01/20} +\def\fileversion{0.66} +\def\filedate{2010/01/25} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -709,7 +709,87 @@ \fi% \ignorespaces% } - +% +\define@key[psset]{pst-func}{m}[0]{\def\psk@cauchy@m{#1 }} +\define@key[psset]{pst-func}{b}[1]{\def\psk@cauchy@b{#1 }} +\psset[pst-func]{m=0,b=1} +% +\def\psCauchy{\pst@object{psCauchy}} +\def\psCauchy@i#1#2{{% + \pst@killglue% + \addbefore@par{plotpoints=200}% + \use@par% + \psplot[algebraic=false]{#1}{#2}{ + \psk@cauchy@b dup dup mul x \psk@cauchy@m sub dup mul add div Pi div + }% +}\ignorespaces} +% +\def\psCauchyI{\pst@object{psCauchyI}} +\def\psCauchyI@i#1#2{{% + \pst@killglue% + \addbefore@par{plotpoints=200}% + \use@par% + \psplot[algebraic=false]{#1}{#2}{ + x \psk@cauchy@m sub \psk@cauchy@b div ATAN1 DegtoRad Pi div 0.5 add + }% +}\ignorespaces} +% +\define@boolkey[psset]{pst-func}[Pst@]{Gini}[true]{} +\psset[pst-func]{Gini=false} +% +\def\psLorenz{\pst@object{psLorenz}} +\def\psLorenz@i#1{{% + \readdata{\L@Data}{#1}% + \if@star\addto@par{fillstyle=solid,fillcolor=\pslinecolor}\fi + \use@par% + \def\Lorenz@code{ + [ \L@Data\space counttomark dup + 1 sub /m ED 2 div cvi /n ED + ] dup /xyValues ED + mark exch % [ [x y x y ...] + aload pop % [ x y x y x y ... ] + n { exch div m 1 roll /m m 2 sub def } repeat + n array astore /yxdiv ED +% xyValues == % [0.5 0.025 0.4 0.475 0.09 0.27 0.01 0.23] +% yxdiv == % [23.0 3.0 1.1875 0.05] +% yxdiv bubblesort == % [0.05 1.1875 3.0 23.0] + /X [0] def + /Y [0] def + 0 1 n 1 sub { + /Index ED + X aload pop xyValues Index 2 mul get X Index get add + Index 2 add array astore /X ED + Y aload pop xyValues Index 2 mul 1 add get Y Index get add + Index 2 add array astore /Y ED + } for +% X == % [0 0.5 0.9 0.99 1.0] +% Y == % [0 0.025 0.5 0.77 1.0] + 0 1 n { /Index ED X Index get Y Index get } for + \if@star 1 0 0 0 \fi + \ifPst@Gini + 0 + 0 1 n 1 sub { /Index ED + Y Index 1 add get + xyValues Index 2 mul 1 add get 0.5 mul sub + xyValues Index 2 mul get mul + add + } for + 2 mul 1 sub neg + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont + \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if + \psk@valuewidth string cvs /Output exch def % save output + \ifPst@comma % do we have to change dot to comma + 0 1 Output length 1 sub { + /Index exch def + Output Index get 46 eq { Output Index 44 put } if + } for + \fi + \psk@xShift\space -30 moveto (Gini: ) show + Output show grestore + \fi + }% filling the area under the curve. + \if@star\listplot*{\Lorenz@code}\else\listplot{\Lorenz@code}\fi% +}\ignorespaces} % % Superellipese / Lamefunction \define@key[psset]{pst-func}{radiusA}[1]{\pst@getlength{#1}\pst@radiusA} |