diff options
author | Karl Berry <karl@freefriends.org> | 2006-06-18 23:45:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-06-18 23:45:22 +0000 |
commit | 2ef3bb4ab770c443b91f054a4673d09e037f02e1 (patch) | |
tree | 0f812adb085812f117304b04e8542c5e563317ca /Master/texmf-dist/tex/generic/pstricks-add | |
parent | 3582a525889b15447695e2542f4a5e5b6e7669d9 (diff) |
pstricks-add update, pro0.08 tex2.75
git-svn-id: svn://tug.org/texlive/trunk@1698 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pstricks-add')
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex | 1030 |
1 files changed, 676 insertions, 354 deletions
diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index f4fb97aa343..d698ac218b2 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -5,7 +5,8 @@ %% %% Package `pstricks-add.tex' %% -%% Herbert Voss <voss _at_ pstricks.de> +%% Dominique Rodriguez <Dominique.Rodriguez _at_ waika9.fr> +%% Herbert Voss <Herbert.Voss _at_ pstricks.de> %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -25,9 +26,9 @@ \ifx\MultidoLoaded\endinput\else\input multido \fi \ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi % -\def\fileversion{2.70} -\def\filedate{2005/10/18} -\message{`pstricks-add' v\fileversion, \filedate\space (hv)} +\def\fileversion{2.75} +\def\filedate{2006/06/17} +\message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax \SpecialCoor @@ -37,7 +38,6 @@ \pstheader{pstricks-add.pro}% %\pstheader{shfill_emulate.pro}% % -% %-------------------------------- pstricks ------------------------------------ % %%%%%%% \begin{pspicture} %%%%%%%%%%%%%%%%%%% @@ -53,6 +53,15 @@ %\psset{dy=0}% \newcount\@zero\@zero=0\relax % +\def\PiFour{12.566371} +\def\PiTwo{6.283185} +\def\Pi{3.14159265} +\def\PiH{1.570796327} +\newdimen\RadUnit +\newdimen\RadUnitInv +\RadUnit=1.047198cm % this is pi/3 +\RadUnitInv=0.95493cm % this is 3/pi +% \def\pst@getdimdim#1 #2 #3\@nil{% \def\pst@tempA{#2}% \ifx\pst@tempA\@empty @@ -127,7 +136,7 @@ % %--------------------------------------- small stuff ------------------------------- \def\defineTColor{\@ifnextchar[{\defineTColor@i}{\defineTColor@i[]}} -\def\defineTColor@i[#1]#2#3{% transparency "Colors" +\def\defineTColor@i[#1]#2#3{% transparency "colors" \def\pst@tempA{#1}% \newpsstyle{#2}{% fillstyle=vlines,hatchwidth=0.1\pslinewidth, @@ -155,8 +164,9 @@ %%% par la rotation de centre (x,y) %%% %%% et d'angle a. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\psrotate{\pst@object{psrotate}} % idea from Jean-C�e Charpentier +\def\psrotate{\pst@object{psrotate}} % idea from Jean-Ce Charpentier \def\psrotate@i(#1,#2)#3#4{% + \pst@killglue \begin@SpecialObj% \addto@pscode{% #1 \pst@number\psxunit mul #2 \pst@number\psyunit mul translate @@ -173,7 +183,7 @@ \define@key[psset]{}{dash}{% defined in pstricks.tex \pst@expandafter\psset@@dash{#1}\@nil% Error handling for empty argument. } -\define@key[psset]{}{maxdashes}{\def\psk@maxdashes{#1}} +\define@key[psset]{pstricks-add}{maxdashes}{\def\psk@maxdashes{#1}} %\psset{maxdashes=11} \def\psset@@dash#1\@nil{% \def\psk@dash{}% @@ -193,8 +203,8 @@ \next##2\relax% \fi\fi% \else% 04-08-07 - \@pstrickserr{Number of dashes > \psk@maxdashes. Increasing -`maxdashes' might work.}\@ehpa% 04-08-07 + \@pstrickserr{Number of dashes > \psk@maxdashes. Increasing + 'maxdashes' might work.}\@ehpa% 04-08-07 \fi% 04-08-07 }% \expandafter\next#1 \relax} @@ -238,7 +248,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % -\define@key[psset]{}{intSeparator}{\def\psk@intSeparator{#1}} +\define@key[psset]{pstricks-add}{intSeparator}{\def\psk@intSeparator{#1}} %\psset{intSeparator={,}} % \def\psFormatInt{\def\pst@par{}\pst@object{psFormatInt}} @@ -274,8 +284,8 @@ }\ignorespaces} % \newdimen\pst@braceWidth -\define@key[psset]{}{braceWidth}{\pssetlength\pst@braceWidth{#1}} -\define@key[psset]{}{bracePos}{\def\psk@bracePos{#1}} +\define@key[psset]{pstricks-add}{braceWidth}{\pssetlength\pst@braceWidth{#1}} +\define@key[psset]{pstricks-add}{bracePos}{\def\psk@bracePos{#1}} %\psset{braceWidth=10pt,bracePos=0.5} % \def\@@rput@iv(#1){\pst@killglue\pst@makebox{\@@rput@v{#1}}} @@ -297,7 +307,7 @@ \ignorespaces% } % -\def\psbrace{\def\pst@par{}\pst@object{psbrace}} +\def\psbrace{\pst@object{psbrace}} \def\psbrace@i(#1)(#2)#3{% \addbefore@par{ArrowInside=-,linearc=2mm,linewidth=1pt,% nodesepA=0pt,nodesepB=0pt,bracePos=0.5}% the default @@ -337,13 +347,12 @@ % -------------- the arrow part ------------- % the original table % \def\pst@arrowtable{,<->,<<->>,>-<,>>-<<,(-),[-],)-(,]-[,|>-<|} -\edef\pst@arrowtable{\pst@arrowtable,H-H,h-h} % % HookLeft/RightArrow \newdimen\pshooklength \newdimen\pshookwidth -\define@key[psset]{}{hooklength}{\pssetlength\pshooklength{#1}} -\define@key[psset]{}{hookwidth}{\pssetlength\pshookwidth{#1}} +\define@key[psset]{pstricks-add}{hooklength}{\pssetlength\pshooklength{#1}} +\define@key[psset]{pstricks-add}{hookwidth}{\pssetlength\pshookwidth{#1}} %\psset{hooklength=3mm,hookwidth=1mm} % \edef\pst@arrowtable{\pst@arrowtable,H-H,h-h} % add new arrow @@ -378,10 +387,8 @@ 0 \psk@arrowlength \psk@arrowsize \tx@Rhook } % New parameter "arrowfill", with default as "true" -\newif\ifpsArrowFill -\define@key[psset]{}{ArrowFill}{\@nameuse{psArrowFill#1}} -%\psset{ArrowFill=true} - +\define@boolkey[psset]{pstricks-add}[ps]{ArrowFill}[true]{} +% % Modification of the PostScript macro Arrow to choose to fill or not the arrow % (it require to restore the current linewidth, despite of the scaling) \pst@def{Arrow}<{% @@ -398,9 +405,9 @@ 0 h a sub moveto }> % -\define@key[psset]{}{nArrowsA}{\def\psk@nArrowsA{#1}} -\define@key[psset]{}{nArrowsB}{\def\psk@nArrowsB{#1}} -\define@key[psset]{}{nArrows}{\def\psk@nArrowsA{#1}\def\psk@nArrowsB{#1}} +\define@key[psset]{pstricks-add}{nArrowsA}{\def\psk@nArrowsA{#1}} +\define@key[psset]{pstricks-add}{nArrowsB}{\def\psk@nArrowsB{#1}} +\define@key[psset]{pstricks-add}{nArrows}{\def\psk@nArrowsA{#1}\def\psk@nArrowsB{#1}} %\psset{nArrows=2} % \@namedef{psas@>>}{% @@ -429,9 +436,10 @@ % % DG addition begin - Dec. 18/19, 1997 and Oct. 11, 2002 % Adapted from \psset@arrows -\define@key[psset]{}{ArrowInside}{% + \def\psk@ArrowInside{} + \define@key[psset]{pstricks-add}{ArrowInside}{% \def\pst@tempA{#1}% - \ifx\pst@tempA\@empty\def\psk@ArrowInside{}% + \ifx\pst@tempA\@empty \def\psk@ArrowInside{} % \else% \begingroup% \pst@activearrows% @@ -454,36 +462,36 @@ %\psset{ArrowInside={}} % Modified version of \pst@addarrowdef \def\pst@addarrowdef{% - \addto@pscode{% - /ArrowA { - \ifx\psk@arrowA\@empty - \pst@oplineto - \else - \pst@arrowdef{A} - moveto - \fi - } def - /ArrowB { - \ifx\psk@arrowB\@empty \else \pst@arrowdef{B} \fi - } def + \addto@pscode{% + /ArrowA { + \ifx\psk@arrowA\@empty + \pst@oplineto + \else + \pst@arrowdef{A} + moveto + \fi + } def + /ArrowB { + \ifx\psk@arrowB\@empty \else \pst@arrowdef{B} \fi + } def % DG addition - /ArrowInside { - \ifx\psk@ArrowInside\@empty \else \pst@arrowdefA{Inside} \fi - } def - }% + /ArrowInside { + \ifx\psk@ArrowInside\@empty \else \pst@arrowdefA{Inside} \fi + } def + }% } % Adapted from \pst@arrowdef \def\pst@arrowdefA#1{% - \ifnum\pst@repeatarrowsflag>\z@ - /Arrow#1c [ 6 2 roll ] cvx def Arrow#1c - \fi + \ifnum\pst@repeatarrowsflag>\z@ + /Arrow#1c [ 6 2 roll ] cvx def Arrow#1c + \fi \tx@BeginArrow \psk@arrowscale \@nameuse{psas@\@nameuse{psk@Arrow#1}} \tx@EndArrow% } % ArrowInsidePos parameter (default value 0.5) -\define@key[psset]{}{ArrowInsidePos}{\pst@checknum{#1}\psk@ArrowInsidePos}% +\define@key[psset]{pstricks-add}{ArrowInsidePos}{\pst@checknum{#1}\psk@ArrowInsidePos}% %\psset{ArrowInsidePos=0.5} % % Modified version of \begin@ClosedObj @@ -495,20 +503,33 @@ \solid@star \ifpsdoubleline \pst@setdoublesep \fi \pst@addarrowdef% DG addition - \init@pscode + \init@pscode% } % % Redefinition of the PostScript /Line macro to print the intermediate % arrow on each segment of the line % -\define@key[psset]{}{ArrowInsideNo}{\pst@checknum{#1}\psk@ArrowInsideNo}% hv 20031001 -\define@key[psset]{}{ArrowInsideOffset}{\pst@checknum{#1}\psk@ArrowInsideOffset}% hv 20031001 +\define@key[psset]{pstricks-add}{ArrowInsideNo}{\pst@checknum{#1}\psk@ArrowInsideNo}% hv 20031001 +\define@key[psset]{pstricks-add}{ArrowInsideOffset}{\pst@checknum{#1}\psk@ArrowInsideOffset}% hv 20031001 %\psset{ArrowInsideNo=1,ArrowInsideOffset=0} % +\def\arrowType@H{H} \pst@def{Line}<{% NArray n 0 eq not { n 1 eq { 0 0 /n 2 def } if (\psk@ArrowInside) length 0 gt { - 2 copy /y1 ED /x1 ED ArrowA x1 y1 + \ifx\psk@arrowA\arrowType@H % do we have a Hook arrow at the beginning? + \pst@number\pshooklength % yes + \else + \psk@arrowsize\space CLW mul add dup \psk@arrowlength\space mul exch \psk@arrowinset mul neg add + \fi + /arrowlength exch def + 4 copy % copy all four values for the arrow line + /y1 ED /x1 ED /y2 ED /x2 ED % save them + /Alpha y2 y1 sub x2 x1 sub atan def % the gradient of the line +% 2 copy /y1 ED /x1 ED ArrowA x1 y1 + ArrowA % draw arrowA + x1 Alpha cos arrowlength mul add % dx add + y1 Alpha sin arrowlength mul add % dy add, to get the current point at the end of the arrow tip /n n 1 sub def n { 4 copy @@ -805,11 +826,11 @@ % %\def\psDashColorI{black} %\def\psDashColorII{red} -\define@key[psset]{}{dashColorI}{\pst@getcolor{#1}\psDashColorI} -\define@key[psset]{}{dashColorII}{\pst@getcolor{#1}\psDashColorII} -\define@key[psset]{}{dashNo}{\def\psk@dashNo{#1}} +\define@key[psset]{pstricks-add}{dashColorI}{\pst@getcolor{#1}\psDashColorI} +\define@key[psset]{pstricks-add}{dashColorII}{\pst@getcolor{#1}\psDashColorII} +\define@key[psset]{pstricks-add}{dashNo}{\def\psk@dashNo{#1}} % -\define@key[psset]{}{linecap}{\def\psk@linecap{#1}} +\define@key[psset]{pstricks-add}{linecap}{\def\psk@linecap{#1}} %\psset{dashColorI=black,dashColorII=red,dashNo=0.2,linecap=0} % \pst@def{LineII}<{% @@ -863,61 +884,8 @@ \end@OpenObj% } % -\newdimen\pswBegin\newdimen\pswEnd -\define@key[psset]{}{wBegin}{\pssetlength\pswBegin{#1}} -\define@key[psset]{}{wEnd}{\pssetlength\pswEnd{#1}} -%\psset{wBegin=\pslinewidth, wEnd=\pslinewidth} -% -\pst@def{LineIII}<{% - NArray - /n n 1 sub def - /YA ED /XA ED - /bA2 \pst@number\pswBegin\space 2.0 div def - /bB2 \pst@number\pswEnd\space 2.0 div def - /xStep bB2 bA2 sub n div def - 0 setlinecap - n { - XA YA moveto - /YB ED /XB ED - /Alpha YB YA sub XB XA sub atan def - /Alphasin Alpha sin def - /Alphacos Alpha cos def - \pst@usecolor\pslinecolor - 0.01 SLW - /bB2 bA2 xStep add def - XA Alphasin bA2 mul sub - YA Alphacos bA2 mul add lineto - XB Alphasin bB2 mul sub - YB Alphacos bB2 mul add lineto - XB Alphasin bB2 mul add - YB Alphacos bB2 mul sub lineto - XA Alphasin bA2 mul add - YA Alphacos bA2 mul sub lineto - XA YA lineto fill - /XA XB def /YA YB def - /bA2 bB2 def - } repeat -}> -% -\def\pslineIII{\pst@object{pslineIII}} -\def\pslineIII@i{% - \pst@getarrows{% - \begin@OpenObj - \pst@getcoors[\pslineIII@ii% - }% -} -\def\pslineIII@ii{% - \addto@pscode{% - \pst@cp - \ifshowpoints true \else false \fi - \tx@LineIII - }% - \end@OpenObj% -} -% -\define@key[psset]{}{randomPoints}{\def\psk@randomPoints{#1}} -\newif\ifPst@randomColor -\define@key[psset]{}{color}[true]{\@nameuse{Pst@randomColor#1}} +\define@key[psset]{pstricks-add}{randomPoints}{\def\psk@randomPoints{#1}} +\define@boolkey[psset]{pstricks-add}[Pst@]{color}[true]{} %\psset{randomPoints=1000,color=false} % \def\psRandom{\pst@object{psRandom}}% hv 2004-11-12 @@ -941,7 +909,7 @@ \psk@dotsize % defines /DS ... def \@nameuse{psds@\psk@dotstyle} \psk@randomPoints { - \ifPst@randomColor getRandReal getRandReal getRandReal setrgbcolor \fi + \ifPst@color getRandReal getRandReal getRandReal setrgbcolor \fi getRandReal dx mul xMin add getRandReal dy mul yMin add Dot @@ -953,6 +921,7 @@ \ignorespaces } % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% %%%%%%%%%% %%%%%%%%%%% pst-node %%%%%%%%%% @@ -1027,7 +996,7 @@ \def\pclineII{\pst@object{pclineII}}% \def\pclineII@i{\pc@object\nclineII@ii}% % -\define@key[psset]{}{lineAngle}{\psset{armB=0.5}\def\psk@lineAngle{#1}}% +\define@key[psset]{pstricks-add}{lineAngle}{\psset{armB=0.5}\def\psk@lineAngle{#1}}% %\psset{lineAngle=0}% % \pst@def{NCDiag}<{ @@ -1103,7 +1072,7 @@ \def\ncbarr@i#1#2{ \begingroup \use@par% - \setLNode(#1)(#2){0.5}{barr@tempNode}% + \psLNode(#1)(#2){0.5}{barr@tempNode}% \pst@dimm=\psk@angleA pt \pst@dimn=180pt % be sure, that angleA is 0 or 180. if not, we set it to 0 @@ -1117,7 +1086,7 @@ % #1-------#4----------------#2 % where #1#4= #3 * #1#2 % -\def\setLNode(#1)(#2)#3#4{% +\def\psLNode(#1)(#2)#3#4{% \pst@getcoor{#1}\pst@tempA% \pst@getcoor{#2}\pst@tempB% \pnode(!% @@ -1131,7 +1100,7 @@ } % % build the linear combination #2*#1+#4*#3=#5 -\def\setLCNode(#1)#2(#3)#4#5{% +\def\psLCNode(#1)#2(#3)#4#5{% \pst@getcoor{#1}\pst@tempA% \pst@getcoor{#3}\pst@tempB% \pnode(!% @@ -1143,8 +1112,8 @@ YA #2\space mul YB #4\space mul add){#5}% } % -\newif\ifPst@trueAngle -\define@key[psset]{}{trueAngle}[true]{\@nameuse{Pst@trueAngle#1}} +% +\define@boolkey[psset]{pstricks-add}[Pst@]{trueAngle}[true]{} %\psset{trueAngle=false} % \def\psRelNode{\pst@object{psRelNode}} @@ -1252,7 +1221,7 @@ } ifelse ){#5}% } % -\def\psLNode(#1)(#2)#3#4{% +\def\psLDNode(#1)(#2)#3#4{% % #1: node A #2: node B #3: dimen measured from A #4: node name \pst@getcoor{#1}\pst@tempA% \pst@getcoor{#2}\pst@tempB% @@ -1271,7 +1240,7 @@ \def\nlput{\pst@object{nlput}} \def\nlput@i(#1)(#2)#3#4{% \begin@SpecialObj - \psLNode(A)(B){#3}{@temp@lnput} + \psLDNode(A)(B){#3}{@temp@lnput} \pcline[linestyle=none](#1)(@temp@lnput)% \ncput[npos=1]{#4}% \end@SpecialObj @@ -1282,60 +1251,67 @@ %%%%%%%%%%% %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -\newif\ifPst@plot@comma -\define@key[psset]{}{comma}[true]{\@nameuse{Pst@plot@comma#1}} +\define@key[psset]{pstricks-add}{labelFontSize}{\def\psk@labelFontSize{#1}}% +\psset{labelFontSize={}} +\def\pshlabel#1{\psk@labelFontSize$#1$}% +\def\psvlabel#1{\psk@labelFontSize$#1$} +% +\define@boolkey[psset]{pstricks-add}[Pst@]{comma}[true]{} % -\newif\ifPst@plot@xAxis -\newif\ifPst@plot@yAxis -\newif\ifPst@plot@xyAxes -\define@key[psset]{}{xAxis}[true]{\@nameuse{Pst@plot@xAxis#1}} -\define@key[psset]{}{yAxis}[true]{\@nameuse{Pst@plot@yAxis#1}} -\define@key[psset]{}{xyAxes}[true]{\@nameuse{Pst@plot@xAxis#1}\@nameuse{Pst@plot@yAxis#1}}% +\define@boolkey[psset]{pstricks-add}[Pst@]{xAxis}[true]{} +\define@boolkey[psset]{pstricks-add}[Pst@]{yAxis}[true]{} +%\define@boolkey[psset]{pstricks-add}[Pst@]{xAxis}[true]{\@nameuse{Pst@xAxis#1}} +%\define@boolkey[psset]{pstricks-add}[Pst@]{yAxis}[true]{\@nameuse{Pst@yAxis#1}} +\define@boolkey[psset]{pstricks-add}[Pst@]{xyAxes}[true]{% + \@nameuse{Pst@xAxis#1}\@nameuse{Pst@yAxis#1}}% %\psset{xyAxes=true}% % -\define@key[psset]{}{xyDecimals}{\def\psk@xDecimals{#1}\def\psk@yDecimals{#1}} -\define@key[psset]{}{xDecimals}{\def\psk@xDecimals{#1}} -\define@key[psset]{}{yDecimals}{\def\psk@yDecimals{#1}} +\define@key[psset]{pstricks-add}{xyDecimals}{\def\psk@xDecimals{#1}\def\psk@yDecimals{#1}} +\define@key[psset]{pstricks-add}{xDecimals}{\def\psk@xDecimals{#1}} +\define@key[psset]{pstricks-add}{yDecimals}{\def\psk@yDecimals{#1}} %\psset{xyDecimals={}}% % -\define@key[psset]{}{xlogBase}{\def\psk@xlogBase{#1}} -\define@key[psset]{}{ylogBase}{\def\psk@ylogBase{#1}} -\define@key[psset]{}{xylogBase}{\def\psk@xlogBase{#1}\def\psk@ylogBase{#1}}% +\define@key[psset]{pstricks-add}{xlogBase}{\def\psk@xlogBase{#1}} +\define@key[psset]{pstricks-add}{ylogBase}{\def\psk@ylogBase{#1}} +\define@key[psset]{pstricks-add}{xylogBase}{\def\psk@xlogBase{#1}\def\psk@ylogBase{#1}}% %\psset{xylogBase={}}% % -\newif\ifPst@trigLabels -\define@key[psset]{pstricks-add}{trigLabels}[true]{% - \@nameuse{Pst@trigLabels#1}% +\define@key[psset]{pstricks-add}{trigLabelBase}{\pst@getint{#1}{\psk@trigLabelBase}} +\psset{trigLabelBase=0} + +\define@boolkey[psset]{pstricks-add}[Pst@]{trigLabels}[true]{% \ifPst@trigLabels \def\pst@@@hlabel##1{\pshlabel{##1}} - \def\pshlabel##1{$% - \ifnum##1=0 0\else% % ##1=0, print 0 and return - \def\pst@sign{\ifnum##1<0 -\fi} - \pst@abs{##1}\pst@cnta - \pst@mod{\pst@cnta}{2}\pst@cntc % pst@cntc-> 0 or 1 (fraction or not) - \ifnum1>\pst@cntc % 0: ##1\pi 1: ##1/2 \pi - \pst@cntb=\pst@cnta \divide\pst@cntb by 2 % ##1/2 - \pst@sign\ifnum\pst@cntb>1 \the\pst@cntb\fi\pi % n*pi - \else\pst@sign\frac{\ifnum\pst@cnta>1 \the\pst@cnta \fi\pi}{2}\fi - \fi$}% n/2*pi + \def\pshlabel##1{% + \ifnum\psk@trigLabelBase<2 + \def\de@nominator{\@ne}\else\def\de@nominator{\psk@trigLabelBase}\fi + \pst@mod{##1}{\de@nominator}\@tempa + \ifnum\@ne>\@tempa + \count1=##1 \divide\count1 by \de@nominator + \psk@labelFontSize + \ifnum\count1=\@ne + $\pi$\else$\the\count1\pi$\fi + \else\ifnum\@tempa=\@ne + $\frac{\pi}{\de@nominator}$\else$\frac{##1}{\de@nominator}\pi$\fi\fi% + } \else \def\pst@@@hlabel##1{% \edef\@xyDecimals{\psk@xDecimals}% \ifnum\psk@ticks<\tw@ % ticks=all|x \ifx\psk@xlogBase\@empty - \pshlabel{\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}% + \pshlabel{\psk@labelFontSize\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}% \else% - \pshlabel{\psk@xlogBase\textsuperscript{\expandafter\@stripDecimals##1..\@nil }} + \pshlabel{\psk@labelFontSize\psk@xlogBase\textsuperscript{\expandafter\@stripDecimals##1..\@nil }} \fi% \fi% } - \def\pshlabel##1{$##1$}% + \def\pshlabel##1{\psk@labelFontSize$##1$}% \fi } -%\psset[pstricks-add]{trigLabels=false} +\psset{trigLabels=false} % %logLines=all|x|y|none (0,1,2,3) -\define@key[psset]{}{logLines}{\pst@expandafter\psset@@logLines{#1}\@nil\psk@logLines} +\define@key[psset]{pstricks-add}{logLines}{\pst@expandafter\psset@@logLines{#1}\@nil\psk@logLines} \def\psset@@logLines#1#2\@nil#3{% \ifx#1a\let#3\z@\else \ifx#1x\let#3\@ne\else @@ -1348,8 +1324,8 @@ % Define "ticklines" parameter (ticklines=all|x|y|none with default=none) %\def\psset@ticklines#1{\pst@expandafter\psset@@ticklines{#1}\@nil\psk@ticklines} %\psset@ticklines{none} -\define@key[psset]{}{ylabelFactor}{\def\psk@ylabelFactor{#1}} -\define@key[psset]{}{xlabelFactor}{\def\psk@xlabelFactor{#1}} +\define@key[psset]{pstricks-add}{ylabelFactor}{\def\psk@ylabelFactor{#1}} +\define@key[psset]{pstricks-add}{xlabelFactor}{\def\psk@xlabelFactor{#1}} %\psset{xlabelFactor=\relax,ylabelFactor=\relax}% % The parameter styles for the tick lines % (default=arrows=-,linestyle=dotted,dotsep=5pt) @@ -1371,7 +1347,7 @@ \ifodd\psk@ticks % ticks=all||y (0,2) \else \ifx\psk@ylogBase\@empty -% \ifPst@plot@comma +% \ifPst@comma \psvlabel{\expandafter\@LabelComma#1..\@nil\psk@ylabelFactor}% % \else\psvlabel{#1\psk@ylabelFactor}\fi% \else% @@ -1400,12 +1376,12 @@ \def\@tempa{#1}% write only if not empty \ifx\@tempa\@empty% write nothing \else - \ifPst@plot@comma{,}\else.\fi% + \ifPst@comma{,}\else.\fi% #1% \fi% \else% write only \xy@decimals \ifnum\@xyDecimals>\@zero - \ifPst@plot@comma{,}\else.\fi + \ifPst@comma{,}\else.\fi \@Reset@digitcounter \@process@digits#1*; \fi% @@ -1433,8 +1409,8 @@ % \def\psxs@axes{{% - \ifPst@plot@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}\fi% - \ifPst@plot@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}\fi% + \ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}\fi% + \ifPst@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}\fi% }} \def\psaxes{\pst@object{psaxes}} \def\psaxes@i{\pst@getarrows\psaxes@ii} @@ -1455,27 +1431,7 @@ % If minimum values are negative in log mode, we modify Ox % (respectively Oy) if this was not done by the user % X axis labels (\psk@log = 0 or 1) - \ifx\psk@xlogBase\@empty\else% - \ifx\psk@Ox\@empty\else% we do nothing ... hv - \ifdim\psk@Ox pt=\z@ - \ifdim#3pt<\z@ - \pssetxlength\pst@dimg{#1}% o-x - \psset{Ox=#1}% - \fi - \fi% - \fi% - \fi% -% Y axis labels (\psk@log = 0 or 2) - \ifx\psk@ylogBase\@empty\else% - \ifx\psk@Ox\@empty\else - \ifdim#4pt<\z@ - \ifdim\psk@Oy pt=\z@ - \pssetylength\pst@dimh{#2}% o-y - \psset{Oy=#2}% - \fi - \fi - \fi - \fi +% % Whole thing will be translated to origin: \advance\pst@dima-\pst@dimg% Dist. from bl-x to o-x \advance\pst@dimb-\pst@dimh% Dist. from bl-y to o-y @@ -1483,29 +1439,29 @@ \advance\pst@dimd-\pst@dimh% Dist. from ur-y to o-y % Make lines/arrows or frame: \@nameuse{psxs@\psk@axesstyle}% \psxs@axes or \psxs@frame - \ifPst@plot@yAxis% + \ifPst@yAxis% \begingroup% \ifdim\pst@dima=\z@\else\showoriginfalse\fi% \ifnum\psk@dy=\z@% \pst@dimg=\psk@Dy\psyunit% \edef\psk@dy{\number\pst@dimg}% \fi% - \ifPst@plot@xAxis\else\showorigintrue\fi% + \ifPst@xAxis\else\showorigintrue\fi% \pst@vlabels{\pst@dimd}{\psk@arrowB}{#3}{#5}% - \ifPst@plot@xAxis\showoriginfalse\fi% + \ifPst@xAxis\showoriginfalse\fi% \pst@vlabels{\pst@dimb}{\psk@arrowA}{#3}{#5}% \endgroup% \fi% - \ifPst@plot@xAxis% + \ifPst@xAxis% \begingroup% \ifdim\pst@dimb=\z@\else\showoriginfalse\fi% \ifnum\psk@dx=\z@% \pst@dimg=\psk@Dx\psxunit% \edef\psk@dx{\number\pst@dimg}% \fi% - \ifPst@plot@yAxis\else\showorigintrue\fi% + \ifPst@yAxis\else\showorigintrue\fi% \pst@hlabels{\pst@dimc}{\psk@arrowB}{#4}{#6}% - \ifPst@plot@yAxis\showoriginfalse\fi% + \ifPst@yAxis\showoriginfalse\fi% \pst@hlabels{\pst@dima}{\psk@arrowA}{#4}{#6}% \endgroup% \fi% @@ -1555,8 +1511,8 @@ \fi% } \define@key[psset]{}{ticksize}{\set@xticksize{#1}\set@yticksize{#1}} -\define@key[psset]{}{xticksize}{\set@xticksize{#1}} -\define@key[psset]{}{yticksize}{\set@yticksize{#1}}% overwrites the definition in pstricks +\define@key[psset]{pstricks-add}{xticksize}{\set@xticksize{#1}} +\define@key[psset]{pstricks-add}{yticksize}{\set@yticksize{#1}}% overwrites the definition in pstricks %\psset{ticksize=-4pt 4pt} % % full= 0, top=1, bottom=-1 @@ -1576,59 +1532,61 @@ %\psset{tickstyle=full}% % % -\define@key[psset]{}{subticks}{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}} -\define@key[psset]{}{xsubticks}{\def\psk@xsubticks{#1}} -\define@key[psset]{}{ysubticks}{\def\psk@ysubticks{#1}} +\define@key[psset]{pstricks-add}{subticks}{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}} +\define@key[psset]{pstricks-add}{xsubticks}{\def\psk@xsubticks{#1}} +\define@key[psset]{pstricks-add}{ysubticks}{\def\psk@ysubticks{#1}} % -\define@key[psset]{}{subticksize}{\def\psk@xsubticksize{#1}\def\psk@ysubticksize{#1}} -\define@key[psset]{}{xsubticksize}{\def\psk@xsubticksize{#1}} -\define@key[psset]{}{ysubticksize}{\def\psk@ysubticksize{#1}} +\define@key[psset]{pstricks-add}{subticksize}{\def\psk@xsubticksize{#1}\def\psk@ysubticksize{#1}} +\define@key[psset]{pstricks-add}{xsubticksize}{\def\psk@xsubticksize{#1}} +\define@key[psset]{pstricks-add}{ysubticksize}{\def\psk@ysubticksize{#1}} % -\define@key[psset]{}{tickwidth}{% +\define@key[psset]{pstricks-add}{tickwidth}{% \pst@getlength{#1}\psk@xtickwidth% \pst@getlength{#1}\psk@ytickwidth} -\define@key[psset]{}{xtickwidth}{\pst@getlength{#1}\psk@xtickwidth} -\define@key[psset]{}{ytickwidth}{\pst@getlength{#1}\psk@ytickwidth} -\define@key[psset]{}{subtickwidth}{% +\define@key[psset]{pstricks-add}{xtickwidth}{\pst@getlength{#1}\psk@xtickwidth} +\define@key[psset]{pstricks-add}{ytickwidth}{\pst@getlength{#1}\psk@ytickwidth} +\define@key[psset]{pstricks-add}{subtickwidth}{% \pst@getlength{#1}\psk@xsubtickwidth% \pst@getlength{#1}\psk@ysubtickwidth} -\define@key[psset]{}{xsubtickwidth}{\pst@getlength{#1}\psk@xsubtickwidth} -\define@key[psset]{}{ysubtickwidth}{\pst@getlength{#1}\psk@ysubtickwidth} -% -\define@key[psset]{}{tickcolor}{\def\psk@xtickcolor{#1}\def\psk@ytickcolor{#1}} -\define@key[psset]{}{xtickcolor}{\def\psk@xtickcolor{#1}} -\define@key[psset]{}{ytickcolor}{\def\psk@ytickcolor{#1}} -\define@key[psset]{}{subtickcolor}{\def\psk@xsubtickcolor{#1}\edef\psk@ysubtickcolor{#1}} -\define@key[psset]{}{xsubtickcolor}{\def\psk@xsubtickcolor{#1}} -\define@key[psset]{}{ysubtickcolor}{\def\psk@ysubtickcolor{#1}} -% -\define@key[psset]{}{xticklinestyle}{% +\define@key[psset]{pstricks-add}{xsubtickwidth}{\pst@getlength{#1}\psk@xsubtickwidth} +\define@key[psset]{pstricks-add}{ysubtickwidth}{\pst@getlength{#1}\psk@ysubtickwidth} +% +\define@key[psset]{pstricks-add}{tickcolor}{\def\psk@xtickcolor{#1}\def\psk@ytickcolor{#1}} +\define@key[psset]{pstricks-add}{xtickcolor}{\def\psk@xtickcolor{#1}} +\define@key[psset]{pstricks-add}{ytickcolor}{\def\psk@ytickcolor{#1}} +\define@key[psset]{pstricks-add}{subtickcolor}{% + \pst@getcolor{#1}\psk@xsubtickcolor% + \pst@getcolor{#1}\psk@ysubtickcolor} +\define@key[psset]{pstricks-add}{xsubtickcolor}{\pst@getcolor{#1}\psk@xsubtickcolor} +\define@key[psset]{pstricks-add}{ysubtickcolor}{\pst@getcolor{#1}\psk@ysubtickcolor} +% +\define@key[psset]{pstricks-add}{xticklinestyle}{% \@ifundefined{psls@#1}% {\@pstrickserr{Line style `#1' not defined}\@eha}% {\def\psxticklinestyle{#1}}} -\define@key[psset]{}{xsubticklinestyle}{% +\define@key[psset]{pstricks-add}{xsubticklinestyle}{% \@ifundefined{psls@#1}% {\@pstrickserr{Line style `#1' not defined}\@eha}% {\def\psxsubticklinestyle{#1}}} -\define@key[psset]{}{yticklinestyle}{% +\define@key[psset]{pstricks-add}{yticklinestyle}{% \@ifundefined{psls@#1}% {\@pstrickserr{Line style `#1' not defined}\@eha}% {\def\psyticklinestyle{#1}}} -\define@key[psset]{}{ysubticklinestyle}{% +\define@key[psset]{pstricks-add}{ysubticklinestyle}{% \@ifundefined{psls@#1}% {\@pstrickserr{Line style `#1' not defined}\@eha}% {\def\psysubticklinestyle{#1}}} -\define@key[psset]{}{ticklinestyle}{% +\define@key[psset]{pstricks-add}{ticklinestyle}{% \@ifundefined{psls@#1}% {\@pstrickserr{Line style `#1' not defined}\@eha}% {\def\psxticklinestyle{#1}\def\psyticklinestyle{#1}}} -\define@key[psset]{}{subticklinestyle}{% +\define@key[psset]{pstricks-add}{subticklinestyle}{% \@ifundefined{psls@#1}% {\@pstrickserr{Line style `#1' not defined}\@eha}% {\def\psxsubticklinestyle{#1}\def\psysubticklinestyle{#1}}} % -\define@key[psset]{}{ticklinestyle}{\psset{xticklinestyle=#1,yticklinestyle=#1}} -\define@key[psset]{}{subticklinestyle}{\psset{xsubticklinestyle=#1,ysubticklinestyle=#1}} +\define@key[psset]{pstricks-add}{ticklinestyle}{\psset{xticklinestyle=#1,yticklinestyle=#1}} +\define@key[psset]{pstricks-add}{subticklinestyle}{\psset{xsubticklinestyle=#1,ysubticklinestyle=#1}} %\psset{subticksize=0.75,subticks=1,tickcolor=black,ticklinestyle=solid,% % subticklinestyle=solid,% % subtickcolor=gray,% @@ -1848,8 +1806,8 @@ \divide\pst@cnta\psk@dx\relax% % Number of ticks/labels \ifnum\pst@cnta=\z@\else% \pst@dimb=\psk@dx sp% % Space between ticks. -% \ifPst@plot@yAxis\else\showorigintrue\fi% - \ifnum\psk@labels<\tw@ \ifPst@plot@xAxis\pst@@hlabels\fi\fi% +% \ifPst@yAxis\else\showorigintrue\fi% + \ifnum\psk@labels<\tw@ \ifPst@xAxis\pst@@hlabels\fi\fi% \showoriginfalse% \fi% \fi% @@ -1878,8 +1836,8 @@ \divide\pst@cnta\psk@dy\relax % % Number of ticks/labels \ifnum\pst@cnta=\z@\else% \pst@dima=\psk@dy sp% % Space between ticks. -% \ifPst@plot@xAxis\else\showorigintrue\fi% - \ifodd\number\psk@labels\else\ifPst@plot@yAxis\pst@@vlabels\fi\fi% +% \ifPst@xAxis\else\showorigintrue\fi% + \ifodd\number\psk@labels\else\ifPst@yAxis\pst@@vlabels\fi\fi% \showoriginfalse% \fi% \fi% @@ -1913,19 +1871,19 @@ \vss% }} % -\define@key[psset]{}{nStep}{\def\psk@nStep{#1}} -\define@key[psset]{}{nStart}{\def\psk@nStart{#1}} -\define@key[psset]{}{nEnd}{\def\psk@nEnd{#1}} -\define@key[psset]{}{xStep}{\def\psk@xStep{#1}} -\define@key[psset]{}{yStep}{\def\psk@yStep{#1}} +\define@key[psset]{pstricks-add}{nStep}{\def\psk@nStep{#1}} +\define@key[psset]{pstricks-add}{nStart}{\def\psk@nStart{#1}} +\define@key[psset]{pstricks-add}{nEnd}{\def\psk@nEnd{#1}} +\define@key[psset]{pstricks-add}{xStep}{\def\psk@xStep{#1}} +\define@key[psset]{pstricks-add}{yStep}{\def\psk@yStep{#1}} % -\define@key[psset]{}{xStart}{\def\psk@xStart{#1}} -\define@key[psset]{}{xEnd}{\def\psk@xEnd{#1}} -\define@key[psset]{}{yStart}{\def\psk@yStart{#1}} -\define@key[psset]{}{yEnd}{\def\psk@yEnd{#1}} +\define@key[psset]{pstricks-add}{xStart}{\def\psk@xStart{#1}} +\define@key[psset]{pstricks-add}{xEnd}{\def\psk@xEnd{#1}} +\define@key[psset]{pstricks-add}{yStart}{\def\psk@yStart{#1}} +\define@key[psset]{pstricks-add}{yEnd}{\def\psk@yEnd{#1}} % -\define@key[psset]{}{plotNo}{\def\psk@plotNo{#1}} -\define@key[psset]{}{plotNoMax}{\def\psk@plotNoMax{#1}} +\define@key[psset]{pstricks-add}{plotNo}{\def\psk@plotNo{#1}} +\define@key[psset]{pstricks-add}{plotNoMax}{\def\psk@plotNoMax{#1}} % %\psset{nStep=1, nStart=0, nEnd={},% % xStep=0, yStep=0, xStart={}, xEnd={}, yStart={}, yEnd={}, comma=false,% @@ -1959,8 +1917,7 @@ \@nameuse{endplot@\psplotstyle}% } % -\newif\ifPst@ChangeOrder -\define@key[psset]{}{ChangeOrder}[true]{\@nameuse{Pst@ChangeOrder#1}} +\define@boolkey[psset]{pstricks-add}[Pst@]{ChangeOrder}[true]{} \pst@def{PreparePoints}<{% counttomark /m exch def \ifPst@ChangeOrder @@ -2033,34 +1990,33 @@ }> % % -\define@key[psset]{}{xAxisLabel}{\def\psk@xAxisLabel{#1}} -\define@key[psset]{}{yAxisLabel}{\def\psk@yAxisLabel{#1}} +\define@key[psset]{pstricks-add}{xAxisLabel}{\def\psk@xAxisLabel{#1}} +\define@key[psset]{pstricks-add}{yAxisLabel}{\def\psk@yAxisLabel{#1}} %\psset{xAxisLabel=x,yAxisLabel=y} -\define@key[psset]{}{xAxisLabelPos}{\def\psk@xAxisLabelPos{#1}} -\define@key[psset]{}{yAxisLabelPos}{\def\psk@yAxisLabelPos{#1}} +\define@key[psset]{pstricks-add}{xAxisLabelPos}{\def\psk@xAxisLabelPos{#1}} +\define@key[psset]{pstricks-add}{yAxisLabelPos}{\def\psk@yAxisLabelPos{#1}} %\psset{yAxisLabelPos={},xAxisLabelPos={}} % \newdimen\psk@llx \newdimen\psk@lly \newdimen\psk@urx \newdimen\psk@ury -\define@key[psset]{}{llx}{\pssetxlength\psk@llx{#1}} -\define@key[psset]{}{lly}{\pssetylength\psk@lly{#1}} -\define@key[psset]{}{urx}{\pssetxlength\psk@urx{#1}} -\define@key[psset]{}{ury}{\pssetylength\psk@ury{#1}} +\define@key[psset]{pstricks-add}{llx}{\pssetxlength\psk@llx{#1}} +\define@key[psset]{pstricks-add}{lly}{\pssetylength\psk@lly{#1}} +\define@key[psset]{pstricks-add}{urx}{\pssetxlength\psk@urx{#1}} +\define@key[psset]{pstricks-add}{ury}{\pssetylength\psk@ury{#1}} %\psset{llx=\z@, lly=\z@, urx=\z@, ury=\z@}% prevents rounding errors \newif\ifPst@plot@box -\define@key[psset]{}{box}[true]{\@nameuse{Pst@plot@box#1}} +\define@key[psset]{pstricks-add}{box}[true]{\@nameuse{Pst@plot@box#1}} % \newdimen\pst@xunit \newdimen\pst@yunit % \def\psgraph{\def\pst@par{}\pst@object{psgraph}} \def\psgraph@i{\pst@getarrows\psgraph@ii} -\def\psgraph@ii(#1){\@ifnextchar({\psgraph@iii(#1)}{\psgraph@iv(0,0)(#1)}} -\def\psgraph@iii(#1)(#2){\@ifnextchar(% - {\psgraph@v(#1)(#2)}% - {\psgraph@iv(#1)(#2)}} +\def\psgraph@ii(#1,#2){\@ifnextchar({\psgraph@iii(#1,#2)}{\psgraph@iv(0,0)(#1,#2)}} +\def\psgraph@iii(#1,#2)(#3,#4){\@ifnextchar({\psgraph@v(#1,#2)(#3,#4)}{\psgraph@iv(#1,#2)(#3,#4)}} +% \def\psgraph@iv(#1,#2)(#3,#4)#5#6{% no special origin defined % minX | minY | maxX | maxY | Length x-axis | length y-axis% \pst@killglue @@ -2157,7 +2113,7 @@ \endgroup \def\readdata{\@ifnextchar[{\readdata@i}{\readdata@i[]}} -\def\readdata@i[#1]#2#3{{% +\def\readdata@i[#1]#2#3{% \def\pst@tempA{#1}% \ifx\pst@tempA\@empty\else\psset{#1}\fi \openin1=#3 @@ -2181,19 +2137,33 @@ \endgroup% \global\let#2\pst@tempg% \global\let\pst@tempg\relax% -}\ignorespaces} +\ignorespaces} % % D.G. addition - Jun. 9, 1998 - Polar plots using the \psplot macro % Code added according the way suggested by Ulrich Dirr <udirr@das-team.com> - % For polar plots -\newif\ifpolarplot -\define@key[psset]{}{polarplot}[true]{\@nameuse{polarplot#1}} +\define@boolkey[psset]{pstricks-add}[Pst@]{polarplot}[true]{} %\psset{polarplot=false} % -\newif\ifPst@algebraic% -\define@key[psset]{}{algebraic}[true]{\@nameuse{Pst@algebraic#1}}% +\define@boolkey[psset]{pstricks-add}[Pst@]{algebraic}[true]{}% %\psset{dimen=middle}% remark of ML +\define@key[psset]{pstricks-add}{method}{\def\psk@method{#1}}% adams - rk4 +\define@key[psset]{pstricks-add}{whichabs}{\def\psk@whichabs{#1}}% +\define@key[psset]{pstricks-add}{whichord}{\def\psk@whichord{#1}}% +\define@key[psset]{pstricks-add}{plotfuncx}{\def\psk@plotfuncx{#1}}% +\define@key[psset]{pstricks-add}{plotfuncy}{\def\psk@plotfuncy{#1}}% +\define@key[psset]{pstricks-add}{expression}{\def\psk@expression{#1}}% +\define@boolkey[psset]{pstricks-add}[Pst@]{buildvector}[true]{}% +\def\@rkiv{rk4}% Runge-Kutta 4 method +\def\@adams{adams}% Adams method +\def\@default{default}% Adams method +% +\define@boolkey[psset]{pstricks-add}[Pst@]{VarStep}[true]{} +\define@key[psset]{pstricks-add}{PlotDerivative}{\def\psk@PlotDerivative{#1}}% +\define@key[psset]{pstricks-add}{VarStepEpsilon}{\def\psk@VarStepEpsilon{#1}}% +\define@key[psset]{pstricks-add}{varsteptol}{\def\psk@varsteptol{#1}}% adams - rk4 +\define@key[psset]{pstricks-add}{adamsorder}{\def\psk@adamsorder{#1}}% adams - rk4 +%\define@key[psset]{pstricks-add}{varstepincrease}{\def\psk@varstepincrease{#1}}% varrk4 % \def\psplot@i#1#2#3{% \pst@killglue @@ -2201,13 +2171,34 @@ \use@par \@nameuse{beginplot@\psplotstyle}% % D.G. modification begin - Jun. 9, 1998 - \ifpolarplot + \ifPst@polarplot \addto@pscode{% \psplot@init /x #1 def /x1 #2 def /dx x1 x sub \psk@plotpoints div def - /F@pstplot \ifPst@algebraic (#3) tx@addDict begin AlgParser end cvx \else { #3 } \fi def + /F@pstplot \ifPst@algebraic (#3) + \ifx\psk@PlotDerivative\@none\else + \psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat + \fi\space + tx@AlgToPs begin AlgToPs end cvx + \else { #3 } \fi def + \ifPst@VarStep + /StillZero 0 def /LastNonZeroStep dx def + /F2@pstplot tx@Derive begin (#3) (x) Derive (x) Derive end + \ifx\psk@PlotDerivative\@none\else + \psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat + \fi\space + tx@AlgToPs begin AlgToPs end cvx def + %% computation of the tolerance defined by plotpoints + /epsilon12 \ifx\psk@VarStepEpsilon\@default tx@Derive begin F2@pstplot end dx 3 exp abs mul abs + \else\psk@VarStepEpsilon\space 12 mul \fi def + /ComputeStep { + dup 1e-4 lt + { pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def } + { epsilon12 exch div 1 3 div exp /StillZero 0 def } + ifelse } bind def + \fi /xy {% Adapted from \parametricplot@i F@pstplot x \ifPst@algebraic RadtoDeg \fi PtoC % #3 dup x cos mul exch x sin mul @@ -2221,7 +2212,28 @@ /x #1 def /x1 #2 def /dx x1 x sub \psk@plotpoints div def - /F@pstplot \ifPst@algebraic (#3) tx@addDict begin AlgParser end cvx \else { #3 } \fi def + /F@pstplot \ifPst@algebraic (#3) + \ifx\psk@PlotDerivative\@none\else + \psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat + \fi\space + tx@AlgToPs begin AlgToPs end cvx + \else { #3 } \fi def + \ifPst@VarStep + /StillZero 0 def /LastNonZeroStep dx def + /F2@pstplot tx@Derive begin (#3) (x) Derive (x) Derive end + \ifx\psk@PlotDerivative\@none\else + \psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat + \fi\space + tx@AlgToPs begin AlgToPs end cvx def + %% computation of the tolerance defined by plotpoints + /epsilon12 \ifx\psk@VarStepEpsilon\@default tx@Derive begin F2@pstplot end dx 3 exp abs mul abs + \else\psk@VarStepEpsilon\space 12 mul \fi def + /ComputeStep { + dup 1e-4 lt + { pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def } + { epsilon12 exch div 1 3 div exp /StillZero 0 def } + ifelse } bind def + \fi /xy { x \pst@number\psxunit mul F@pstplot \pst@number\psyunit mul % \ifPst@algebraic F@pstplot \else #3 \fi \pst@number\psyunit mul @@ -2237,6 +2249,59 @@ \fi \endgroup \ignorespaces} +% +\def\psplot@ii{% + \ifPst@VarStep + \addto@pscode{% + mark xy \@nameuse{beginqp@\psplotstyle} + { F2@pstplot abs ComputeStep + x 2 copy add dup x1 gt {pop x1} if /x exch def F2@pstplot abs ComputeStep + /x 3 -1 roll def 2 copy gt { exch } if pop + /x x 3 -1 roll add dup x1 gt {pop x1} if def + xy \@nameuse{doqp@\psplotstyle} + x x1 eq { exit } if} loop}% + \else\pst@killglue% + \addto@pscode{% + xy \@nameuse{beginqp@\psplotstyle} + \ifx\psk@method\@varrkiv\else\psk@plotpoints 1 sub \fi { + /x x dx add \ifx\psk@method\@varrkiv dup x1 gt { pop x1 } if \fi def + xy \@nameuse{doqp@\psplotstyle} + \ifx\psk@method\@varrkiv x x1 eq { exit } if \fi + } \ifx\psk@method\@varrkiv loop\else repeat\fi + /x x1 def + xy \@nameuse{doqp@\psplotstyle}}% + \fi% + \@nameuse{endqp@\psplotstyle}} +\def\psplot@iii{% + \ifPst@VarStep + \addto@pscode{% + /n 2 def + mark + { xy n 2 roll F2@pstplot abs + ComputeStep x 2 copy add dup x1 gt {pop x1} if + /x exch def F2@pstplot abs ComputeStep + /x 3 -1 roll def 2 copy gt { exch } if pop + /x x 3 -1 roll dup /LastNonZeroStep exch def add dup x1 gt {pop x1} if def /n n 2 add def + x x1 eq { exit } if } loop + xy n 2 roll}% + \else\pst@killglue% + \addto@pscode{% + mark + /n 2 def + \ifx\psk@method\@varrkiv\else\psk@plotpoints\fi { + xy + n 2 roll + /n n 2 add def + /x x dx add \ifx\psk@method\@varrkiv dup x1 gt { pop x1 } if \fi def + \ifx\psk@method\@varrkiv x x1 eq { exit } if \fi + } \ifx\psk@method\@varrkiv loop\else repeat\fi + /x x1 def + xy + n 2 roll}% + \fi% + \@nameuse{endplot@\psplotstyle}} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\parametricplot@i#1#2#3{% \pst@killglue% \begingroup @@ -2247,7 +2312,30 @@ /t #1 def /t1 #2 def /dt t1 t sub \psk@plotpoints div def - \ifPst@algebraic/F@pstplot (#3) tx@addDict begin AlgParser end cvx def \fi + /F@pstplot \ifPst@algebraic (#3) + \ifx\psk@PlotDerivative\@none\else + \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat + \fi\space + tx@AlgToPs begin AlgToPs end cvx + \else { #3 } \fi def + \ifPst@VarStep + /StillZero 0 def /LastNonZeroStep dt def + /F2@pstplot tx@Derive begin (#3) (t) Derive (t) Derive end + \ifx\psk@PlotDerivative\@none\else + \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat + \fi\space + tx@AlgToPs begin AlgToPs end cvx def + %% computation of the tolerance defined by plotpoints + /epsilon12 \ifx\psk@VarStepEpsilon\@default + tx@Derive begin F2@pstplot end Pyth + dt 3 exp abs mul + \else\psk@VarStepEpsilon\space 12 mul \fi def + /ComputeStep { + dup 1e-4 lt + { pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def } + { epsilon12 exch div 1 3 div exp /StillZero 0 def } + ifelse } bind def + \fi /xy { \ifPst@algebraic F@pstplot \else #3 \fi \pst@number\psyunit mul exch @@ -2263,8 +2351,56 @@ \fi \endgroup \ignorespaces} +\def\parametricplot@ii{% + \ifPst@VarStep + \addto@pscode{% + mark xy \@nameuse{beginqp@\psplotstyle} + { F2@pstplot Pyth ComputeStep + t 2 copy add dup t1 gt {pop t1} if /t exch def F2@pstplot Pyth ComputeStep + /t 3 -1 roll def 2 copy gt { exch } if pop + /t t 3 -1 roll add dup t1 gt {pop t1} if def + xy \@nameuse{doqp@\psplotstyle} + t t1 eq { exit } if } loop}% + \else\pst@killglue% + \addto@pscode{% + xy \@nameuse{beginqp@\psplotstyle} + \psk@plotpoints 1 sub { + /t t dt add def + xy \@nameuse{doqp@\psplotstyle} + } repeat + /t t1 def + xy \@nameuse{doqp@\psplotstyle}}% + \fi% + \@nameuse{endqp@\psplotstyle}} +\def\parametricplot@iii{% + \ifPst@VarStep + \addto@pscode{% + /n 2 def + mark + { xy n 2 roll F2@pstplot Pyth + ComputeStep t 2 copy add dup t1 gt {pop t1} if + /t exch def F2@pstplot Pyth ComputeStep + /t 3 -1 roll def 2 copy gt { exch } if pop + /t t 3 -1 roll dup /LastNonZeroStep exch def add dup t1 gt {pop t1} if def /n n 2 add def + t t1 eq { exit } if } loop + xy n 2 roll}% + \else\pst@killglue% + \addto@pscode{% + mark + /n 2 def + \psk@plotpoints { + xy + n 2 roll + /n n 2 add def + /t t dt add def + } repeat + /t t1 def + xy + n 2 roll}% + \fi% + \@nameuse{endplot@\psplotstyle}} % -\define@key[psset]{}{barwidth}{\pst@getlength{#1}\psk@barwidth} +\define@key[psset]{pstricks-add}{barwidth}{\pst@getlength{#1}\psk@barwidth} %\psset{barwidth=0.25cm} % \def\psbar@ii{\addto@pscode{false \tx@NArray \psbar@iii}} @@ -2284,7 +2420,69 @@ \end@SpecialObj% } % -\define@key[psset]{}{Derive}{\def\psk@Derive{#1}}% +\define@key[psset]{pstricks-add}{StepType}{\pst@expandafter\psset@@StepType{#1}\@nil}% +\def\psset@@StepType#1#2\@nil{% + \ifx#1u\let\psk@StepType\@ne + \else\ifx#1l\let\psk@StepType\z@\else\let\psk@StepType\tw@\fi\fi} +\psset{StepType=lower} % alternative StepType=upper StepType=Riemann +% +\def\psStep{\pst@object{psStep}} +\def\psStep@i(#1,#2)#3#4{% + \begin@ClosedObj% + \addto@pscode{ + \ifPst@algebraic /Func (#4) tx@addDict begin AlgParser end cvx def \fi + /x #1 def + /dx #2 #1 sub #3 div def + /scx { \pst@number\psxunit mul } def + /scy { \pst@number\psyunit mul } def + \ifcase\psk@StepType % 0->lower + x scx 0 moveto + #3 { + \ifPst@algebraic Func \else #4 \fi scy dup x scx exch lineto + /x x dx add def + x scx exch lineto x scx 0 lineto + } repeat + \or % 1-> upper + x scx 0 moveto + #3 { + /x x dx add def + \ifPst@algebraic Func \else #4 \fi scy dup x dx sub scx exch lineto + x scx exch lineto x scx 0 lineto + } repeat + \or % 2-> Riemann + /eps3 100 def + /xMinMax [] def + /AMax [] def + /AMin [] def + /dt dx eps3 div def + #3 { + /Max \ifPst@algebraic Func \else #4 \fi def + /Min Max def + /t x def % save x value + eps3 { + \ifPst@algebraic Func \else #4 \fi + dup + Max lt { /Max exch def } { dup Min gt { /Min exch def }{ pop } ifelse } ifelse + /x x dt add def + } repeat + /x t def % restore + x scx Min scy Max scy xMinMax aload length 3 add array astore /xMinMax exch def + /x x dx add def + } repeat + /dx dx scx def + xMinMax aload length 3 div cvi { + /yMax ED /yMin ED /x ED + x yMin moveto dx 0 rlineto x dx add yMax lineto + dx neg 0 rlineto x yMin lineto } repeat + \fi + }% + \psk@fillstyle + \pst@stroke + \end@ClosedObj% +} +% +\define@key[psset]{pstricks-add}{Derive}{\def\psk@Derive{#1}}% +\def\@NOTEMPTY{NOT@EMPTY}%%dr 0606 % %% #1 : x value %% #2 : delta x @@ -2294,18 +2492,28 @@ \begin@OpenObj% % \let\pst@linetype\pst@arrowtype% % \pst@addarrowdef% + \ifx\psk@Derive\@empty\ifPst@algebraic\psset{Derive=NOT@EMPTY}\fi\fi%%dr 0606 \addto@pscode{ gsave % save current state /F@pstplot \ifPst@algebraic (#3) tx@addDict begin AlgParser end cvx \else { #3 } \fi def % define function - \ifx\psk@Derive\@empty\else + \ifx\psk@Derive\@empty\else + \ifx\psk@Derive\@NOTEMPTY\else%%dr 0606 /FDer@pstplot % do we have a derivation defined? \ifPst@algebraic (\psk@Derive) tx@addDict begin AlgParser end cvx \else { \psk@Derive } \fi def % define derivation + \fi%%dr 0606 \fi + /@parametric false def %%dr 0606 % first we calculate the origin #1 dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot - { /y ED /x ED } % if yes, then we have 2 values - { \ifpolarplot x \ifPst@algebraic RadtoDeg \fi PtoC /y ED /x ED \else /y ED \fi } ifelse + %%{ /y ED /x ED } % if yes, then we have 2 values + { /y ED /x ED /@parametric true def } % if yes, then we have 2 values%%dr 0606 + { \ifPst@polarplot x \ifPst@algebraic RadtoDeg \fi PtoC /y ED /x ED \else /y ED \fi } ifelse cleartomark + \ifx\psk@Derive\@NOTEMPTY%%begin dr 0606 + %% algebraic we can use the derivative machine + /FDer@pstplot (#3) @parametric { (t) } { (x) } ifelse + tx@Derive begin Derive end tx@addDict begin AlgParser end cvx def + \fi%%end dr 0606 x \pst@number\psxunit mul y \pst@number\psyunit mul translate % define the temporary origin % now we calculate the slope of the tangent @@ -2313,24 +2521,24 @@ #1 abs 1.0e-6 lt % no, we choose secant for the tangent { #1 0.0005 add dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot { /y2 ED /x2 ED } % we have 2 values - { \ifpolarplot dup x \ifPst@algebraic RadtoDeg \fi + { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi cos mul /x2 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x2 x def \fi /y2 ED } ifelse cleartomark % delete the mark #1 0.0005 sub dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot { /y1 ED /x1 ED } - { \ifpolarplot dup x \ifPst@algebraic RadtoDeg \fi + { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi cos mul /x1 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x1 x def \fi /y1 ED } ifelse cleartomark y2 y1 sub x2 x1 sub } % dy dx { % > 1.0e-06 #1 1.0005 mul dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot { /y2 ED /x2 ED } % we have 2 values - { \ifpolarplot dup x \ifPst@algebraic RadtoDeg \fi + { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi cos mul /x2 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x2 x def \fi /y2 ED } ifelse cleartomark #1 .9995 mul dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot { /y1 ED /x1 ED } % we have 2 values - { \ifpolarplot dup x \ifPst@algebraic RadtoDeg \fi + { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi cos mul /x1 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x1 x def \fi /y1 ED } ifelse cleartomark y2 y1 sub \pst@number\psyunit mul x2 x1 sub \pst@number\psxunit mul } ifelse @@ -2338,7 +2546,7 @@ \else % there is a derivation defined #1 dup /x ED /t ED tx@addDict begin mark FDer@pstplot end counttomark 1 gt % test, if we have parametricplot { /y ED /x ED } - { \ifpolarplot /Fphi ED % the value F'(phi) + { \ifPst@polarplot /Fphi ED % the value F'(phi) tx@addDict begin F@pstplot end x \ifPst@algebraic RadtoDeg \fi PtoC /y0 ED /x0 ED % the x y values x \ifPst@algebraic RadtoDeg \fi sin Fphi mul x0 add /y ED x \ifPst@algebraic RadtoDeg \fi cos Fphi mul y0 sub /x ED @@ -2364,7 +2572,7 @@ \psk@dotsize \@nameuse{psds@\psk@dotstyle}% 0 0 Dot - \fi + \fi grestore % restore old graphics state }% \use@pscode % part of \end@OpenObj @@ -2372,21 +2580,12 @@ \ignorespaces% % part of \end@OpenObj }% % -\define@key[psset]{}{method}{\def\psk@method{#1}}% adams - rk4 -\define@key[psset]{}{whichabs}{\def\psk@whichabs{#1}}% -\define@key[psset]{}{whichord}{\def\psk@whichord{#1}}% -\define@key[psset]{}{plotfuncx}{\def\psk@plotfuncx{#1}}% -\define@key[psset]{}{plotfuncy}{\def\psk@plotfuncy{#1}}% -\define@key[psset]{}{expression}{\def\psk@expression{#1}}% -\newif\ifPst@buildvector% -\define@key[psset]{}{buildvector}[true]{\@nameuse{Pst@buildvector#1}}% -\def\@rkiv{rk4}% Runge-Kutta 4 method -\def\@adams{adams}% Adams method -% +\def\@varrkiv{varrkiv}% Runge-Kutta 4 with an adaptive step method %% #1-#2 x range %% #3 initial value of y (which is a vector) y(0) y'(0) y''(0) ... %% #4 value of the derivative (y and t can be used) -\def\psplotDiffEqn{\def\pst@par{}\pst@object{psplotDiffEqn}}% initial code by Dominique 2005-05-21 +% +\def\psplotDiffEqn{\pst@object{psplotDiffEqn}}% initial code by Dominique 2005-05-21 \def\psplotDiffEqn@i#1#2#3#4{% \pst@killglue% \begingroup% @@ -2397,91 +2596,156 @@ /x1 #2 def % last value /y [ #3 ] def % values for t=0 /ylength y length def % number of elements in #3 - /addvect { - 1 1 ylength { - /i exch def - ylength i sub 2 add -1 roll add ylength 2 mul i sub 1 roll - } for + /addvect { + 1 1 ylength { + /i exch def + ylength i sub 2 add -1 roll add ylength 2 mul i sub 1 roll + } for } def /dx x1 x sub \psk@plotpoints\space div def - /mulvect { - ylength exch - 1 index { - dup 4 -1 roll mul 2 index 2 add 1 roll - } repeat + /mulvect { + ylength exch + 1 index { + dup 4 -1 roll mul 2 index 2 add 1 roll + } repeat pop pop } def /divvect { ylength exch 1 index { dup 4 -1 roll exch div 2 index 2 add 1 roll } repeat pop pop } def /k0 0 def /k1 0 def /k2 0 def /k3 0 def \ifPst@algebraic /F@pstplot (#4) tx@addDict begin AlgParser end cvx def \fi - /Func { - \ifPst@algebraic F@pstplot ylength array astore + /Func { + \ifPst@algebraic F@pstplot ylength array astore \else \ifPst@buildvector\else y aload pop \fi #4 \ifPst@buildvector\else ylength array astore \fi \fi } def - \ifx\psk@method\@adams /F1 0 def /F2 0 def /F3 0 def /F4 0 def /F5 0 def /F6 0 def /INIT 0 def \fi - \ifx\psk@method\@empty\else %% RUNGE-KUTTA & ADAMS methods - /RK { - /k0 Func { dx mul } forall ylength array astore def %% y - dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def % - x dup dx 2 div add /x exch def %% y x - /k1 Func { dx mul } forall ylength array astore def %% y x - exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y - /k2 Func { dx mul } forall ylength array astore def %% x y - dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x - /k3 Func { dx mul } forall ylength array astore def %% y x - /x exch def %% y - dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect - 2 mulvect addvect k3 aload pop addvect - 6 divvect addvect y astore pop - } def - \ifx\psk@method\@adams - /ADAMS { - %% ORDRE 4 - %% F4 aload pop 55 mulvect - %% F3 aload pop -59 mulvect addvect - %% F2 aload pop 37 mulvect addvect - %% F1 aload pop -9 mulvect addvect - %% dx mulvect 24 divvect - %% ORDRE 5 - %% F5 aload pop 1901 mulvect - %% F4 aload pop -2774 mulvect addvect - %% F3 aload pop 2616 mulvect addvect - %% F2 aload pop -1274 mulvect addvect - %% F1 aload pop 251 mulvect addvect - %% dx mulvect 720 divvect - %% ORDRE 6 - F6 aload pop 4277 mulvect - F5 aload pop -7923 mulvect addvect - F4 aload pop 9982 mulvect addvect - F3 aload pop -7298 mulvect addvect - F2 aload pop 2877 mulvect addvect - F1 aload pop -475 mulvect addvect - dx mulvect 1440 divvect - y aload pop addvect ylength array astore /y exch def } def - \fi + \ifx\psk@method\@adams /F1 0 def /F2 0 def /F3 0 def /F4 0 def /F5 0 def /F6 0 def /INIT 1 def \fi + \ifx\psk@method\@empty\else + \ifx\psk@method\@varrkiv %% RUNGE-KUTTA method with var step algorithm + /VarStep false def /VarStepRatio 1 def + /RK { + /k0 Func { dx mul } forall ylength array astore def %% y + dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def % + x dup dx 2 div add /x exch def %% y x + /k1 Func { dx mul } forall ylength array astore def %% y x + exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y + /k2 Func { dx mul } forall ylength array astore def %% x y + dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x + /k3 Func { dx mul } forall ylength array astore def %% y x + /x exch def %% y + dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect + 2 mulvect addvect k3 aload pop addvect + 6 divvect addvect y astore + } def + /VARRK { + VarStep + %{ /dx dx \psk@varstepincrease\space mul def /VarStep false def } if + { /dx dx VarStepRatio mul def /VarStep false def } if + x dx add x1 gt { /dx x1 x sub def } if + %{ /dx dx \psk@varstepdecrease\space div def } ifelse + %% we compute y(x+dx) from y(x) using RK4 + RK %% y(x) y(x+dx) + exch /y exch def /dx dx 2 div def + { %% we compute y(x+dx/2) from y(x) using RK4 + y RK %% y(x+dx) y(x+dx/2) + %% then y(x+dx) from y(x+dx/2) using RK4 + /y exch def y RK %% y(x+dx) y(x) y(x+dx/2) y(x+dx) + dup aload pop 4 ylength add -1 roll + { -1 mul } forall addvect 0 ylength { exch abs 2 copy lt { exch } if pop } repeat + 0 3 -1 roll {abs 2 copy lt { exch } if pop } forall + dup 1e-6 lt { pop } { div } ifelse + /dx dx 2 mul def + dup \psk@varsteptol\space lt + %{ \psk@varsteptol\space div .1 lt { /VarStep true def } if pop exit } if + %pop /dx dx 4 div def exch /y exch def } loop + { .001 div dup .1 lt + { dup 1e-6 lt { pop 3 } { log neg } ifelse /VarStepRatio exch def /VarStep true def } + { pop } ifelse pop exit } if + pop /dx dx 4 div def exch /y exch def } loop + } def + \else %% RUNGE-KUTTA & ADAMS methods + /RK { + /k0 Func { dx mul } forall ylength array astore def %% y + dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def % + x dup dx 2 div add /x exch def %% y x + /k1 Func { dx mul } forall ylength array astore def %% y x + exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y + /k2 Func { dx mul } forall ylength array astore def %% x y + dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x + /k3 Func { dx mul } forall ylength array astore def %% y x + /x exch def %% y + dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect + 2 mulvect addvect k3 aload pop addvect + 6 divvect addvect y astore pop + } def + \ifx\psk@method\@adams + /ADAMS { + \ifcase\psk@adamsorder + \errmessage{pstricks-add error: no order 0th for adams method (see user's manual)} + \or\errmessage{pstricks-add error: no order 1st for adams method (see user's manual)} + \or\errmessage{pstricks-add error: no order 2nd for adams method (see user's manual)} + \or\errmessage{pstricks-add error: no order 3rd for adams method (see user's manual)} + \or + %% ORDRE 4 + F4 aload pop 55 mulvect + F3 aload pop -59 mulvect addvect + F2 aload pop 37 mulvect addvect + F1 aload pop -9 mulvect addvect + dx mulvect 24 divvect + \or + %% ORDRE 5 + F5 aload pop 1901 mulvect + F4 aload pop -2774 mulvect addvect + F3 aload pop 2616 mulvect addvect + F2 aload pop -1274 mulvect addvect + F1 aload pop 251 mulvect addvect + dx mulvect 720 divvect + \or + %% ORDRE 6 + F6 aload pop 4277 mulvect + F5 aload pop -7923 mulvect addvect + F4 aload pop 9982 mulvect addvect + F3 aload pop -7298 mulvect addvect + F2 aload pop 2877 mulvect addvect + F1 aload pop -475 mulvect addvect + dx mulvect 1440 divvect + \fi + y aload pop addvect ylength array astore /y exch def } def + \fi + \fi \fi /xy { \ifx\psk@plotfuncx\@empty \ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi - \else \psk@plotfuncx\space \fi + \else \psk@plotfuncx\space \fi \pst@number\psxunit mul y \ifx\psk@method\@empty %% EULER method /y Func { dx mul } forall y aload pop addvect ylength array astore def \else% - \ifx\psk@method\@rkiv %% RUNGE-KUTTA method + \ifx\psk@method\@varrkiv %% RUNGE-KUTTA method + VARRK + \else\ifx\psk@method\@rkiv %% RUNGE-KUTTA method RK - \else %% ADAMS method - /F1 F2 def /F2 F3 def /F3 F4 def /F4 F5 def /F5 F6 def /F6 Func def - INIT 5 lt - { RK /INIT INIT 1 add def } - { ADAMS } ifelse - \fi + \else + /F1 F2 def /F2 F3 def /F3 F4 def /F4 %% ADAMS method + \ifcase\psk@adamsorder\or\or\or\or + %% ORDRE 4 + Func def + \or + %% ORDRE 5 + F5 def /F5 Func def + \or + %% ORDRE 6 + F5 def /F5 F6 def /F6 Func def + \fi + INIT \psk@adamsorder\space lt + { RK /INIT INIT 1 add def } + { ADAMS } ifelse + \fi\fi \fi - \ifx\psk@plotfuncy\@empty + \ifx\psk@plotfuncy\@empty \ifx\psk@whichord\@empty 0 \else \psk@whichord\space \fi get % - \else \psk@plotfuncy\space \fi + \else \psk@plotfuncy\space \fi \pst@number\psyunit mul } def }% @@ -2493,9 +2757,10 @@ \ignorespaces% } % +% \def\psGTriangle{\pst@object{psGTriangle}} \def\psGTriangle@i(#1)(#2)(#3)#4#5#6{{% - \def\solid@star{} + \def\solid@star{}% \begin@ClosedObj \pst@getcoor{#1}\pst@tempA% A: "rgb xr xg xb" or "gray xg" \pst@getcoor{#2}\pst@tempB% B @@ -2520,10 +2785,63 @@ \end@ClosedObj% }} % +\define@key[psset]{pstricks-add}{dicescale}{\def\psk@dicescale{#1}} +\def\psdice{\pst@object{psdice}} +\def\psdice@i#1{{% + \pst@killglue + \psset{framearc=0.3,linewidth=1pt,dicescale=1.0}% + \use@par% + \psscalebox{\psk@dicescale}{% + \psframe(-0.5,-0.5)(0.5,0.5)% + \ifcase#1% + \or\qdisk(0,0){3pt}% + \or\qdisk(-0.3,-0.3){3pt}\qdisk(0.3,0.3){3pt}% + \or\psdice@i{1}\psdice@i{2}% + \or\qdisk(-0.3,0.3){3pt}\qdisk(-0.3,-0.3){3pt}% + \qdisk(0.3,0.3){3pt}\qdisk(0.3,-0.3){3pt}% + \or\psdice@i{1}\psdice@i{4}% + \or\psdice@i{4}\qdisk(-0.3,0){3pt}\qdisk(0.3,0){3pt}% + \fi}% + \ignorespaces% +}} +% +% the datafile must be a matrix with +% /dotmatrix [ +% ..... +% ..... +% ] def +% +\def\psMatrixPlot{\pst@object{psMatrixPlot}} +\def\psMatrixPlot@i#1#2#3{% + \pst@killglue + \begingroup + \begin@SpecialObj% + \addto@pscode{ + (#3) run % load the data file + \psk@dotsize + \@nameuse{psds@\psk@dotstyle} % + /n 0 def % index for element + 1 1 #1 { % the y loop (outer one) + /y exch def % save y + 1 1 #2 { % the x loop (inner one) + /x exch def % save x + dotmatrix n get % get value from matrix + dup 0 gt { % test if > 0 + x \pst@number\psxunit mul + \ifPst@ChangeOrder #1 y sub 1 add \else y \fi \pst@number\psyunit mul Dot% + } { pop } ifelse + /n n 1 add def + } for + } for + }% + \end@SpecialObj% + \endgroup% + \ignorespaces% +} +% \def\resetOptions{% \@zero=0% -% \def\pshlabel##1{$##1$}% -% \def\psvlabel##1{$##1$}% + \def\pst@linetype{0}% \psset{% %%%% pstricks %%%%%%%% unit=1cm,% @@ -2550,7 +2868,7 @@ ArrowFill=true,% ArrowInside={},ArrowInsidePos=0.5,% ArrowInsideNo=1,ArrowInsideOffset=0,% - liftpen=0, linetype=0,% + liftpen=0, linetype=0,% gangle=0,% curvature=1 .1 0,% dotsize=2pt 2,% @@ -2567,9 +2885,13 @@ arcsep=0,radius=.25cm,% ref=c,rot=0,labelsep=5pt,refangle=0,% intSeparator={,},% + dicescale=1.0,% %%%%%%%%% pst-plot %%%%%%%%%%%%% + labelFontSize={},% + StepType=lower, % alternative SumType=upper plotstyle=line,plotpoints=50,% - ticksize=-4pt 4pt,tickstyle=full,ticks=all,% + ticksize=-4pt 4pt, + tickstyle=full, ticks=all,% subticksize=0.75,subticks=1,tickcolor=black,% ticklinestyle=solid,subticklinestyle=solid,% subtickcolor=gray,% @@ -2582,11 +2904,9 @@ braceWidth=0.35,bracePos=0.5,% arrowscale=1,% dashColorI=black,dashColorII=red,dashNo=0.2,linecap=0,% - wBegin=\pslinewidth, wEnd=\pslinewidth,% xyAxes=true,% - trigLabels=false,% + trigLabels=false,trigLabelBase=0,% xDecimals={},yDecimals={},% -% xLabel={},yLabel={},% xlogBase={},ylogBase={},% logLines=none,% ignoreLines=0,% @@ -2599,8 +2919,10 @@ randomPoints=1000,color=false,% method={},whichabs={},whichord={},% plotfuncx={},plotfuncy={},buildvector=false,algebraic=false, - Derive={},% -%%%%%%%%% pst-node %%%%%%%%%% + Derive={},adamsorder=4,% + VarStep=false, PlotDerivative=none, VarStepEpsilon=default,% + varsteptol=.001,% + %%%%%%%%% pst-node %%%%%%%%%% lineAngle=0,% nodealign=false,% href=0,% @@ -2620,11 +2942,10 @@ shortput=none,% colsep=1.5cm,% rowsep=1.5cm,% -% shortput=tablr,%% mcol=c,% mnode=R,% - emnode=none} -} + emnode=none +}} % \resetOptions % @@ -2632,3 +2953,4 @@ % %% END: pstricks-add.tex \endinput + |