From f99cc5a22fe69fa6f1b3f864c9185ec424fd2e49 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 7 Mar 2017 22:42:17 +0000 Subject: pst-func (7mar17) git-svn-id: svn://tug.org/texlive/trunk@43423 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/generic/pst-func/pst-func.tex | 572 +++++++++++++++------ 1 file changed, 413 insertions(+), 159 deletions(-) (limited to 'Master/texmf-dist/tex/generic/pst-func') 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 579d344acf8..7d42c7f194d 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -19,7 +19,7 @@ %% \csname PSTfuncLoaded\endcsname \let\PSTfuncLoaded\endinput -% Requires some PSTricks packages +% Requires some PSTricks packages \ifx\PSTricksLoaded\endinput\else \input pstricks.tex\fi \ifx\PSTnodesLoaded\endinput\else \input pst-plot.tex\fi \ifx\PSTmathLoaded\endinput \else \input pst-math.tex\fi @@ -31,8 +31,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} % -\def\fileversion{0.82} -\def\filedate{2016/05/01} +\def\fileversion{0.83} +\def\filedate{2017/03/07} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -94,7 +94,7 @@ coeff=0 1, % coeff=a0 a1 a2 a3 ... Derivation=0, % 0 is the original function markZeros=false,% no dots for the zeros - epsZero=0.1, % the distance between two zero points + epsZero=0.1, % the distance between two zero points dZero=0.1, % the distance of the x value for scanning the function zeroLineTo=-1, % a line to the value of the lineTo's Derivation (-1= none) zeroLineStyle=dashed,% @@ -139,7 +139,7 @@ y0 % the returned value ist the zero point 0 \tx@ScreenCoor pstack 3 0 360 arc gsave 0 0 1 setrgbcolor fill grestore 1 setlinewidth stroke -} def +} def \fi % \def\psPolynomial{\pst@object{psPolynomial}} @@ -157,7 +157,7 @@ /dx x1 x0 sub \psk@plotpoints\space div def /Derivation \psk@Derivation\space def /x x0 def - \ifPst@markZeros + \ifPst@markZeros 5 dict begin % hold all local! gsave \pst@number\psk@zeroLineWidth SLW @@ -168,10 +168,10 @@ xZero \pst@number\psxunit mul /xPixel exch def \psk@dotsize \@nameuse{psds@\psk@dotstyle}% - xPixel 0 Dot + xPixel 0 Dot \psk@zeroLineTo\space 0 ge { % line to function \psk@lineTo xPixel 0 moveto - xZero coeff \psk@zeroLineTo\space FuncValue + xZero coeff \psk@zeroLineTo\space FuncValue \pst@number\psyunit mul xPixel exch L \@nameuse{psls@\psk@zeroLineStyle} } if @@ -180,7 +180,7 @@ end \fi /xy { - x \psk@xShift\space sub coeff Derivation FuncValue \pst@number\psyunit mul + x \psk@xShift\space sub coeff Derivation FuncValue \pst@number\psyunit mul x \pst@number\psxunit mul exch } def xy moveto @@ -210,7 +210,7 @@ mark /n 2 def \psk@plotpoints { - xy + xy n 2 roll /n n 2 add def /x x dx add def @@ -257,13 +257,13 @@ \psplot{#2}{#3}[ /nue \psk@nue def /epsilon 1e-20 def ]{% /Sum 0 def /Iter 0 def - {/Sum_Iter + {/Sum_Iter x dup mul 4 div Iter exp % nominator nue Iter add 1 add GAMMA Iter tx@AddMathFunc begin ! end mul % denominator Div def Sum_Iter abs epsilon lt { exit } if /Sum Sum Sum_Iter add def - /Iter Iter 1 add def + /Iter Iter 1 add def } loop x 0.5 mul nue exp Sum mul }% @@ -280,7 +280,7 @@ \psset{plotpoints=200}% \psset{#1}% \psplot[algebraic=false]{#2}{#3}{% - Euler x \psk@mue sub dup mul 2 div \psk@sigma dup mul div neg exp + Euler x \psk@mue sub dup mul 2 div \psk@sigma dup mul div neg exp 1.0 \psk@sigma div TwoPi sqrt div mul% }% }\ignorespaces} @@ -296,20 +296,20 @@ /a #1 def /dx #2 #1 sub \psk@plotpoints\space div def /b a dx add def - /scx { \pst@number\psxunit mul } def + /scx { \pst@number\psxunit mul } def /scy { \pst@number\psyunit mul } def - tx@FuncDict begin + tx@FuncDict begin /C 1 \psk@sigma div TwoPi sqrt div def /SFunc {% x on Stack - Euler exch \psk@mue\space sub dup mul 2 div \psk@sigma\space dup mul div neg exp C mul - } def + Euler exch \psk@mue\space sub dup mul 2 div \psk@sigma\space dup mul div neg exp C mul + } def end % a scx 0 moveto a scx 0 \@nameuse{beginqp@\psplotstyle} \psk@plotpoints 1 sub { a b \psk@Simpson % a b M on Stack tx@FuncDict begin Simpson I end % y value on stack - scy b scx exch \@nameuse{doqp@\psplotstyle} %lineto + scy b scx exch \@nameuse{doqp@\psplotstyle} %lineto /b b dx add def } repeat % stroke @@ -397,17 +397,17 @@ \def\psPrintValue@i#1{\expandafter\psPrintValue@ii#1,,\@nil} \def\psPrintValue@ii#1,#2,#3\@nil{% #1,#2 only for algebraic code \begin@SpecialObj - \addto@pscode{ - gsave \psk@PSfont findfont \psk@fontscale scalefont setfont - \ifPst@algebraic - /x #1 def - /Func (#2) tx@AlgToPs begin AlgToPs end cvx def - Func + \addto@pscode{ + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont + \ifPst@algebraic + /x #1 def + /Func (#2) tx@AlgToPs begin AlgToPs end cvx def + Func \else #1 \fi \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if \psk@valuewidth string cvs %/Output exch def % save output \ifPst@comma dot2comma \fi % do we have to change dot to comma - \psk@xShift\space 0 moveto %Output + \psk@xShift\space 0 moveto %Output show grestore }% \end@SpecialObj% @@ -425,20 +425,20 @@ /mfont { \psk@PSfont findfont \psk@fontscale scalefont setfont } bind def /mfontexp { \psk@PSfont findfont \psk@fontscale 1.2 div scalefont setfont } bind def /s1 { /Symbol findfont \psk@fontscale scalefont setfont } bind def - \ifPst@algebraic + \ifPst@algebraic /x #1 def - /Func (#2) tx@AlgToPs begin AlgToPs end cvx def - Func + /Func (#2) tx@AlgToPs begin AlgToPs end cvx def + Func \else #1 \fi /value ED \psk@Scin { value 0 ne { value log floor cvi /expon ED }{ /expon 0 def } ifelse - value 10 expon exp div - \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul + value 10 expon exp div + \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul \ifPst@round round \else cvi \fi exch div } if \psk@decimals 0 eq { cvi } if /numb ED expon \psk@valuewidth string cvs /expon exch def - numb \psk@valuewidth string cvs + numb \psk@valuewidth string cvs \ifPst@comma dot2comma \fi % do we have to change dot to comma /Output exch def /txspc \psk@fontscale 4 div def @@ -447,12 +447,12 @@ txspc 0 rmoveto mfont (10) show txspc 2 div txspc 1.5 mul rmoveto mfontexp expon show } { value - \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul + \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul \ifPst@round round \else cvi \fi exch div } if \psk@decimals 0 eq { cvi } if %inserted to handle decimals=0 - \psk@valuewidth string cvs + \psk@valuewidth string cvs \ifPst@comma dot2comma \fi % do we have to change dot to comma - \psk@xShift\space 0 moveto mfont %Output + \psk@xShift\space 0 moveto mfont %Output show } ifelse }% @@ -522,8 +522,22 @@ }% % \define@boolkey[psset]{pst-func}[Pst@]{printValue}[true]{} +\define@boolkey[psset]{pst-func}[Pst@]{LineEnding}[true]{} +\define@boolkey[psset]{pst-func}[Pst@]{VLines}[true]{} \define@key[psset]{pst-func}{barwidth}[1]{\def\psFunc@barwidth{#1 }}% a factor, not a dimen -\psset[pst-func]{printValue=false,barwidth=1} +\define@key[psset]{pst-func}{rightEnd}[2]{\def\psFunc@rightEnd{#1 }} +\define@key[psset]{pst-func}{leftEnd}[2]{\def\psFunc@leftEnd{#1 }} +\define@key[psset]{pst-func}{labelangle}[90]{\def\psFunc@langle{#1 }} +\define@key[psset]{pst-func}{xlabelsep}[0]{\def\psFunc@xlabelsep{#1 }} +\define@key[psset]{pst-func}{radiusout}[2]{\def\psFunc@radiusout{#1 }} +\define@key[psset]{pst-func}{radiusinL}[0]{\def\psFunc@radiusinL{#1 }} +\define@key[psset]{pst-func}{radiusinR}[1.5]{\def\psFunc@radiusinR{#1 }} +\define@key[psset]{pst-func}{LabelColor}[black]{\pst@getcolor{#1}\psk@LabelColor} +\define@key[psset]{pst-func}{LineEndColorL}[green]{\pst@getcolor{#1}\psk@LineEndColorL} +\define@key[psset]{pst-func}{LineEndColorR}[red]{\pst@getcolor{#1}\psk@LineEndColorR} +\define@key[psset]{pst-func}{vlinestyle}[solid]{\def\psvlinestyle{#1}} +\psset[pst-func]{printValue=false,barwidth=1,labelangle=90,xlabelsep=0,LabelColor=black,LineEndColorL=green,LineEndColorR=red, +radiusout=2,radiusinL=0,radiusinR=1.5,LineEnding=true,leftEnd=1,rightEnd=2,VLines=false} % \def\psBinomial{\pst@object{psBinomial}} \def\psBinomial@i#1#2{\psBinomial@ii#1,,,\@nil{#2}}% @@ -565,12 +579,12 @@ kOld scx Y scy L k dx add scx Y scy L \ifPst@markZeros k dx add scx 0 L kOld 1 add scx 0 L \fi \ifPst@printValue - gsave \psk@PSfont findfont \psk@fontscale scalefont setfont - Y \psk@valuewidth string cvs + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\psk@LabelColor % + Y \psk@valuewidth string cvs \ifPst@comma dot2comma \fi - k scx \psk@fontscale 2 div add + k scx \psk@fontscale 2 div add \psFunc@xlabelsep scx add Y scy \pst@number\pslabelsep add moveto - 90 rotate show grestore + \psFunc@langle rotate show grestore \fi /kOld kOld 1 add def } for @@ -581,64 +595,304 @@ \end@OpenObj% }% % -\def\psBinomialN{\pst@object{psBinomialN}} +\def\psBinomialN{\pst@object{psBinomialN}}% \def\psBinomialN@i#1#2{% +\leavevmode +\pst@killglue +\begingroup +\use@par +\init@pscode +\def\cplotstyle{curve}% +\ifx\psplotstyle\cplotstyle \@nameuse{beginplot@\psplotstyle}\fi +\addto@pscode{% +\ifx\psplotstyle\cplotstyle /Curve true def \else /Curve false def \fi + /scx { \pst@number\psxunit mul } def + /scy { \pst@number\psyunit mul } def + /N #1 def + /p #2 def % probability + /q 1 p sub def + /E N p mul def + /sigma E q mul sqrt def % variant + /dx 1.0 sigma div 2 div def + /xOld dx neg E sub sigma div def + /xEnd xOld neg dx add scx def + Curve + { /Coors [xOld dx sub scx 0] def }% saves the coordinates for curve + { xOld scx 0 moveto } % starting point + ifelse + 0 1 N {% % N times + /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 % recursive definition + /x k E sub sigma div dx add def + /y Y sigma mul def % normalize + Curve + { x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def} + { xOld scx y scy L x scx y scy L + \ifPst@markZeros x scx 0 L \fi % + } ifelse + \ifPst@printValue + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\psk@LabelColor % + y \psk@valuewidth string cvs %/Output exch def + \ifPst@comma dot2comma \fi % do we have to change dot to comma + x dx sub scx \psk@fontscale 2 div add \psFunc@xlabelsep scx add + y scy \pst@number\pslabelsep add moveto + \psFunc@langle rotate show grestore + \fi + /xOld x def + } for + Curve { [ xEnd 0 Coors aload pop } if% showpoints on top of the stack +}% +\ifx\psplotstyle\cplotstyle\@nameuse{endplot@\psplotstyle}\else +\psk@fillstyle +\pst@stroke +\fi +\use@pscode +\endgroup +\ignorespaces% +}% +\def\psBinomialF{\pst@object{psBinomialF}} +\def\psBinomialF@i#1#2{\psBinomialF@ii#1,,,\@nil{#2}}% +\def\psBinomialF@ii#1,#2,#3,#4\@nil#5{% + \def\pst@tempA{#2}% + \ifx\pst@tempA\@empty + \psBinomialF@iii{0}{#1}{#1}{#5}% + \else + \def\pst@tempA{#3}% + \ifx\pst@tempA\@empty\psBinomialF@iii{#1}{#2}{#2}{#5}% + \else\psBinomialF@iii{#1}{#2}{#3}{#5}\fi + \fi}% +\def\psBinomialF@iii#1#2#3#4{% + \begin@OpenObj% + \addto@pscode{ + /scx { \pst@number\psxunit mul } def + /scy { \pst@number\psyunit mul } def + /m #1 def + /n #2 def + /N #3 def + /p #4 def + /dx \psFunc@barwidth 2 div def + /q 1 p sub def + \ifPst@markZeros /kOld dx neg m add def \else + /kOld m def \fi + kOld scx 0 moveto % starting point + 0 1 m 1 sub { + /k exch def % save loop variable + 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 + } for + m 1 n { % n-m+1 times + /k exch def % save loop variable + 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 % recursive definition + \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 + \ifPst@LineEnding + k 0 eq + { } + { 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 } ifelse \fi + kOld \ifPst@LineEnding\psFunc@radiusout\pst@number\psxunit div add \fi + k 0 eq + { \psFunc@leftEnd sub } + { } ifelse + scx F scy moveto + k 1 add + \ifPst@LineEnding\psFunc@radiusout\pst@number\psxunit div sub \fi + k N eq + { \psFunc@rightEnd add } + { } ifelse + scx F scy L \pst@usecolor\pslinecolor [1 0] 0 setdash stroke + \ifPst@LineEnding + k N eq + { } + { k 1 add scx F scy newpath \psFunc@radiusout 0 360 arc k 1 add scx F scy \psFunc@radiusinR 360 0 arcn closepath \pst@usecolor\psk@LineEndColorR fill } + ifelse + \ifPst@VLines + Y \psFunc@radiusout\pst@number\psyunit div 2 mul le + { } + { k scx F Y sub \psFunc@radiusout\pst@number\psyunit div add scy moveto k scx F \psFunc@radiusout\pst@number\psyunit div sub scy L \pst@usecolor\pslinecolor [3 2] 0 setdash stroke } ifelse \fi + \else + \ifPst@VLines + Y \psFunc@radiusout\pst@number\psyunit div 0.1 mul le + { } + { k scx F Y sub scy moveto k scx F scy L \pst@usecolor\pslinecolor [3 2] 0 setdash stroke } ifelse + \fi\fi\fi + \ifPst@printValue + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\psk@LabelColor % + F \psk@valuewidth string cvs + \ifPst@comma dot2comma \fi + k scx \psk@fontscale 2 div add \psFunc@xlabelsep scx add + F scy \pst@number\pslabelsep add moveto + \psFunc@langle rotate show grestore + \fi + /kOld kOld 1 add def + } for + }% + \end@OpenObj% +}% +% +\def\psBinomialFS{\pst@object{psBinomialFS}} +\def\psBinomialFS@i#1#2{\psBinomialFS@ii#1,,,\@nil{#2}}% +\def\psBinomialFS@ii#1,#2,#3,#4\@nil#5{% + \def\pst@tempA{#2}% + \ifx\pst@tempA\@empty + \psBinomialFS@iii{0}{#1}{#1}{#5}% + \else + \def\pst@tempA{#3}% + \ifx\pst@tempA\@empty\psBinomialFS@iii{#1}{#2}{#2}{#5}% + \else\psBinomialFS@iii{#1}{#2}{#3}{#5}\fi + \fi}% +\def\psBinomialFS@iii#1#2#3#4{% + \begin@OpenObj% + \addto@pscode{ + /scx { \pst@number\psxunit mul } def + /scy { \pst@number\psyunit mul } def + /m #1 def + /n #2 def + /N #3 def + /p #4 def + /dx \psFunc@barwidth 2 div def + /q 1 p sub def + \ifPst@markZeros /kOld dx neg m add def \else + /kOld m def \fi + kOld scx 0 moveto % starting point + 0 1 m 1 sub { + /k exch def % save loop variable + 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 + } for + m 1 n { % n-m+1 times + /k exch def % save loop variable + 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 % recursive definition + \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 + k 0 eq + { } + { kOld scx FS scy newpath \psFunc@radiusout 0 360 arc kOld scx FS scy \psFunc@radiusinL 360 0 arcn closepath \pst@usecolor\psk@LineEndColorL fill } ifelse \fi + kOld \ifPst@LineEnding\psFunc@radiusout\pst@number\psxunit div add \fi + k 0 eq + { \psFunc@leftEnd sub } + { } ifelse + scx FS scy moveto + k 1 add + \ifPst@LineEnding\psFunc@radiusout\pst@number\psxunit div sub \fi + k N eq + { \psFunc@rightEnd add } + { } ifelse + scx FS scy L \pst@usecolor\pslinecolor [1 0] 0 setdash stroke + \ifPst@LineEnding + k N eq + { } + { k 1 add scx FS scy newpath \psFunc@radiusout 0 360 arc k 1 add scx FS scy \psFunc@radiusinR 360 0 arcn closepath \pst@usecolor\psk@LineEndColorR fill } + ifelse + \ifPst@VLines + Y \psFunc@radiusout\pst@number\psyunit div 2 mul le + { } + { k scx FS Y add \psFunc@radiusout\pst@number\psyunit div sub scy moveto k scx FS \psFunc@radiusout\pst@number\psyunit div add scy L \pst@usecolor\pslinecolor [3 2] 0 setdash stroke } ifelse \fi + \else + \ifPst@VLines + Y \psFunc@radiusout\pst@number\psyunit div 0.1 mul le + { } + { k scx FS Y add scy moveto k scx FS scy L \pst@usecolor\pslinecolor [3 2] 0 setdash stroke } ifelse + \fi\fi\fi + \ifPst@printValue + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\psk@LabelColor % + FS \psk@valuewidth string cvs + \ifPst@comma dot2comma \fi + k scx \psk@fontscale 2 div add \psFunc@xlabelsep scx add + FS scy \pst@number\pslabelsep add moveto + \psFunc@langle rotate show grestore + \fi + /kOld kOld 1 add def + } for + }% + \end@OpenObj% +}% +% +\def\psBinomialC{\pst@object{psBinomialC}} +\def\psBinomialC@i#1#2{% \leavevmode \pst@killglue \begingroup \use@par \init@pscode \def\cplotstyle{curve}% - \ifx\psplotstyle\cplotstyle \@nameuse{beginplot@\psplotstyle} \fi% - \addto@pscode{ + \ifx\psplotstyle\cplotstyle \@nameuse{beginplot@\psplotstyle}\fi + \addto@pscode{% \ifx\psplotstyle\cplotstyle /Curve true def \else /Curve false def \fi - /scx { \pst@number\psxunit mul } def + /scx { \pst@number\psxunit mul } def /scy { \pst@number\psyunit mul } def - /N #1 def - /p #2 def % probability - /q 1 p sub def - /E N p mul def - /sigma E q mul sqrt def % variant + /N #1 def + /p #2 def % Wahrscheinlichkeit + /q 1 p sub def % q = 1 - p + /E N p mul def % Erwartungswert + /sigma E q mul sqrt def % Varianz /dx 1.0 sigma div 2 div def /xOld dx neg E sub sigma div def - /xEnd xOld neg dx add scx def - Curve + /xEnd xOld neg E add dx add scx def +% /xOld dx neg sigma div def +% /xEnd xOld neg dx add scx def + Curve { /Coors [xOld dx sub scx 0] def }% saves the coordinates for curve { xOld scx 0 moveto } % starting point - ifelse + ifelse 0 1 N { % N times /k exch def % save loop variable - k 0 eq + k 0 eq { /Y q N exp def } { /Y Y N k sub 1 add mul k div p mul q div def } ifelse % recursive definition - /x k E sub sigma div dx add def - /y Y sigma mul def % normalize - Curve + /x k 1 div dx add def + /y Y 1 mul def % normalize + Curve { x dx sub scx y scy Coors aload length 2 add array astore /Coors exch def} { xOld scx y scy L x scx y scy L - \ifPst@markZeros x scx 0 L \fi % + \ifPst@markZeros x scx 0 L \fi % } ifelse - \ifPst@printValue - gsave \psk@PSfont findfont \psk@fontscale scalefont setfont + \ifPst@printValue + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\psk@LabelColor % y \psk@valuewidth string cvs %/Output exch def \ifPst@comma dot2comma \fi % do we have to change dot to comma - x dx sub scx \psk@fontscale 2 div add - y scy \pst@number\pslabelsep add moveto - 90 rotate show grestore + x dx sub scx \psk@fontscale 2 div add \psFunc@xlabelsep scx add + y scy \pst@number\pslabelsep add moveto + \psFunc@langle rotate show grestore \fi /xOld x def } for - Curve { [ xEnd 0 Coors aload pop } if % showpoints on top of the stack + Curve { [ xEnd 0 Coors aload pop } if% showpoints on top of the stack }% - \ifx\psplotstyle\cplotstyle\@nameuse{endplot@\psplotstyle}\else% - \psk@fillstyle% - \pst@stroke% - \fi% - \use@pscode% - \endgroup% - \ignorespaces% -} +\ifx\psplotstyle\cplotstyle\@nameuse{endplot@\psplotstyle}\else + \psk@fillstyle + \pst@stroke +\fi +\use@pscode +\endgroup +\ignorespaces} +% % \def\psPoisson{\pst@object{psPoisson}}% with contributions from Gerry Coombes \def\psPoisson@i#1#2{\psPoisson@ii#1,,\@nil{#2}}% @@ -709,9 +963,9 @@ \else \addbefore@par{plotpoints=200,alpha=1,beta=1}% \begin@OpenObj - \psplot[algebraic=false]{#1}{#2}{ + \psplot[algebraic=false]{#1}{#2}{ \psk@beta \psk@alpha add GAMMA - \psk@beta GAMMA \psk@alpha GAMMA mul div + \psk@beta GAMMA \psk@alpha GAMMA mul div 1 x sub \psk@beta 1.0 sub exp mul x \psk@alpha 1.0 sub exp mul } \end@OpenObj% @@ -803,7 +1057,7 @@ \ifdim#1pt<\z@ \psline(#1,0)(0,0)\def\pst@tempA{0}\fi \psplot[algebraic=false]{\pst@tempA}{#2}{ \psk@alpha \psk@beta \psk@alpha neg exp mul % alpha*beta^(-alpha) - x \psk@alpha 1 sub exp % x^(alpha-1) + x \psk@alpha 1 sub exp % x^(alpha-1) mul Euler x \psk@beta div \psk@alpha exp neg exp % e^(-(x/beta)^alpha)) mul } @@ -848,41 +1102,41 @@ \iffalse \def\Lorenz@code{ /D {} def - [ \L@Data\space counttomark dup + [ \L@Data\space counttomark dup 1 sub /m ED 2 div cvi /n ED % m=0..n-1 n=number of pairs ] /xyValues ED - /Xval [] def /Yval [] def /Xmax 0 def + /Xval [] def /Yval [] def /Xmax 0 def /Xsum 0 def /Ysum 0 def /XYsum 0 def xyValues aload pop % [ x y x y x y ... ] n { 2 copy mul XYsum add /XYsum ED - dup - Yval aload length 1 add array astore /Yval ED + dup + Yval aload length 1 add array astore /Yval ED Ysum add /Ysum ED dup - Xval aload length 1 add array astore /Xval ED + Xval aload length 1 add array astore /Xval ED dup Xsum add /Xsum ED dup Xmax gt { /Xmax ED }{ pop } ifelse } repeat Xval bubblesort /Xval ED Yval bubblesort /Yval ED - Xval { Xmax div } forall n array astore /XvalRelMax ED - Xval { Xsum div } forall n array astore /XvalRel ED - Yval { Ysum div } forall n array astore /YvalRel ED - 0 1 n 1 sub { + Xval { Xmax div } forall n array astore /XvalRelMax ED + Xval { Xsum div } forall n array astore /XvalRel ED + Yval { Ysum div } forall n array astore /YvalRel ED + 0 1 n 1 sub { cvi /Index ED - Xval Index get + Xval Index get Yval Index get mul } for n array astore /XmulY ED - XmulY aload length 1 sub { add } repeat + XmulY aload length 1 sub { add } repeat /XmulYsum ED - XmulY { XmulYsum div } forall + XmulY { XmulYsum div } forall n array astore /XmulYdivXmulYsum ED /X [0] def /Y [0] def /Xsum 0 def /Ysum 0 def 0 1 n 1 sub { - /Index ED + /Index ED % XvalRel Index get Xsum add /Xsum ED % X aload length 1 add Xsum exch array astore /X ED X aload length 1 add XvalRelMax Index get exch array astore /X ED %% @@ -891,52 +1145,52 @@ } for \ifPst@Gini 0 % start value for Gini - 0 1 X length 2 sub { + 0 1 X length 2 sub { /Index ED Y Index get Y Index 1 add get add 2 div % yHeight=(y0+y1)/2 - X Index 1 add get X Index get sub abs % xWidth=x1-x0 + X Index 1 add get X Index get sub abs % xWidth=x1-x0 mul % x*y add } for 2 mul 1 sub neg % triangle area divided by the area under the polygon - \psk@PSfont findfont \psk@fontscale scalefont setfont + \psk@PSfont findfont \psk@fontscale scalefont setfont \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if \psk@valuewidth string cvs %/Output exch def % save output \ifPst@comma dot2comma \fi % do we have to change dot to comma /Output ED - \psk@xShift\space -30 moveto (Gini: ) show - Output show + \psk@xShift\space -30 moveto (Gini: ) show + Output show \fi - 0 1 n { dup X exch get exch Y exch get } for + 0 1 n { dup X exch get exch Y exch get } for \if@star 1 0 0 0 \fi % add values for the closed curve }% filling the area under the curve. \fi %%%%%%%%%%%%%%%%%%%%%%5 \def\Lorenz@code{ [ #1 ] dup length /n ED - bubblesort /Yval ED + bubblesort /Yval ED [ 1 1 n { } for ] /Xval ED - /Xsum n dup 1 add mul 2 div cvi def + /Xsum n dup 1 add mul 2 div cvi def /Ysum 0 def /XYsum 0 def 0 Yval { add } forall /Ysum ED - Xval { n div } forall n array astore /XvalRelMax ED - Xval { Xsum div } forall n array astore /XvalRel ED - Yval { Ysum div } forall n array astore /YvalRel ED - 0 1 n 1 sub { + Xval { n div } forall n array astore /XvalRelMax ED + Xval { Xsum div } forall n array astore /XvalRel ED + Yval { Ysum div } forall n array astore /YvalRel ED + 0 1 n 1 sub { /Index ED - Xval Index get + Xval Index get Yval Index get mul } for n array astore /XmulY ED - XmulY aload length 1 sub { add } repeat + XmulY aload length 1 sub { add } repeat /XmulYsum ED - XmulY { XmulYsum div } forall + XmulY { XmulYsum div } forall n array astore /XmulYdivXmulYsum ED /X [0] def /Y [0] def /Xsum 0 def /Ysum 0 def 0 1 n 1 sub { - /Index ED + /Index ED % XvalRel Index get Xsum add /Xsum ED % X aload length 1 add Xsum exch array astore /X ED X aload length 1 add XvalRelMax Index get exch array astore /X ED %% @@ -945,23 +1199,23 @@ } for \ifPst@Gini 0 % start value for Gini - 0 1 X length 2 sub { + 0 1 X length 2 sub { /Index ED Y Index get Y Index 1 add get add 2 div % yHeight=(y0+y1)/2 - X Index 1 add get X Index get sub abs % xWidth=x1-x0 + X Index 1 add get X Index get sub abs % xWidth=x1-x0 mul % x*y add } for 2 mul 1 sub neg % triangle area divided by the area under the polygon - \psk@PSfont findfont \psk@fontscale scalefont setfont + \psk@PSfont findfont \psk@fontscale scalefont setfont \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if \psk@valuewidth string cvs %/Output exch def % save output \ifPst@comma dot2comma \fi % do we have to change dot to comma /Output ED - \psk@xShift\space -30 moveto (Gini: ) show - Output show + \psk@xShift\space -30 moveto (Gini: ) show + Output show \fi - 0 1 n { dup X exch get exch Y exch get } for + 0 1 n { dup X exch get exch Y exch get } for \if@star 1 0 0 0 \fi % add values for the closed curve }% filling the area under the curve. \if@star\listplot*{\Lorenz@code}\else\listplot{\Lorenz@code}% @@ -982,9 +1236,9 @@ \addbefore@par{plotpoints=200}% \use@par \parametricplot{0}{360}{% - t cos dup mul 1 #1\space div exp \pst@radiusA \pst@number\psxunit div mul + t cos dup mul 1 #1\space div exp \pst@radiusA \pst@number\psxunit div mul t 90 gt { t 270 lt { neg } if } if - t sin dup mul 1 #1\space div exp \pst@radiusB \pst@number\psyunit div mul + t sin dup mul 1 #1\space div exp \pst@radiusB \pst@number\psyunit div mul t 180 gt { neg } if } \endgroup\ignorespaces} % @@ -996,9 +1250,9 @@ \psplot{#1}{#2}[/ps@a #3 def /ps@b #4 def]{ /ps@n 0 def /ps@WS 0 def - { - ps@a ps@n exp ps@b ps@n exp Pi mul x mul RadtoDeg cos mul - dup abs \psk@epsilon gt { ps@WS add /ps@WS ED }{ ps@WS add exit } ifelse + { + ps@a ps@n exp ps@b ps@n exp Pi mul x mul RadtoDeg cos mul + dup abs \psk@epsilon gt { ps@WS add /ps@WS ED }{ ps@WS add exit } ifelse ps@n 1 add /ps@n ED } loop }% @@ -1010,9 +1264,9 @@ \psplot{#1}{#2}[/ps@a #3 def]{ /ps@k 1 def /ps@WS 0 def - { - ps@k ps@a exp Pi mul dup x mul RadtoDeg sin exch div - dup abs \psk@epsilon gt { ps@WS add /ps@WS ED }{ ps@WS add exit } ifelse + { + ps@k ps@a exp Pi mul dup x mul RadtoDeg sin exch div + dup abs \psk@epsilon gt { ps@WS add /ps@WS ED }{ ps@WS add exit } ifelse ps@k 1 add /ps@k ED } loop }% @@ -1044,12 +1298,12 @@ /yMin #2 def /yMax #4 def #5 % additional PS code - \ifPst@polarplot + \ifPst@polarplot /@PolarAlgPlot (#6) tx@addDict begin AlgParser end cvx def /Func { /phi y x atan def - /r x y Pyth def - \ifPst@algebraic @PolarAlgPlot \else #6 \fi } def + /r x y Pyth def + \ifPst@algebraic @PolarAlgPlot \else #6 \fi } def \else /Func \ifPst@algebraic (#6) tx@addDict begin AlgParser end cvx \else { #6 } \fi def \fi @@ -1057,17 +1311,17 @@ /yPixel yMax yMin sub \pst@number\psyunit mul round cvi def /dx xMax xMin sub xPixel div def /dy yMax yMin sub yPixel div def - /setpixel { - dy div exch - dx div exch - \ifPst@saveData + /setpixel { + dy div exch + dx div exch + \ifPst@saveData 2 copy - \pst@number\psyunit div exch \pst@number\psxunit div - 20 string cvs Pst@data exch writestring - Pst@data (\space) writestring - 20 string cvs Pst@data exch writestring + \pst@number\psyunit div exch \pst@number\psxunit div + 20 string cvs Pst@data exch writestring + Pst@data (\space) writestring + 20 string cvs Pst@data exch writestring % Pst@data (\string\]) writestring - Pst@data (\string\n) writestring + Pst@data (\string\n) writestring \fi \pst@number\pslinewidth 2 div 0 360 arc fill } bind def % @@ -1078,7 +1332,7 @@ \ifPst@saveData Pst@data ([\string\n) writestring \fi yMin dy \psk@stepFactor\space mul yMax { /y exch def - Func 0 lt + Func 0 lt { VZ { x y setpixel /VZ false def} if } { VZ {}{ x y setpixel /VZ true def } ifelse } ifelse } for @@ -1092,7 +1346,7 @@ \ifPst@saveData Pst@data ([\string\n) writestring \fi xMin dx \psk@stepFactor\space mul xMax { /x exch def - Func 0 lt + Func 0 lt { VZ { x y setpixel /VZ false def} if } { VZ {}{ x y setpixel /VZ true def } ifelse } ifelse } for @@ -1105,7 +1359,7 @@ /y exch def xMin dx \psk@stepFactor\space mul xMax { /x exch def - Func 0 lt + Func 0 lt { VZ { x y setpixel /VZ false def} if } { VZ {}{ x y setpixel /VZ true def } ifelse } ifelse } for @@ -1125,7 +1379,7 @@ \psplot[fillstyle=none]{#1}{#2}{#4}% original function \ifPst@algebraic \psplot[fillstyle=none]{#1}{#2}{-(#4)} - \else + \else \psplot[fillstyle=none]{#1}{#2}{#4 neg}% mirrored at the x-axis \fi \multido{\iA=1+1}{#3}{% run it #3 times with increment \A @@ -1134,7 +1388,7 @@ /dX #2 #1 sub #3 div def % delta x, the step /Start dX \iA\space 1 sub mul #1 add def % xStart /End Start dX add def % xEnd=xStart+dX - /Height End Start add 2 div /x ED + /Height End Start add 2 div /x ED \ifPst@algebraic (#4) AlgParser cvx exec \else #4 \fi def } % height=f(x) % x is the mean between Start+End \psellipticarc(!Start 0)(! Height 8 div Height){90}{270} @@ -1144,9 +1398,9 @@ % draw the other half of the ellipse \rlineto(!dX neg 0)}}% draw a line in negative x-direction \psset{fillstyle=none} -% \psellipse(#2,0)(!#2 dup #1 sub #3 div 2 div sub /x ED #4 dup +% \psellipse(#2,0)(!#2 dup #1 sub #3 div 2 div sub /x ED #4 dup % 8 div exch)% draw again the ellipse to get the borderline. - \psellipse(#2,0)(!{ #2 dup #1 sub #3 div 2 div sub /x ED + \psellipse(#2,0)(!{ #2 dup #1 sub #3 div 2 div sub /x ED \ifPst@algebraic (#4) AlgParser cvx exec \else #4 \fi dup 8 div exch}) % draw again the ellipse to get the borderline. \psset{plotstyle=line,linestyle=dashed, @@ -1154,7 +1408,7 @@ \psplot[fillstyle=none]{#1}{#2}{#4} \ifPst@algebraic \psplot[fillstyle=none]{#1}{#2}{-(#4)} - \else + \else \psplot[fillstyle=none]{#1}{#2}{#4 neg}% mirrored at the x-axis \fi % draw again the curves to get the borderline @@ -1177,9 +1431,9 @@ \def\psBezier@ii{% \addto@pscode{% \psk@plotpoints % step for Bezier T=0,0+epsilon,0+i*epsilon,...,1 - \pst@BezierType % type of the Bezier curve 2,3,4,... - \txFunc@BezierCurve - \ifshowpoints \txFunc@BezierShowPoints \else pop \fi + \pst@BezierType % type of the Bezier curve 2,3,4,... + \txFunc@BezierCurve + \ifshowpoints \txFunc@BezierShowPoints \else pop \fi }% \end@OpenObj} % @@ -1190,13 +1444,13 @@ \def\psBernstein{\pst@object{psBernstein}}% \psBernstein[options](t1,t2)(i,n) \def\psBernstein@i(#1,#2){% \@ifnextchar({\psBernstein@ii(#1,#2)}{\psBernstein@ii(0,1)(#1,#2)}} -% +% \def\psBernstein@ii(#1,#2)(#3,#4){% (tStart,tEnd)(i,n) \addbefore@par{plotpoints=200}% \begin@OpenObj \addto@pscode{% /ScreenCoor { \tx@ScreenCoor } def - #1\space #2\space + #1\space #2\space 1.0 \psk@plotpoints\space div % step=1/plotpoints #3\space #4\space % on stack we have tStart tEnd epsilon i n @@ -1211,29 +1465,29 @@ \begin@ClosedObj \addto@pscode{ 1 1 #3 { - dup + dup /ipSave ED % save loop value /ip ED % dito 1 1 #3 { dup /iqSave ED % save loop value /iq ED % dito - { + { iq 0 le { exit } if - ip iq mod + ip iq mod /ip iq def - /iq ED + /iq ED } loop - ip 1 eq { + ip 1 eq { /xVal ipSave iqSave div def xVal #1 ge { xVal #2 le { \psk@dotsize \@nameuse{psds@\psk@dotstyle} - \pst@usecolor\pslinecolor xVal 1 iqSave div \tx@ScreenCoor + \pst@usecolor\pslinecolor xVal 1 iqSave div \tx@ScreenCoor 2 copy pop 0 moveto lineto } if } if % 2 copy moveto Dot } if } if } if - } for + } for } for }% \end@ClosedObj% @@ -1252,7 +1506,7 @@ /dx x1 x sub \psk@plotpoints div def #3 /xy { -% x +% x tx@FuncDict begin #4 aload pop \pst@number\psyunit mul exch \pst@number\psxunit mul exch end @@ -1285,7 +1539,7 @@ \def\psZero{\def\pst@par{}\pst@object{psZero}} \def\psZero@i(#1,#2)#3{\@ifnextchar[{\psZero@ii(#1,#2)#3}{\psZero@ii(#1,#2){#3}[0]}} \def\psZero@ii(#1,#2)#3[#4]#5{% -% (#1,#2) Intervall für die Nullstelle, bzw #1 Startwert für Newton, #3 1. Funktion, #4 2. Funktion, #5 Knotenname +% (#1,#2) Intervall f\"{u}r die Nullstelle, bzw #1 Startwert f\"{u}r Newton, #3 1. Funktion, #4 2. Funktion, #5 Knotenname \begingroup \pst@killglue % \addbefore@par{fontscale=40,PSfont=Times-Roman}% @@ -1296,7 +1550,7 @@ /FunctionB \ifPst@algebraic (#4) tx@AlgToPs begin AlgToPs end cvx \else {#4} \fi def \ifPst@Newton % --------------------------- Newton-Verfahren --- TS 05.2014 - /eps 1e-6 def % eps für (f(x+eps)-f(x))/eps + /eps 1e-6 def % eps f\"{u}r (f(x+eps)-f(x))/eps /x0 #1 def % Startwert wird vorgegeben /Xend x0 def { @@ -1330,13 +1584,13 @@ \pnode(! xM yM){#5}% \addto@pscode{ \ifPst@onlyNode \else - /dec \psk@decimals\space def % Anzahl der Dezimahlen für x - /ydec \psk@ydecimals\space def % Anzahl der Dezimalen für y - /symb { /Symbol findfont \psk@fontscale\space scalefont setfont } bind def % Symbolschrift für Klammer und senkrechten Strich - /schrift { \psk@PSfont findfont \psk@fontscale scalefont setfont } bind def % Schrift für die Ergebnisse - /TiefSchrift { /Symbol findfont \psk@fontscale 1.6 div scalefont setfont } bind def % Schrift für tiefergestellte Buchstaben - /spdx \psk@fontscale 4 div def % Abstand, der mit der Schriftgöße skaliert ist - /spdy \psk@fontscale 15 div def % Abstand, der mit der Schriftgöße skaliert ist + /dec \psk@decimals\space def % Anzahl der Dezimahlen f\"{u}r x + /ydec \psk@ydecimals\space def % Anzahl der Dezimalen f\"{u}r y + /symb { /Symbol findfont \psk@fontscale\space scalefont setfont } bind def % Symbolschrift f\"{u}r Klammer und senkrechten Strich + /schrift { \psk@PSfont findfont \psk@fontscale scalefont setfont } bind def % Schrift f\"{u}r die Ergebnisse + /TiefSchrift { /Symbol findfont \psk@fontscale 1.6 div scalefont setfont } bind def % Schrift f\"{u}r tiefergestellte Buchstaben + /spdx \psk@fontscale 4 div def % Abstand, der mit der Schriftg\"{o}{\ss}e skaliert ist + /spdy \psk@fontscale 15 div def % Abstand, der mit der Schriftg\"{o}{\ss}e skaliert ist /Wert { 10 dec exp mul round 10 dec exp div dec 0 eq {cvi 15 string cvs} {15 string cvs } ifelse % x-Wert runden und als string ablegen \ifPst@comma dot2comma \fi show } def % gegebenenfalls Komma statt Punkt und Ergebnis anzeigen /yWert { 10 ydec exp mul round 10 ydec exp div ydec 0 eq {cvi 15 string cvs} {15 string cvs } ifelse % y-Wert runden und als string ablegen @@ -1388,7 +1642,7 @@ \fi\fi}% \ifPst@markZeros \psdot(#5)\fi \endgroup\use@pscode\ignorespaces -}% +}% % \catcode`\@=\PstAtCode\relax % -- cgit v1.2.3