diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/pstricks/contrib/pst-func/Changes | 1 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-func/README.md | 10 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf | bin | 4036896 -> 4059910 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-func/doc/pst-func-doc.tex | 70 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-func/dvips/pst-func.pro | 39 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-func/latex/pst-func.sty | 2 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-func/tex/pst-func.tex | 209 |
7 files changed, 173 insertions, 158 deletions
diff --git a/graphics/pstricks/contrib/pst-func/Changes b/graphics/pstricks/contrib/pst-func/Changes index 1aadfbe9be..47203c52d6 100644 --- a/graphics/pstricks/contrib/pst-func/Changes +++ b/graphics/pstricks/contrib/pst-func/Changes @@ -1,4 +1,5 @@ ..... pst-func.tex +0.97 2021-10-29 - fix and extension for \psLorenz curve 0.96 2021-04-06 - added start/endAngle for \psLame 0.95 2020-06-07 - another two more polynomial functions 0.94 2020-01-01 - small fixes diff --git a/graphics/pstricks/contrib/pst-func/README.md b/graphics/pstricks/contrib/pst-func/README.md index d7afcc5c61..2552fc4384 100644 --- a/graphics/pstricks/contrib/pst-func/README.md +++ b/graphics/pstricks/contrib/pst-func/README.md @@ -6,8 +6,6 @@ - psBernstein (with envelope option) - psFourier - psBessel -- psLagrange -- psLegendre - psSi and pssi (integral sin) - psCi and \psci (integral cosin) - psIntegral @@ -24,6 +22,7 @@ - psBetaDist for Beta distribution - psWeibull for Weibull distribution - psLame (Lamé Curve - a superellipse) +- psLorenz - psThomae (popcorn function) - psWeierstrass (original and modified) - psplotImp (plotting implicit defined functions) @@ -43,9 +42,10 @@ be part of your local TeX installation, otherwise get it from a CTAN server, http://mirror.ctan.org PSTricks is PostScript Tricks, the documentation cannot be run -with pdftex, use the sequence latex->dvips->ps2pdf or +with pdftex, use lualatex or the sequence latex->dvips->ps2pdf or pdflatex with package auto-pst-pdf or xelatex. -%% $Id: README 897 2014-03-21 08:06:41Z herbert $ +hvoss@tug.org + -Bugs: hvoss@tug.org
\ No newline at end of file +%% $Id: README 897 2014-03-21 08:06:41Z herbert $ diff --git a/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf b/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf Binary files differindex 12ee728910..368a838f5b 100644 --- a/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf +++ b/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf diff --git a/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.tex b/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.tex index cf3819048b..f47e587290 100644 --- a/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.tex +++ b/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.tex @@ -1,6 +1,8 @@ -%% $Id: pst-func-doc.tex 1184 2020-06-06 18:36:57Z herbert $ -\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false, - headings=small, headinclude=false,footinclude=false,oneside]{pst-doc} +\RequirePackage{pdfmanagement-testphase} +\DeclareDocumentMetadata{} +%% $Id: pst-func-doc.tex 306 2021-10-29 14:48:08Z herbert $ +\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small, + headinclude=false,footinclude=false,oneside]{pst-doc} \usepackage{pst-func} \let\pstFuncFV\fileversion \usepackage{pst-math} @@ -48,7 +50,7 @@ \author{Herbert Vo\ss} \docauthor{} \date{\today} -\maketitle +\settitle \tableofcontents \psset{unit=1cm} @@ -76,7 +78,9 @@ Thanks to \\ Jürgen Gilg, Christophe Jorssen, Lars Kotthoff, + Marcel Krüger, Buddy Ledger, + Pablo Gonzáles Luengo, Manuel Luque, Patrice Mégret, Svend Mortensen, @@ -609,7 +613,7 @@ which plots the envelope curve instead of the Bernstein polynomial. \clearpage -\subsection{Laguerre Polynomial} +\subsection{\Lcs{psLaguerre} -- Laguerre Polynomial} It is defined as \[ L_n(x)=\sum_{k=0}^n\frac{(-1)^k}{k!}\binom{n}{k}x^k @@ -634,10 +638,11 @@ L_n(x)=\sum_{k=0}^n\frac{(-1)^k}{k!}\binom{n}{k}x^k \clearpage -\subsection{Legendre Polynomial} -It is defined as an orthogonal system +\subsection{\Lcs{psLegendre} -- Legendre Polynomial} +It is defined by the contour integral: \[ -\int\limits_{-1}^{+1}P_m(x)(P_n(x)\mathrm dx=0, \text{ with } n\ne m +P_n(x)=\frac1{2\pi} \oint(1-2tx+t^2)^{-1/2}t^{-n-1}\mathrm dt +%\int\limits_{-1}^{+1}P_m(x)(P_n(x)\mathrm dx=0, \text{ with } n\ne m \] For the computatíon we use a recursive definition: @@ -1532,6 +1537,8 @@ labelangle=80,LabelColor=blue]{6}{0.4} \end{pspicture} \end{LTXexample} +%$ + \begin{LTXexample}[pos=t,preset=\centering] \psset{xunit=0.25cm,yunit=10cm} \begin{pspicture*}(-1,-0.05)(61,0.52) @@ -1821,7 +1828,7 @@ and has the syntax \end{LTXexample} \clearpage -\subsection{$\chi^2$-distribution} +%\subsection{$\chi^2$-distribution} The $\chi^2$-distribution is a continuous probability distribution. It usually arises when a $k$-dimensional vector's orthogonal components are independent and each follow a standard normal distribution. @@ -2108,7 +2115,7 @@ example. \end{LTXexample} \clearpage -\section{The Lorenz curve} +\section{\nxLcs{psLorenz}, 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 @@ -2118,9 +2125,15 @@ then the sample Lorenz curve is the \textit{polygon} joining the points $(h/n,L_ 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} +\LcsStar{psLorenz}\OptArgs\OptArg*{<X data>}\Largb{Y data} \end{BDef} + +Without defining data for the x values the Y data will be sorted +and then printed over the relativ x values. For example: 5 y values +will be printed for $x\in[0, 0.2, 0.4, 0.6, 0.8, 1]$ + + \begin{LTXexample}[pos=t,preset=\centering] \psset{lly=-6mm,llx=-5mm} \psgraph[Dx=0.2,Dy=0.2,axesstyle=frame](0,0)(1,1){6cm}{6cm} @@ -2131,16 +2144,28 @@ where $h=0, 1, 2,\ldots n, L_0=0$ and $L_h=\sum_{i=1}^h x_i^{\prime}$. \endpsgraph \end{LTXexample} + + +\begin{LTXexample}[pos=t,preset=\centering] +\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,showpoints]{1 4 6 9 100} +\psLorenz[linecolor=red!60,linewidth=1.5pt,showpoints]<83 104 134 143 185>{460 343 406 501 1662} +\psLorenz[linecolor=green,linewidth=1.5pt]{0 0.577 0.934 0.947 0.969 0.986} +\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 +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]{0.025 0.275 0.2 0.270 0.230} -\psLorenz[plotstyle=dots,dotstyle=square,dotscale=1.5]{0.025 0.275 0.2 0.270 0.230} +\psLorenz[linewidth=1.5pt,Gini]<83 104 134 143 185>{460 343 406 501 1662} +\psLorenz[plotstyle=dots,dotstyle=square,dotscale=1.5]<83 104 134 143 185>{460 343 406 501 1662} \endpsgraph \end{LTXexample} @@ -2210,6 +2235,23 @@ and unit. \end{LTXexample} \egroup + + + +\bgroup +\begin{LTXexample}[pos=t,preset=\centering] +\definecolorseries{col}{rgb}{last}{red}{blue} +\resetcolorseries[41]{col} +\psset{unit=.5} +\pspicture(-9,-9)(9,9) + \psaxes[Dx=2,Dy=2,tickstyle=bottom,ticksize=2pt]{->}(0,0)(-9,-9)(9,9) + \multido{\rA=0.2+0.1,\iA=0+1}{40}{% + \psLame[radiusA=8,radiusB=7,startAngle=45,endAngle=315, + linecolor={col!![\iA]},linewidth=.5pt]{\rA}} +\endpspicture +\end{LTXexample} +\egroup + \clearpage \section{\nxLcs{psThomae} -- the popcorn function} \Index{Thomae's function}, also known as the \Index{popcorn function}, diff --git a/graphics/pstricks/contrib/pst-func/dvips/pst-func.pro b/graphics/pstricks/contrib/pst-func/dvips/pst-func.pro index 09252c19a3..f752442e87 100644 --- a/graphics/pstricks/contrib/pst-func/dvips/pst-func.pro +++ b/graphics/pstricks/contrib/pst-func/dvips/pst-func.pro @@ -316,7 +316,8 @@ tx@FuncDict begin end } def % -/ChebyshevT { 5 dict begin % z on stack +/ChebyshevT { + 5 dict begin % z on stack /xtmp exch def /n exch def 0 0 1 n .5 mul floor { @@ -329,7 +330,8 @@ tx@FuncDict begin end } def % -/ChebyshevU {5 dict begin % z on stack +/ChebyshevU { + 5 dict begin % z on stack /xtmp exch def /n exch def 0 0 1 n .5 mul floor { @@ -367,6 +369,39 @@ tx@FuncDict begin %end{vasicek density} % end +% +/arraySum { % on stack the array + 5 dict begin + dup length 0 eq + {} + { /xArray exch def + /xSum 0 def + /i 0 def + xArray length { + /xSum xSum xArray i get add def + /i i 1 add def + } repeat + } ifelse + xSum + end +} def +% +/arrayProd { % on stack the array + 5 dict begin + dup length 0 eq + {} + { /xArray exch def + /xProd 1 def + /i 0 def + xArray length { + /xProd xProd xArray i get mul def + /i i 1 add def + } repeat + } ifelse + xProd + end +} def +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % subroutines for complex numbers, given as an array [a b] % which is a+bi = Real+i Imag diff --git a/graphics/pstricks/contrib/pst-func/latex/pst-func.sty b/graphics/pstricks/contrib/pst-func/latex/pst-func.sty index 5deceb3019..ff1038570d 100644 --- a/graphics/pstricks/contrib/pst-func/latex/pst-func.sty +++ b/graphics/pstricks/contrib/pst-func/latex/pst-func.sty @@ -13,4 +13,4 @@ \ProvidesFile{pst-func.pro}[2018/12/13 v. 0.17, PostScript prologue file (hv)] \@addtofilelist{pst-func.pro}}{}% \endinput -%% $Id: pst-func.sty 887 2018-12-29 13:17:59Z herbert $ +%% $Id: pst-func.sty 306 2021-10-29 14:48:08Z herbert $ diff --git a/graphics/pstricks/contrib/pst-func/tex/pst-func.tex b/graphics/pstricks/contrib/pst-func/tex/pst-func.tex index abd00a74c1..3e67c926f9 100644 --- a/graphics/pstricks/contrib/pst-func/tex/pst-func.tex +++ b/graphics/pstricks/contrib/pst-func/tex/pst-func.tex @@ -1,4 +1,4 @@ -%% $Id: pst-func.tex 1184 2020-06-06 18:36:57Z herbert $ +%% $Id: pst-func.tex 306 2021-10-29 14:48:08Z herbert $ %% %% This is file `pst-func.tex', %% @@ -31,8 +31,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} % -\def\fileversion{0.96} -\def\filedate{2021/04/05} +\def\fileversion{0.97} +\def\filedate{2021/10/29} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -58,20 +58,20 @@ \pst@killglue \psset{#1} \psplot[algebraic=false]{#2}{#3}{% - /type (cos) def + /psFtype (cos) def /Fourier { aload length /n exch def n -1 roll 2 div n 1 roll % a0/2 n 1 sub -1 0 { /i exch def i x mul 180 mul 3.141592 div - type (sin) eq {sin}{cos} ifelse + psFtype (sin) eq {sin}{cos} ifelse mul n 1 roll } for n 1 sub -1 1 { pop add } for } def [\psk@cosCoeff] Fourier - /type (sin) def + /psFtype (sin) def [0 \psk@sinCoeff] Fourier add }% }\ignorespaces} @@ -185,10 +185,10 @@ xy moveto }% \if@pst% lines and dots - \psPolynomial@iii% + \psPolynomial@iii \else% curves - \psPolynomial@ii% - \fi% + \psPolynomial@ii + \fi \endgroup \ignorespaces} % @@ -698,10 +698,10 @@ grestore } % \define@key[psset]{pst-func}{PSfont}[NimbusRomNo9L-Regu]{\def\psk@PSfont{/#1 }} -\define@key[psset]{pst-func}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth } +\define@key[psset]{pst-func}{valuewidth}[20]{\pst@getint{#1}\psk@valuewidth } \define@key[psset]{pst-func}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale } \define@key[psset]{pst-func}{decimals}[-1]{\pst@getint{#1}\psk@decimals } -\psset[pst-func]{PSfont=NimbusRomNo9L-Regu,fontscale=10,valuewidth=10,decimals=-1} +\psset[pst-func]{PSfont=NimbusRomNo9L-Regu,fontscale=10,valuewidth=20,decimals=-1} % \def\psPrintValue{\pst@object{psPrintValue}} \def\psPrintValue@i#1{\expandafter\psPrintValue@ii#1,,\@nil} @@ -715,7 +715,8 @@ grestore Func \else #1 \fi \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 + %\psk@valuewidth + 100 string cvs %/Output exch def % save output \ifPst@comma dot2comma \fi % do we have to change dot to comma \psk@xShift\space 0 moveto %Output show grestore @@ -1596,134 +1597,70 @@ grestore \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}% +\def\psLorenz{\def\pst@par{}\pst@object{psLorenz}} +\def\psLorenz@i{\@ifnextchar<\psLorenz@ii{\psLorenz@ii<>}} +\def\psLorenz@ii<#1>#2{% \if@star\addto@par{fillstyle=solid,fillcolor=\pslinecolor}\fi - \use@par% -\iffalse - \def\Lorenz@code{ - /D {} def - [ \L@Data\space counttomark dup - 1 sub /m ED 2 div cvi /n ED % m=0..n-1 n=number of pairs - ] /xyValues ED - /Xval [] def /Yval [] def /Xmax 0 def - /Xsum 0 def /Ysum 0 def /XYsum 0 def - xyValues aload pop % [ x y x y x y ... ] - n { 2 copy mul XYsum add /XYsum ED - dup - Yval aload length 1 add array astore /Yval ED - Ysum add /Ysum ED - dup - Xval aload length 1 add array astore /Xval ED - dup Xsum add /Xsum ED - dup Xmax gt { /Xmax ED }{ pop } ifelse - } repeat - Xval bubblesort /Xval ED - Yval bubblesort /Yval ED - Xval { Xmax div } forall n array astore /XvalRelMax ED - Xval { Xsum div } forall n array astore /XvalRel ED - Yval { Ysum div } forall n array astore /YvalRel ED - 0 1 n 1 sub { - cvi /Index ED - Xval Index get - Yval Index get - mul } for - n array astore /XmulY ED - XmulY aload length 1 sub { add } repeat - /XmulYsum ED - XmulY { XmulYsum div } forall - n array astore /XmulYdivXmulYsum ED - /X [0] def - /Y [0] def - /Xsum 0 def /Ysum 0 def - 0 1 n 1 sub { - /Index ED -% XvalRel Index get Xsum add /Xsum ED -% X aload length 1 add Xsum exch array astore /X ED - X aload length 1 add XvalRelMax Index get exch array astore /X ED %% - XmulYdivXmulYsum Index get Ysum add /Ysum ED - Y aload length 1 add Ysum exch array astore /Y ED - } for - \ifPst@Gini - 0 % start value for Gini - 0 1 X length 2 sub { - /Index ED - Y Index get Y Index 1 add get add 2 div % yHeight=(y0+y1)/2 - X Index 1 add get X Index get sub abs % xWidth=x1-x0 - mul % x*y - add - } for - 2 mul 1 sub neg % triangle area divided by the area under the polygon - \psk@PSfont\space 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 dot2comma \fi % do we have to change dot to comma - /Output ED - \psk@xShift\space -30 moveto (Gini: ) show - Output show - \fi - 0 1 n { dup X exch get exch Y exch get } for - \if@star 1 0 0 0 \fi % add values for the closed curve - }% filling the area under the curve. -\fi -%%%%%%%%%%%%%%%%%%%%%%5 + \begingroup + \use@par \def\Lorenz@code{ - [ #1 ] dup length /n ED - bubblesort /Yval ED - [ 1 1 n { } for ] /Xval ED - /Xsum n dup 1 add mul 2 div cvi def - /Ysum 0 def /XYsum 0 def - 0 Yval { add } forall /Ysum ED - Xval { n div } forall n array astore /XvalRelMax ED - Xval { Xsum div } forall n array astore /XvalRel ED - Yval { Ysum div } forall n array astore /YvalRel ED - 0 1 n 1 sub { - /Index ED - Xval Index get - Yval Index get - mul } for - n array astore /XmulY ED - XmulY aload length 1 sub { add } repeat - /XmulYsum ED - XmulY { XmulYsum div } forall - n array astore /XmulYdivXmulYsum ED - /X [0] def - /Y [0] def - /Xsum 0 def /Ysum 0 def - 0 1 n 1 sub { - /Index ED -% XvalRel Index get Xsum add /Xsum ED -% X aload length 1 add Xsum exch array astore /X ED - X aload length 1 add XvalRelMax Index get exch array astore /X ED %% - XmulYdivXmulYsum Index get Ysum add /Ysum ED - Y aload length 1 add Ysum exch array astore /Y ED - } for - \ifPst@Gini - 0 % start value for Gini - 0 1 X length 2 sub { - /Index ED - Y Index get Y Index 1 add get add 2 div % yHeight=(y0+y1)/2 - X Index 1 add get X Index get sub abs % xWidth=x1-x0 - mul % x*y - add - } for - 2 mul 1 sub neg % triangle area divided by the area under the polygon - \psk@PSfont\space 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 dot2comma \fi % do we have to change dot to comma - /Output ED - \psk@xShift\space -30 moveto (Gini: ) show - Output show - \fi - 0 1 n { dup X exch get exch Y exch get } for - \if@star 1 0 0 0 \fi % add values for the closed curve + 25 dict begin + [ #2 ] dup length /nVal ED + /Yval ED + Yval arraySum /Ysum ED + Yval { Ysum div } forall nVal array astore /YvalRel ED % Pred dist + \if$#1$ + [ 1 1 nVal { nVal div } for ] dup /XvalRel ED /XvalRelCum ED + YvalRel bubblesort /YvalRel ED + \else + [ #1 ] /Xval ED + Xval arraySum /Xsum ED + Xval { Xsum div } forall nVal array astore /XvalRel ED % Freq dist + /CumFreq 0 def + [ + 0 1 nVal 1 sub { + XvalRel exch get CumFreq add dup /CumFreq ED + } for + ] /XvalRelCum ED +% XvalRelCum == + \fi + /CumPred 0 def + [ + 0 1 nVal 1 sub { + YvalRel exch get CumPred add dup /CumPred ED + } for + ] /YvalRelCum ED +% YvalRelCum == +% Xsum == Ysum == + \ifPst@Gini + [ 0 1 nVal 1 sub { + /Index ED + YvalRelCum Index get + Index 0 eq { 0 }{ YvalRelCum Index 1 sub get } ifelse + add 0.5 mul XvalRel Index get mul + } for + ] /Area ED +% Area == + Area arraySum /B ED + 0.5 B sub dup B add div + \psk@PSfont\space 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 dot2comma \fi % do we have to change dot to comma + /Output ED + \psk@xShift\space -30 moveto (Gini: ) show + Output show + \fi + 0 0 % the start point + 0 1 nVal 1 sub { dup XvalRelCum exch get exch YvalRelCum exch get } for + \if@star 1 0 0 0 \fi % add values for the closed curve + end }% filling the area under the curve. \if@star\listplot*{\Lorenz@code}\else\listplot{\Lorenz@code}% -% \listplot[plotstyle=bezier,linecolor=red]{\Lorenz@code} - \fi% -}\ignorespaces} +% \listplot[plotstyle=bezier,linecolor=red]{\Lorenz@code} + \fi + \endgroup + \ignorespaces} % % Superellipese / Lamefunction \define@key[psset]{pst-func}{radiusA}[1]{\pst@getlength{#1}\pst@radiusA} |