summaryrefslogtreecommitdiff
path: root/graphics/pstricks/contrib/pst-func/tex/pst-func.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pstricks/contrib/pst-func/tex/pst-func.tex')
-rw-r--r--graphics/pstricks/contrib/pst-func/tex/pst-func.tex125
1 files changed, 64 insertions, 61 deletions
diff --git a/graphics/pstricks/contrib/pst-func/tex/pst-func.tex b/graphics/pstricks/contrib/pst-func/tex/pst-func.tex
index 3e67c926f9..1f51fba97c 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 306 2021-10-29 14:48:08Z herbert $
+%% $Id: pst-func.tex 308 2021-10-30 14:11:45Z herbert $
%%
%% This is file `pst-func.tex',
%%
@@ -31,8 +31,8 @@
% interface to the `xkeyval' package
\pst@addfams{pst-func}
%
-\def\fileversion{0.97}
-\def\filedate{2021/10/29}
+\def\fileversion{0.98}
+\def\filedate{2021/10/30}
\message{`PST-func' v\fileversion, \filedate\space (hv)}
%
\pstheader{pst-func.pro}
@@ -1326,70 +1326,71 @@ grestore
/Coors [xOld dx sub scx 0] def % speichern der Koordinaten f\"{u}r den Spline
%%----------------------------------------------------------------------------------------------------------------------------------------------------------------
%%-------------------- Code, der \"{u}ber den Logarithmus arbeitet von Manuel Luque ---------------------------------------------
- /SumLog {% log(1) + log(2) + ... + log(n) = log(n!)
- 1 dict begin % Erwartet die Eingabe eines Wertes, n\"{a}mlich bis zu welchem Wert addiert werden soll ---> n
- /nV exch def % der \"{u}bergebene Wert wird in nV abgespeichert
- /iV 1 def % Startwert ist iV=1
- 0 nV { iV log add /iV iV 1 add def } repeat % 0 + log(1) + log(2) + ... + log(n) Die Null ist dazu n\"{o}tig um die erste Addition machen zu k\"{o}nnen
- end
- } def
- /binomial_comb{ % log(N!) - log(k!) - log((n-k)!) = log[N!/(k!*(n-k)!)]
- 2 dict begin
- /nV exch def
- /NV exch def
- NV SumLog nV SumLog sub
- NV nV sub SumLog sub
- end
- } def
- /PnN {
- 3 dict begin
- /pV exch def
- /nV exch def
- /NV exch def
- 10
- NV nV binomial_comb
- nV pV log mul
- NV nV sub 1 pV sub log mul add add
- exp
- end
- } def
+ /SumLog {% log(1) + log(2) + ... + log(n) = log(n!)
+ 2 dict begin % Erwartet die Eingabe eines Wertes, n\"{a}mlich bis zu welchem Wert addiert werden soll ---> n
+ /nV exch def % der \"{u}bergebene Wert wird in nV abgespeichert
+ /iV 1 def % Startwert ist iV=1
+ 0 nV { iV log add /iV iV 1 add def } repeat % 0 + log(1) + log(2) + ... + log(n)
+ %Die Null ist dazu n\"{o}tig um die erste Addition machen zu k\"{o}nnen
+ end
+ } def
+ /binomial_comb{ % log(N!) - log(k!) - log((n-k)!) = log[N!/(k!*(n-k)!)]
+ 2 dict begin
+ /nV exch def
+ /NV exch def
+ NV SumLog nV SumLog sub
+ NV nV sub SumLog sub
+ end
+ } def
+ /PnN {
+ 3 dict begin
+ /pV exch def
+ /nV exch def
+ /NV exch def
+ 10
+ NV nV binomial_comb
+ nV pV log mul
+ NV nV sub 1 pV sub log mul add add
+ exp
+ end
+ } def
%%------------------------------------------------------------------------------------------------
%%------------------------------------------------------------------------------------------------
%------------------------------- 3 Punkte um die Kurve links auf Null zu bringen mit dem weiter oben gew\"{a}hlten Startwert sind es also 4 ------------
- /x -2 dx add def
- /y 0 def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
- /x -0.65 dx add def
- /y N 0 p PnN 10 -1.3 exp mul def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
- /x -0.375 dx add def
- /y N 0 p PnN 3 div def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x -2 dx add def
+ /y 0 def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x -0.65 dx add def
+ /y N 0 p PnN 10 -1.3 exp mul def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x -0.375 dx add def
+ /y N 0 p PnN 3 div def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
%---------------------------- Ende der 3 Punkte und Beginn eigentlicher Code ----------------
- 0 1 N {% % Schleife geht von 0 bis N in 1-er Schritten
- /k exch def % save loop variable
- N k p PnN /Y exch def
- /x k dx add def
- /y Y def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
- /xOld x def
- } for
+ 0 1 N {% % Schleife geht von 0 bis N in 1-er Schritten
+ /k exch def % save loop variable
+ N k p PnN /Y exch def
+ /x k dx add def
+ /y Y def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /xOld x def
+ } for
%--------------------------- Ende des eigentlichen Codes und Beginn von ---
%------------------------------- 4 Punkte um die Kurve rechts auf Null zu bringen -----------
- /x N 0.375 add dx add def
- /y Y 3 div def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
- /x N 0.65 add dx add def
- /y Y 10 -1.3 exp mul def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
- /x N 2 add dx add def
- /y 0 def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
- /x N 3 add dx add def
- /y 0 def
- x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x N 0.375 add dx add def
+ /y Y 3 div def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x N 0.65 add dx add def
+ /y Y 10 -1.3 exp mul def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x N 2 add dx add def
+ /y 0 def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
+ /x N 3 add dx add def
+ /y 0 def
+ x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def
%---------------------------- Ende der 4 Punkte und Laden der Koordinaten des arrays ; L\"{o}schen (pop) von showpoints??----------------------
- [ xEnd 1 add 0 Coors aload pop % showpoints on top of the stack
+ [ xEnd 1 add 0 Coors aload pop % showpoints on top of the stack
}%
\endplot@cspline
\use@pscode
@@ -1610,7 +1611,9 @@ grestore
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
+ /temp {1 nVal div} bind def
+ [ nVal { temp } repeat ] /XvalRel ED
+ [ 1 1 nVal { nVal div } for ] /XvalRelCum ED
YvalRel bubblesort /YvalRel ED
\else
[ #1 ] /Xval ED