diff options
Diffstat (limited to 'Master/texmf-dist/dvips/pst-func')
-rw-r--r-- | Master/texmf-dist/dvips/pst-func/pst-func.pro | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro index 25a8995ee10..8be99845cd6 100644 --- a/Master/texmf-dist/dvips/pst-func/pst-func.pro +++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro @@ -23,15 +23,18 @@ tx@FuncDict begin % /eps1 1.0e-05 def /eps2 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 0 eq { 1 }{ - dup 1 gt { dup 1 sub factorial mul } if } - ifelse } def + dup 32 gt { pop 1e32 } { + dup 0 eq { 1 }{ + dup 1 gt { dup 1 sub factorial mul } if } + ifelse } ifelse +} def % /MoverN { % m n on stack, returns the binomial coefficient m over n 2 dict begin @@ -121,44 +124,49 @@ tx@FuncDict begin end false /Lineto /lineto load def Line } def -% +%% /Si { % integral sin from 0 to x (arg on stack) - /arg exch def - /Sum arg def - /sign -1 def - /index 3 def - { - arg index exp index div index factorial div sign mul + 10 dict begin % hold all local + /arg exch def % x + /Sum arg def % + /sign -1 def + /I 3 def + { % a sequence of x - x^3/(3*3!) + x^5/(5*5!) -...+... + arg I Power dup abs 1e30 gt { pop exit } if + I factorial div I div sign mul dup abs eps8 lt { pop exit } if Sum add /Sum exch def /sign sign neg def - /index index 2 add def + /I I 2 add def } loop Sum + end } def +% /si { % integral sin from x to infty -> si(x)=Si(x)-pi/2 Si PiHalf sub } def +% /Ci { % integral cosin from x to infty (arg on stack) + 10 dict begin % hold all local abs /arg exch def arg 0 eq { 0 } { - /argExp 1 def - /fact 1 def /Sum CEuler arg ln add def /sign -1 def - /index 2 def + /I 2 def { - /argExp argExp arg arg mul mul def - /fact fact index 1 sub index mul mul def - argExp index div fact div sign mul - dup abs exch Sum add /Sum exch def - eps8 lt { exit } if - /sign sign neg def - /index index 2 add def + arg I Power dup abs 1e30 gt { pop exit } if + I factorial div I div sign mul + dup abs eps8 lt { pop exit } if + Sum add /Sum exch def + /sign sign neg def + /I I 2 add def } loop Sum } ifelse + end } def +% /ci { % integral cosin from x to infty -> ci(x)=-Ci(x)+ln(x)+CEuler dup Ci neg exch abs ln add CEuler add } def |