summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-func
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-11-04 23:09:30 +0000
committerKarl Berry <karl@freefriends.org>2011-11-04 23:09:30 +0000
commitb19d9736b1233678daaf4e8d5538b129be4de268 (patch)
tree10bc3c48370295b32045c095b18b0bc4f741fc1d /Master/texmf-dist/tex/generic/pst-func
parentffce06db898f19860fcf9d4106cf822b1f2f8cd0 (diff)
pst-func 0.74 (3nov11)
git-svn-id: svn://tug.org/texlive/trunk@24491 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-func')
-rw-r--r--Master/texmf-dist/tex/generic/pst-func/pst-func.tex141
1 files changed, 110 insertions, 31 deletions
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 1439e97b815..6f9032cff70 100644
--- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
+++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
@@ -1,4 +1,4 @@
-%% $Id: pst-func.tex 584 2011-10-21 20:34:22Z herbert $
+%% $Id: pst-func.tex 599 2011-11-03 19:38:28Z herbert $
%%
%% This is file `pst-func.tex',
%%
@@ -30,8 +30,8 @@
% interface to the `xkeyval' package
\pst@addfams{pst-func}
%
-\def\fileversion{0.73}
-\def\filedate{2011/10/21}
+\def\fileversion{0.74}
+\def\filedate{2011/11/02}
\message{`PST-func' v\fileversion, \filedate\space (hv)}
%
\pstheader{pst-func.pro}
@@ -798,52 +798,131 @@
%
\def\psLorenz{\pst@object{psLorenz}}
\def\psLorenz@i#1{{%
- \readdata{\L@Data}{#1}%
+% \readdata{\L@Data}{#1}%
\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
- ] 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]
+ 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
- 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
+% 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
-% 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
+ 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
- gsave \psk@PSfont findfont \psk@fontscale scalefont setfont
+ 2 mul 1 sub neg % triangle area divided by the area under the polygon
+ \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 dot2comma \fi % do we have to change dot to comma
/Output ED
\psk@xShift\space -30 moveto (Gini: ) show
- Output show grestore
+ Output show
\fi
- }% filling the area under the curve.
- \if@star\listplot*{\Lorenz@code}\else\listplot{\Lorenz@code}\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
+ \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 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.
+ \if@star\listplot*{\Lorenz@code}\else\listplot{\Lorenz@code}%
+% \listplot[plotstyle=bezier,linecolor=red]{\Lorenz@code}
+ \fi%
}\ignorespaces}
%
% Superellipese / Lamefunction