summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-17 01:24:33 +0000
committerKarl Berry <karl@freefriends.org>2008-11-17 01:24:33 +0000
commit7bd53a20b9a4f0c2696bbe01fda5d72677181f04 (patch)
tree8b1c6cc50c27fb05128ce8b175087fa8324b3f0c /Master/texmf-dist/dvips
parent4a5b7eaf919cce085598cf22a5715b1f1ce9f8f7 (diff)
pst-func update (14nov08)
git-svn-id: svn://tug.org/texlive/trunk@11314 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips')
-rw-r--r--Master/texmf-dist/dvips/pst-func/pst-func.pro38
1 files changed, 35 insertions, 3 deletions
diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro
index 03bdf15ef53..8a4b0e98f8e 100644
--- a/Master/texmf-dist/dvips/pst-func/pst-func.pro
+++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro
@@ -1,3 +1,4 @@
+%% $Id: pst-func.pro 55 2008-11-14 12:01:12Z herbert $
%%
%% This is file `pst-func.pro',
%%
@@ -15,7 +16,7 @@
%% `pst-func' is a PSTricks package to plot special math functions
%%
%%
-%% version 0.08 / 2008-03-21 Herbert Voss <voss _at_ pstricks.de>
+%% version 0.09 / 2008-03-22 Herbert Voss <voss _at_ pstricks.de>
%
/tx@FuncDict 100 dict def
tx@FuncDict begin
@@ -32,13 +33,15 @@ tx@FuncDict begin
ifelse } def
%
/MoverN { % m n on stack, returns the binomial coefficient m over n
+ 2 dict begin
/n exch def /m exch def
n 0 eq { 1 }{
m n eq { 1 }{
m factorial n factorial m n sub factorial mul div } ifelse } ifelse
+ end
} def
%
-/BezierPascal [
+/Pascal [
[ 1 ] % 0
[ 1 1 ] % 1
[ 1 2 1 ] % 2
@@ -55,7 +58,7 @@ tx@FuncDict begin
10 dict begin % hold all local
/t ED
/t1 1 t sub def % t1=1-t
- /Coeff BezierPascal BezierType get def % get the coefficients
+ /Coeff Pascal BezierType get def % get the coefficients
0 0 % initial values for x y
BezierType -1 0 { % BezierType,...,2,1,0
/I ED % I=BezierType,...,2,1,0
@@ -73,6 +76,7 @@ tx@FuncDict begin
} def
%
/BezierCurve { % on stack [ coors psk@plotpoints BezierType
+% 10 dict begin
/BezierType ED
1 exch div /epsilon ED
] /Points ED % yi xi ... y3 x3 y2 x2 y1 x1 y0 x0
@@ -84,6 +88,34 @@ tx@FuncDict begin
t GetBezierCoor
t 0.9999 lt { lineto }{ 1 epsilon sub GetBezierCoor 4 2 roll ArrowB pop pop pop pop } ifelse
} for
+% end
+} def
+%
+/Bernstein { % on stack tStart tEnd plotpoints i n
+ 12 dict begin % hold all local
+ /envelope ED % plot envelope?
+ /n ED
+ /i ED
+ /ni n i sub def
+ /epsilon ED % step=1/plotpoints
+ /tEnd ED
+ /tStart ED
+%
+% B_{i,n}(t)=\binom{n}{i}t^i(1-t)^{n-i} (Bernstein)
+% f_n(x)=\frac{1}{\sqrt{\pi n\cdot x(1-x)}} (envelope)
+%
+ n i MoverN /noveri ED % \binom{n}{i}
+ [ % for the array of points
+ tStart epsilon tEnd {
+ dup dup /t ED % leave one on stack
+ neg 1 add /t1 ED % t1=1-t
+ envelope
+ { t t1 mul 4 mul Pi2 mul n mul sqrt 1 exch Div } % envelope
+ { noveri t i exp mul t1 ni exp mul } ifelse % t f(t)
+ ScreenCoor % convert to screen coor
+ } for
+ end
+ false /Lineto /lineto load def Line
} def
%
/Si { % integral sin from 0 to x (arg on stack)