diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-09 01:01:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-09 01:01:02 +0000 |
commit | 4a6fbdc0e89fde6f9efcaa24de3db8e137da4404 (patch) | |
tree | efe2b5d7e2f07d6ce478982a9b1e5f43d41cb56c /Master/texmf-dist/dvips/pst-func | |
parent | 524dc4b7a5d60a1c703450ac6fd3749ffe81afa3 (diff) |
trunk/Master/texmf-dist/dvips
git-svn-id: svn://tug.org/texlive/trunk@88 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips/pst-func')
-rw-r--r-- | Master/texmf-dist/dvips/pst-func/pst-func.pro | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro new file mode 100644 index 00000000000..580e702c837 --- /dev/null +++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro @@ -0,0 +1,117 @@ +%% +%% This is file `pst-func.pro', +%% +%% IMPORTANT NOTICE: +%% +%% Package `pst-func.tex' +%% +%% Herbert Voss <voss _at_ perce.de> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `pst-func' is a PSTricks package to plot special math functions +%% +%% +%% version 0.02 / 2004-11-08 Herbert Voss <voss _at_ pstricks.de> +% +/tx@FuncDict 40 dict def +tx@FuncDict begin +% +/eps1 1.0e-05 def +/eps2 1.0e-04 def +/MaxIter 255 def +/func { coeff Derivation FuncValue } def +/func' { coeff Derivation 1 add FuncValue } def +/func'' { coeff Derivation 2 add FuncValue } def +% +/NewtonMehrfach {% the start value must be on top of the stack + /Nx exch def + /Iter 0 def + { + /Iter Iter 1 add def + Nx func /F exch def % f(Nx) + F abs eps2 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 + } loop + Nx % the returned value ist the zero point +} def + +/Steffensen {% the start value must be on top of the stack + /y0 exch def % the start value + /Iter 0 def + { + y0 func /F exch def + F abs eps2 lt { exit } if + y0 F sub /Phi exch def + Phi func /F2 exch def + F2 abs eps2 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 + } ifelse + /Iter Iter 1 add def + Iter MaxIter gt { exit } if + } loop + y0 % the returned value ist the zero point +} def +% +/Horner {% x [coeff] must be on top of the stack + aload length + dup 2 add -1 roll + exch 1 sub { + dup 4 1 roll + mul add exch + } repeat + pop % the y value is on top of the stack +} def +% +/FuncValue {% x [coeff] Derivation must be on top of the stack + { + aload % a0 a1 a2 ... a(n-1) [array] + length % a0 a1 a2 ... a(n-1) n + 1 sub /grad exch def % a0 a1 a2 ... a(n-1) + grad -1 1 { % for n=grad step -1 until 1 + /n exch def % Laufvariable speichern + n % a0 a1 a2 ... a(n-1) n + mul % a0 a1 a2 ... a(n-1)*n + grad 1 add % a0 a1 a2 ... a(n-1)*n grad+1 + 1 roll % an*na0 a1 a2 ... a(n-2) + } for + pop % loesche a0 + grad array astore % [ a1 a2 ... a(n-2)] + } repeat + Horner +} def +% +/FindZeros { % dxN dxZ must be on top of the stack (x0..x1 the intervall) + /dxZ exch def /dxN exch def + /pstZeros [] def + x0 dxZ x1 { % suche Nullstellen + /xWert exch def + xWert NewtonMehrfach + %xWert Steffensen + /xNull exch def + pstZeros aload length /Laenge exch def % now test if value is a new one + Laenge 0 eq + { xNull 1 } + { /newZero true def + Laenge { + xNull sub abs dxN lt { /newZero false def } if + } repeat + pstZeros aload pop + newZero { xNull Laenge 1 add } { Laenge } ifelse } ifelse + array astore /pstZeros exch def + } for +} def +% +% +end |