diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-17 20:56:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-17 20:56:26 +0000 |
commit | 05e9b35a727bb46f989306cbfdc2cf5e7ad374d2 (patch) | |
tree | 96e823627da3436b76232a6ae878e549702b9335 /Master/texmf-dist/tex/generic/pst-func | |
parent | 5d3cadfdc2be7609fb2af4a472870c838bafda75 (diff) |
pst-func (17may19)
git-svn-id: svn://tug.org/texlive/trunk@51149 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.tex | 327 |
1 files changed, 167 insertions, 160 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 253e3f48ce6..0bef36090b6 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -31,8 +31,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} % -\def\fileversion{0.92} -\def\filedate{2018/12/13} +\def\fileversion{0.93} +\def\filedate{2019/05/17} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -581,51 +581,56 @@ kOld scx 0 moveto % starting point# %%---------------------------------------------------------------------------------------------------------------------------------------------------------------- %%-------------------- Code, der bei gro{\ss}em N \"{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 - } 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 %%------------------------------------------------------------------------------------------------ %%------------------------------------------------------------------------------------------------ - N ValueSwitch2Log gt { } {% - 0 1 m 1 sub {% - /k exch def % save loop variable - k 0 eq - { /Y q N exp def } - { /Y Y N k sub 1 add mul k div p mul q div def } - ifelse - } for - } ifelse - m 1 n {% % n-m+1 times - /k exch def % save loop variable - N ValueSwitch2Log gt { N k p PnN /Y exch def } - { k 0 eq - { /Y q N exp def } - { /Y Y N k sub 1 add mul k div p mul q div def } - ifelse - } ifelse % recursive definition + N ValueSwitch2Log gt + { } + { 0 1 m 1 sub + {% + /k exch def % save loop variable + k 0 eq + { /Y q N exp def } + { /Y Y N k sub 1 add mul k div p mul q div def } + ifelse + } for + } ifelse + m 1 n {% % n-m+1 times + /k exch def % save loop variable + N ValueSwitch2Log gt + { N k p PnN /Y exch def } + { k 0 eq + { /Y q N exp def } + { /Y Y N k sub 1 add mul k div p mul q div def } + ifelse + } + ifelse % recursive definition \ifx\psk@fillstylename\pst@alternateColors newpath kOld scx 0 moveto @@ -725,7 +730,7 @@ \else\psBinomialF@iii{#1}{#2}{#3}{#5}\fi \fi}% \def\psBinomialF@iii#1#2#3#4{% - \addbefore@par{valuewidth=15}% + \addbefore@par{valuewidth=15}% \begin@OpenObj \addto@pscode{% /ValueSwitch2Log \psFunc@Switch2Log\space def @@ -740,72 +745,75 @@ \ifPst@markZeros /kOld dx neg m add def \else /kOld m def \fi \psFunc@leftEnd 0 eq - { } - { kOld 0 eq - { kOld \psFunc@leftEnd sub scx 0 moveto % starting point - \ifPst@LineEnding - kOld \psFunc@radiusout\pst@number\psxunit div sub scx 0 L stroke - kOld scx 0 newpath \psFunc@radiusout 0 360 arc kOld scx 0 \psFunc@radiusinR 360 0 arcn closepath \pst@usecolor\psk@LineEndColorR fill \else - kOld scx 0 L stroke \fi } - { } ifelse } ifelse + { } + { kOld 0 eq + { kOld \psFunc@leftEnd sub scx 0 moveto % starting point + \ifPst@LineEnding + kOld \psFunc@radiusout\pst@number\psxunit div sub scx 0 L stroke + kOld scx 0 newpath \psFunc@radiusout 0 360 arc kOld scx 0 + \psFunc@radiusinR 360 0 arcn closepath \pst@usecolor\psk@LineEndColorR fill + \else + kOld scx 0 L stroke + \fi + }{ } ifelse } ifelse kOld scx 0 moveto % starting point %%---------------------------------------------------------------------------------------------------------------------------------------------------------------- %%-------------------- Code, der bei gro{\ss}em N \"{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 - } 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 %%------------------------------------------------------------------------------------------------ %%------------------------------------------------------------------------------------------------ - 0 1 m 1 sub { - /k exch def % save loop variable - N ValueSwitch2Log gt { k 0 eq - { N k p PnN /Y exch def /F Y def } - { N k p PnN /Y exch def /F F Y add def } - ifelse } - { k 0 eq - { /Y q N exp def - /F Y def } - { /Y Y N k sub 1 add mul k div p mul q div def - /F F Y add def - } ifelse - } ifelse - } for - m 1 n { % n-m+1 times - /k exch def % save loop variable - N ValueSwitch2Log gt { k 0 eq - { N k p PnN /Y exch def /F Y def } - { N k p PnN /Y exch def /F F Y add def } ifelse } - { k 0 eq - { /Y q N exp def - /F Y def } - { /Y Y N k sub 1 add mul k div p mul q div def - /F F Y add def - } ifelse - } ifelse % recursive definition - F 1 gt { /F 1 def } if + 0 1 m 1 sub { + /k exch def % save loop variable + N ValueSwitch2Log gt { k 0 eq + { N k p PnN /Y exch def /F Y def } + { N k p PnN /Y exch def /F F Y add def } + ifelse + }{ k 0 eq + { /Y q N exp def /F Y def } + { /Y Y N k sub 1 add mul k div p mul q div def + /F F Y add def + } ifelse + } ifelse + } for + m 1 n { % n-m+1 times + /k exch def % save loop variable + N ValueSwitch2Log gt + { k 0 eq + { N k p PnN /Y exch def /F Y def } + { N k p PnN /Y exch def /F F Y add def } + ifelse } + { k 0 eq + { /Y q N exp def /F Y def } + { /Y Y N k sub 1 add mul k div p mul q div def /F F Y add def + } ifelse + } ifelse % recursive definition + F 1 gt { /F 1 def } if \ifPst@markZeros kOld scx F scy L k dx add scx F scy L k dx add scx 0 L kOld 1 add scx 0 L \else kOld scx F scy newpath \psFunc@radiusout 0 360 arc kOld scx F scy \psFunc@radiusinL 360 0 arcn closepath \pst@usecolor\psk@LineEndColorL fill @@ -875,60 +883,58 @@ kOld scx 0 moveto % starting point %%---------------------------------------------------------------------------------------------------------------------------------------------------------------- %%-------------------- Code, der bei gro{\ss}em N \"{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 - } 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 %%------------------------------------------------------------------------------------------------ - 0 1 m 1 sub { - /k exch def % save loop variable - N ValueSwitch2Log gt { k 0 eq - { N k p PnN /Y exch def /F Y def /FS 1 F sub def } - { N k p PnN /Y exch def /F F Y add def /FS 1 F sub def } - ifelse } - { k 0 eq - { /Y q N exp def - /F Y def /FS 1 F sub def } - { /Y Y N k sub 1 add mul k div p mul q div def - /F F Y add def /FS 1 F sub def } - ifelse } ifelse - } for - m 1 n { % n-m+1 times - /k exch def % save loop variable - N ValueSwitch2Log gt { k 0 eq - { N k p PnN /Y exch def /F Y def /FS 1 F sub def } - { N k p PnN /Y exch def /F F Y add def /FS 1 F sub def } ifelse } - { k 0 eq - { /Y q N exp def - /F Y def /FS 1 F sub def } - { /Y Y N k sub 1 add mul k div p mul q div def - /F F Y add def /FS 1 F sub def } - ifelse - } ifelse % recursive definition - FS 0 lt { /FS 0 def } if + 0 1 m 1 sub { + /k exch def % save loop variable + N ValueSwitch2Log gt { k 0 eq + { N k p PnN /Y exch def /F Y def /FS 1 F sub def } + { N k p PnN /Y exch def /F F Y add def /FS 1 F sub def } + ifelse } + { k 0 eq + { /Y q N exp def /F Y def /FS 1 F sub def } + { /Y Y N k sub 1 add mul k div p mul q div def + /F F Y add def /FS 1 F sub def } + ifelse } ifelse + } for + m 1 n { % n-m+1 times + /k exch def % save loop variable + N ValueSwitch2Log gt { k 0 eq + { N k p PnN /Y exch def /F Y def /FS 1 F sub def } + { N k p PnN /Y exch def /F F Y add def /FS 1 F sub def } ifelse } + { k 0 eq + { /Y q N exp def /F Y def /FS 1 F sub def } + { /Y Y N k sub 1 add mul k div p mul q div def + /F F Y add def /FS 1 F sub def } + ifelse + } ifelse % recursive definition + FS 0 lt { /FS 0 def } if \ifPst@markZeros kOld scx FS scy L k dx add scx FS scy L k dx add scx 0 L kOld 1 add scx 0 L \else \ifPst@LineEnding @@ -1033,6 +1039,7 @@ nV pV log mul NV nV sub 1 pV sub log mul add add exp + end } def %%------------------------------------------------------------------------------------------------ %%------------------------------------------------------------------------------------------------ |