summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-03-18 23:43:30 +0000
committerKarl Berry <karl@freefriends.org>2007-03-18 23:43:30 +0000
commit60b16cc4ebfd06c89381dd6927e20246d3c08bff (patch)
tree78b231f76f2cf808d0a17a845c6f65c653a96e08 /Master/texmf-dist/tex
parent2517d00983d11dc77baf4d00ddff96997a57601a (diff)
pstricks-add (13mar07)
git-svn-id: svn://tug.org/texlive/trunk@4052 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex126
1 files changed, 86 insertions, 40 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 be90c409c70..80b2678334f 100644
--- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex
+++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex
@@ -26,8 +26,8 @@
\ifx\MultidoLoaded\endinput\else \input multido \fi
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
%
-\def\fileversion{2.82}
-\def\filedate{2006/11/22}
+\def\fileversion{2.84}
+\def\filedate{2007/03/13}
\message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -153,22 +153,15 @@
\endgroup%
}
%
-\define@boolkey[psset]{pstricks-add}[Pst@]{angleCheck}[true]{}
-\psset[pstricks-add]{angleCheck=true}
-%
-\def\pst@getangle#1#2{%
- \ifPst@angleCheck\pst@@getangle{#1}\else\def\pst@angle{#1 }\fi%
- \let#2\pst@angle}
-%
%--------------------------------------- small stuff -------------------------------
% transalpha needs a run through latex -> dvips -> ps2pdf14(!)
% and view with Acrobat >= 5.0
% use transpalpha=<mumber> to the the opacity level
%
-\define@key[psset]{pstricks-add}{transpalpha}{\pst@checknum{#1}\pstranspalpha }
+\define@key[psset]{pstricks-add}{transpalpha}{\pst@checknum{#1}\psk@transpalpha }
%\psset[pstricks-add]{transpalpha=1}
\def\psfs@transparent{%
- \addto@pscode{/Normal .setblendmode \pstranspalpha .setshapealpha }%
+ \addto@pscode{/Normal .setblendmode \psk@transpalpha .setshapealpha }%
\psfs@solid}
%
\def\defineTColor{\@ifnextchar[{\defineTColor@i}{\defineTColor@i[]}}
@@ -348,10 +341,10 @@
\addbefore@par{ArrowInside=-,linearc=2mm,linewidth=1pt,%
nodesepA=0pt,nodesepB=0pt,bracePos=0.5}% the default
\begin@SpecialObj
- \use@par%
- \pst@getcoor{#1}\pst@tempA%
- \pst@getcoor{#2}\pst@tempB%
- \pnode(!%
+ \use@par
+ \pst@getcoor{#1}\pst@tempA
+ \pst@getcoor{#2}\pst@tempB
+ \pnode(!
/bW2 \pst@number\pst@braceWidth \pst@number\psyunit div 2.0 div def
\pst@tempA /YA exch \pst@number\psyunit div def
/XA exch \pst@number\psxunit div def
@@ -555,8 +548,7 @@
\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
+ \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
@@ -574,11 +566,11 @@
\psk@ArrowInsidePos\space 1 gt {
/Alpha y2 y1 sub x2 x1 sub Atan def
/ArrowPos \psk@ArrowInsideOffset\space def
- /ALength x2 x1 sub y2 y1 sub Pyth def
+ /Length x2 x1 sub y2 y1 sub Pyth def
/dArrowPos \psk@ArrowInsidePos\space abs def
{
/ArrowPos ArrowPos dArrowPos add def
- ArrowPos ALength gt { exit } if
+ ArrowPos Length gt { exit } if
x1 Alpha cos ArrowPos mul add
y1 Alpha sin ArrowPos mul add
ArrowInside
@@ -627,11 +619,11 @@
\psk@ArrowInsidePos\space 1 gt {
/Alpha y12 y11 sub x12 x11 sub atan def
/ArrowPos \psk@ArrowInsideOffset\space def
- /ALength x12 x11 sub y12 y11 sub Pyth def
+ /Length x12 x11 sub y12 y11 sub Pyth def
/dArrowPos \psk@ArrowInsidePos\space abs def
{
/ArrowPos ArrowPos dArrowPos add def
- ArrowPos ALength gt { exit } if
+ ArrowPos Length gt { exit } if
x11 Alpha cos ArrowPos mul add
y11 Alpha sin ArrowPos mul add
currentdict /ArrowInside known { ArrowInside } if
@@ -752,11 +744,11 @@
\psk@ArrowInsidePos\space 1 gt {
/Alpha y2 y1 sub x2 x1 sub atan def
/ArrowPos \psk@ArrowInsideOffset\space def
- /ALength x2 x1 sub y2 y1 sub Pyth def
+ /Length x2 x1 sub y2 y1 sub Pyth def
/dArrowPos \psk@ArrowInsidePos\space abs def
{%
/ArrowPos ArrowPos dArrowPos add def
- ArrowPos ALength gt { exit } if
+ ArrowPos Length gt { exit } if
x1 Alpha cos ArrowPos mul add
y1 Alpha sin ArrowPos mul add
ArrowInside
@@ -2468,6 +2460,49 @@
\end@SpecialObj%
}
%
+% LSM Least Square Method 2006-03-13 (hv)
+\def\psLSM@ii{\addto@pscode{false \tx@NArray \psLSM@iii}}
+\def\psLSM@iii{%
+ /xiSquare 0 def % xi*xi
+ /xi 0 def % xi
+ /fi 0 def % f(xi)
+ /xifi 0 def % xi*f(xi)
+ exch dup dup /xEnd ED /xStart ED exch
+ n { % number of data pairs
+ /Yval ED /Xval ED % save x y values
+ /xi xi Xval add def % sum xi
+ /xiSquare xiSquare Xval dup mul add def % sum xi*xi
+ /xifi xifi Xval Yval mul add def % sum xi*yi, same as xi*f(xi)
+ /fi fi Yval add def % sum yi, same as f(xi)
+ Xval xStart lt { /xStart Xval def } if % find the lowest xi
+ Xval xEnd gt { /xEnd Xval def } if % find the largest xi
+ } repeat
+ /u xiSquare fi mul xi xifi mul sub n xiSquare mul xi dup mul sub div def
+ /v n xifi mul xi fi mul sub n xiSquare mul xi dup mul sub div def
+ \Pst@Debug\space 0 gt { % print the equation
+ /Helvetica findfont 12 scalefont setfont
+ 0 -50 moveto (y=)show % print y=
+ v 20 string cvs show ( x+) show % v x+
+ u \pst@number\psyunit div 20 string cvs show } if
+ newpath
+ (\psk@xStart) length 0 gt % special start value?
+ { \psk@xStart\space \pst@number\psxunit mul }
+ { xStart } ifelse
+ dup v mul u add % xStart f(xStart)
+ moveto % goto first point x1 y(x1)
+ (\psk@xEnd) length 0 gt % special end value?
+ { \psk@xEnd\space \pst@number\psxunit mul }
+ { xEnd } ifelse
+ dup v mul u add % xEnd f(xEnd)
+ lineto % line to second point x2 y(x2)
+}%
+%
+\def\beginplot@LSM{\begin@SpecialObj}
+\def\endplot@LSM{%
+ \psLSM@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi%
+ \pst@stroke
+ \end@SpecialObj%
+}
\define@key[psset]{pstricks-add}{StepType}{\pst@expandafter\psset@@StepType{#1}\@nil}%
\def\psset@@StepType#1#2\@nil{%
\ifx#1u\let\psk@StepType\@ne
@@ -2633,6 +2668,10 @@
%% #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)
%
+\define@key[psset]{pstricks-add}{filename}{\def\psk@filename{#1}}%
+\define@boolkey[psset]{pstricks-add}[PST@]{saveData}[true]{}% \ifPST@saveData
+\psset[pstricks-add]{saveData=false,filename=PSTdata}
+%
\def\psplotDiffEqn{\pst@object{psplotDiffEqn}}% initial code by Dominique 2005-05-21
\def\psplotDiffEqn@i#1#2#3#4{%
\pst@killglue%
@@ -2640,6 +2679,7 @@
\use@par%
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{%
+ \ifPST@saveData /PST@data (\psk@filename) (w) file def \fi
/x #1 def % first value
/x1 #2 def % last value
/y [ #3 ] def % values for t=0
@@ -2657,8 +2697,7 @@
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
+ /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 {
@@ -2668,8 +2707,7 @@
\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 1 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
@@ -2709,8 +2747,7 @@
%{ \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 }
+ { 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
@@ -2769,16 +2806,16 @@
\ifx\psk@plotfuncx\@empty
\ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi
\else \psk@plotfuncx\space \fi
- \pst@number\psxunit mul y
- \ifx\psk@method\@empty %% EULER method
+ \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\@varrkiv %% RUNGE-KUTTA method
+ \ifx\psk@method\@varrkiv %% RUNGE-KUTTA method
VARRK
- \else\ifx\psk@method\@rkiv %% RUNGE-KUTTA method
+ \else\ifx\psk@method\@rkiv %% RUNGE-KUTTA method
RK
\else
- /F1 F2 def /F2 F3 def /F3 F4 def /F4 %% ADAMS method
+ /F1 F2 def /F2 F3 def /F3 F4 def /F4 %% ADAMS method
\ifcase\psk@adamsorder\or\or\or\or
%% ORDRE 4
Func def
@@ -2797,17 +2834,26 @@
\ifx\psk@plotfuncy\@empty
\ifx\psk@whichord\@empty 0 \else \psk@whichord\space \fi get %
\else \psk@plotfuncy\space \fi
- \pst@number\psyunit mul
+ \pst@number\psyunit mul
+ \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@data (\string\n) writestring
+ \fi
} def
}%
\gdef\psplot@init{}%
\@pstfalse
\@nameuse{testqp@\psplotstyle}%
\if@pst\psplot@ii\else\psplot@iii\fi
+ \addto@pscode{\ifPST@saveData PST@data closefile \fi}
\endgroup%
\ignorespaces%
-}%
-%%
+}
+%
+%
\def\psGTriangle{\pst@object{psGTriangle}}
\def\psGTriangle@i(#1)(#2)(#3)#4#5#6{{%
\def\solid@star{}%
@@ -2829,11 +2875,11 @@
[ \pst@colorB ] aload length 1 eq { dup dup } if 3 array astore
[ \pst@colorA ] aload length 1 eq { dup dup } if 3 array astore
tx@addDict begin GTriangle end % PS part
- }
- \if@star\pspolygon(#1)(#2)(#3)\fi
+ }%
+ \if@star\pspolygon(#1)(#2)(#3)\fi% draw borderline
\def\pst@linetype{2}%
\end@ClosedObj%
-}\ignorespaces}
+}}
%
\define@key[psset]{pstricks-add}{dicescale}{\def\psk@dicescale{#1}}
\def\psdice{\pst@object{psdice}}