summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-04-14 20:25:52 +0000
committerKarl Berry <karl@freefriends.org>2023-04-14 20:25:52 +0000
commite97b7bcb9d952da9d1ce6b1cc335f9732b5ed2d5 (patch)
tree4565166445629e5b4779c42b1fdf4398d4708f62 /Master/texmf-dist/dvips
parent538f033220da594727dfeadb2f2dea64d2eeb620 (diff)
pst-func (14apr23)
git-svn-id: svn://tug.org/texlive/trunk@66845 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips')
-rw-r--r--Master/texmf-dist/dvips/pst-func/pst-func.pro56
1 files changed, 40 insertions, 16 deletions
diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro
index a0a58d9e921..be37da189ca 100644
--- a/Master/texmf-dist/dvips/pst-func/pst-func.pro
+++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro
@@ -1,4 +1,4 @@
-%% $Id: pst-func.pro 689 2023-04-03 06:46:27Z herbert $
+%% $Id: pst-func.pro 694 2023-04-05 19:17:32Z herbert $
%%
%% This is file `pst-func.pro',
%%
@@ -16,25 +16,36 @@
%% `pst-func' is a PSTricks package to plot special math functions
%%
%%
-%% version 0.19 / 2023-04-02 Herbert Voss
+%% version 0.20 / 2023-04-04 Herbert Voss
%
/tx@FuncDict 100 dict def
tx@FuncDict begin
%
-/eps1 1.0e-05 def
-/eps2 1.0e-04 def
+/eps4 1.0e-04 def
/eps5 1.0e-05 def
/eps8 1.0e-08 def
%
/PiHalf 1.57079632679489661925640 def
/CEuler 0.5772156649 def % Euler-Mascheroni constant
%
-/factorial { % n on stack, returns n!
- dup 32 gt { pop 1e32 } {
- dup 0 eq { 1 }{
- dup 1 gt { dup 1 sub factorial mul } if }
- ifelse } ifelse
-} def
+/factorialR {
+ dup 1e32 gt { pop 1e32 } {
+ dup 0 eq % check for the argument being 0
+ { pop 1 } % if so, the result is 1
+ { dup 1 sub factorial % call recursively with n - 1
+ mul % multiply the result with n
+ } ifelse
+ } ifelse
+} def
+%
+%Iterative
+/factorial {
+ 1 % initial value for the product
+ 1 1 % for's start value and increment
+ 4 -1 roll % bring the argument to the top as for's end value
+ { mul } for
+} def
+%
%
/MoverN { % m n on stack, returns the binomial coefficient m over n
2 dict begin
@@ -195,14 +206,14 @@ tx@FuncDict begin
{
/Iter Iter 1 add def
Nx func /F exch def % f(Nx)
- F abs eps2 lt { exit } if
+ F abs eps4 lt { exit } if
Nx func' /FS exch def % f'(Nx)
FS 0 eq { /FS 1.0e-06 def } if
Nx func'' /F2S exch def % f''(Nx)
1.0 1.0 F F2S mul FS dup mul div sub div /J exch def
J F mul FS div /Diff exch def
/Nx Nx Diff sub def
- Diff abs eps1 lt Iter MaxIter gt or { exit } if
+ Diff abs eps5 lt Iter MaxIter gt or { exit } if
} loop
Nx % the returned value ist the zero point
} def
@@ -212,13 +223,13 @@ tx@FuncDict begin
/Iter 0 def /MaxIter 200 def
{ pstack
y0 func /F exch def
- F abs eps2 lt { exit } if
+ F abs eps4 lt { exit } if
y0 F sub /Phi exch def
Phi func /F2 exch def
- F2 abs eps2 le { exit }{
+ F2 abs eps4 le { exit }{
Phi y0 sub dup mul Phi F2 sub 2 Phi mul sub y0 add Div /Diff exch def
y0 Diff sub /y0 exch def
- Diff abs eps1 le { exit } if
+ Diff abs eps5 le { exit } if
} ifelse
/Iter Iter 1 add def
Iter MaxIter gt { exit } if
@@ -371,7 +382,7 @@ tx@FuncDict begin
% https://mathworld.wolfram.com/ConfluentHypergeometricFunctionoftheFirstKind.html
/ConfHyperFunc { % Confluent Hypergeometric Funtion of the First Kind
% on stack must be a b z
- 10 dict begin
+ 15 dict begin
/z ED /b ED /a ED
/sum 1 def
/k 0 def
@@ -389,6 +400,19 @@ tx@FuncDict begin
end
} def
%
+% https://mathworld.wolfram.com/BetaFunction.html
+/BETA {% BETA function ((p-1)!(q-1)!)/(p+q-1)!
+ % on stack must be p q
+ 2 dict begin
+ /q ED
+ /p ED
+ p 1 sub factorial q 1 sub factorial
+ mul
+ p q add 1 sub factorial
+ div
+ end
+} def
+%
end
%
/arraySum { % on stack the array