diff options
author | Karl Berry <karl@freefriends.org> | 2011-04-17 00:49:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-04-17 00:49:57 +0000 |
commit | b69e4a3602ebc7d4526af84b680cf63ed0cf9021 (patch) | |
tree | 2adbfaf6cbdcdb6d9c5231703af2bc633c46ea37 /Master | |
parent | 2e1f9683796eac1430947f795341e3a4abc5de55 (diff) |
pst-plot 1.29 (14apr11)
git-svn-id: svn://tug.org/texlive/trunk@22099 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-plot/Changes | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.pdf | bin | 994306 -> 1038369 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.tex | 51 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-plot/pst-plot.tex | 90 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-plot/pst-plot.sty | 6 |
5 files changed, 140 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-plot/Changes b/Master/texmf-dist/doc/generic/pst-plot/Changes index 7d024d67a81..47da736e3d6 100644 --- a/Master/texmf-dist/doc/generic/pst-plot/Changes +++ b/Master/texmf-dist/doc/generic/pst-plot/Changes @@ -1,4 +1,5 @@ ----- pst-plot.tex +1.29 2011-04-13 - added rot \psNewton 1.28 2011-03-22 - added rot option for \psx|ytick 1.27 2011-02-20 - fixed bug with trailing spaces when inside psgraph \psclip is used with \psgrid diff --git a/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.pdf b/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.pdf Binary files differindex 7e99eed202c..8ec3ca043f4 100644 --- a/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.pdf +++ b/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.tex b/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.tex index a35004296ee..cb4777742ba 100644 --- a/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-plot/pst-plot-doc.tex @@ -2955,6 +2955,57 @@ The number of the iteration is given by $n$. \end{pspicture} \end{LTXexample} +\clearpage +\subsection{\nxLcs{psNewton}} +\begin{BDef} + \Lcs{psNewton}\OptArgs\Largb{$x_0$}\Largb{$f(x)$}\OptArg*{\Largs{f'(x)}}\Largb{$n$} +\end{BDef} + +If the optional derivation of the function $f(x)$ is missing, then the macro itself +calculates the derivation with an interval of $\pm0.01$. It can be changed by setting +the optional argument \Lkeyword{VarStepEpsilon} to another value. If the derivation +is also given as a function, it is used without any check for the values. + +\medskip +\begin{LTXexample}[pos=t] +\def\f{1/5*x^3-x^2} +\psset{plotpoints=2000,algebraic} +% +\begin{pspicture*}[showgrid](-5.5,-8.5)(7.5,3.5) +\psaxes{->}(0,0)(-5,-8)(7,3)[$x$,270][$y$,0] +\psplot[linewidth=2pt,linecolor=blue]{-5}{8}{\f} +\uput[90](2.95,0){$x_0$}\uput[90](3.9,0){$x_0$} +\psNewton[linecolor=red,linewidth=0.5pt]{2.95}{\f}{10} +\psNewton[showpoints,linestyle=dashed]{3.9}{\f}{8} +\end{pspicture*} +\end{LTXexample} + + + +$x_0$ is the start value of the iteration, $f(x)$ the function, which can either be in +postfix or algebraic notation, for the latter it needs the optional argument \Lkeyword{algebraic}. +The number of the iteration is given by $n$. All defined plotstyles can be used, but there +maybe PostScript errors for \Lkeyset{plotstyle=values} if the number of steps is too +big. In such a case decrease the number of steps. + +\medskip +\begin{LTXexample}[pos=t] +\def\f{-(1/192)*x^3-(1/12)*x-(1/192)*Pi*x^2-(1/12)*Pi+2} +\def\fDerive{-(3/192)*x^2-(1/12)-(2/192)*Pi*x} +\psset{plotpoints=2000,unit=0.5,algebraic} +% +\begin{pspicture*}[showgrid](-16,-5)(8.5,18.5) +\psaxes[Dx=6,Dy=4]{->}(0,0)(-16,-5)(8,18)[$x$,270][$y$,0] +\psplot[algebraic,linewidth=2pt,linecolor=blue]{-20}{8}{\f} +\psxTick(-15){x_0} +\psNewton[linecolor=red,linewidth=0.5pt]{-15}{\f}{12} +\psNewton[linecolor=red,linewidth=0.5pt,plotstyle=xvalues,showDerivation=false]{-15}{\f}{6} +% +%-15, -9.567466932, -4.903526029, 3.026073041, 6.688396612, 5.580230655 (Made by Maple) +\end{pspicture*} +\end{LTXexample} + +\clearpage \section{List of all optional arguments for \texttt{pst-plot}} \xkvview{family=pst-plot,columns={key,type,default}} diff --git a/Master/texmf-dist/tex/generic/pst-plot/pst-plot.tex b/Master/texmf-dist/tex/generic/pst-plot/pst-plot.tex index 55c751c7c1f..7e5ef72f8d2 100644 --- a/Master/texmf-dist/tex/generic/pst-plot/pst-plot.tex +++ b/Master/texmf-dist/tex/generic/pst-plot/pst-plot.tex @@ -1,4 +1,4 @@ -% $Id: pst-plot.tex 478 2011-03-22 13:55:18Z herbert $ +% $Id: pst-plot.tex 484 2011-04-13 13:07:33Z herbert $ %% BEGIN pst-plot.tex %% %% plotting functions and data with PSTricks. @@ -20,8 +20,8 @@ \ifx\PSTFPloaded\endinput\else \input pst-fp.tex \fi \ifx\MultidoLoaded\endinput\else \input multido.tex \fi % -\def\fileversion{1.28} -\def\filedate{2011/03/22} +\def\fileversion{1.29} +\def\filedate{2011/04/13} \message{ v\fileversion, \filedate\space (tvz,hv)} % \edef\TheAtCode{\the\catcode`\@} @@ -1318,10 +1318,10 @@ D\space##1% \pst@killglue \addbefore@par{arrows=-,linewidth=\psk@xtickwidth\pslinewidth} \use@par - \psline(#2,\pst@xticksizeB)(#2,\pst@xticksizeA) + \psline(#2, \pst@xticksizeB)(#2,\pst@xticksizeA) \rput[t]{#1}(! \psk@origin - #2 \pst@number\pslabelsep \pst@number\pst@xticksizeB add - \pst@number\psyunit div neg ){\pshlabel{#3\vphantom{1}}}}\ignorespaces} + #2 \pst@number\pslabelsep \pst@number\pst@xticksizeB add + \pst@number\psyunit div neg ){\pshlabel{#3\vphantom{1}}}}\ignorespaces} % %% #1 : optional arguments passed to psline %% #2 : rotating angle @@ -2291,6 +2291,84 @@ D\space##1% \endgroup% \ignorespaces} % +\define@boolkey[psset]{pst-plot}[Pst@]{showDerivation}[true]{} +\psset{showDerivation} +% +\def\psNewton{\pst@object{psNewton}} +\def\psNewton@i#1#2{\@ifnextchar[{\psNewton@ii{#1}{#2}}{\psNewton@iii{#1}{#2}}} +\def\psNewton@ii#1#2[#3]#4{% #1:xStart #2:f(x) #3:f'(x) #4:number of iterations + \pst@killglue% + \begingroup% + \addbefore@par{showDerivation}% + \use@par% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{ + \psplot@init + /x #1 def + /F@pstplot \ifPst@algebraic (#2) tx@AlgToPs begin AlgToPs end cvx \else { #2 } \fi def + /F@pstplotDerive \ifPst@algebraic (#3) tx@AlgToPs begin AlgToPs end cvx \else { #3 } \fi def + /newxVal { % y on stack + F@pstplotDerive % we have m + div neg %\pst@number\psxunit div % new x val = -y0/m + } def + }% + \gdef\psplot@init{}% + \@pstfalse% + \@nameuse{testqp@\psplotstyle}% + \addto@pscode{ + mark + x 0 \tx@ScreenCoor % start point + /n 2 def + #4 { + F@pstplot /yVal ED + x yVal \tx@ScreenCoor + /n n 2 add def + yVal newxVal x add /x ED + x 0 \tx@ScreenCoor + \ifPst@showDerivation /n n 4 add def \else moveto /n n 2 add def\fi + } repeat + pstack + }% + \@nameuse{endplot@\psplotstyle}% + \endgroup% + \ignorespaces} +\def\psNewton@iii#1#2#3{% #1:xStart #2:f(x) #3:number of iterations + \pst@killglue% + \begingroup% + \addbefore@par{VarStepEpsilon=0.01,showDerivation}% + \use@par% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{ + \psplot@init + /epsilon \psk@VarStepEpsilon\space def + /x #1 def + /F@pstplot \ifPst@algebraic (#2) tx@AlgToPs begin AlgToPs end cvx \else { #2 } \fi def + /newxVal { % y on stack + /saveX x def + saveX epsilon add /x ED F@pstplot saveX epsilon sub /x ED F@pstplot sub epsilon dup add div % we have m + div neg % new x val = -y0/m + /x saveX def + } def + }% + \gdef\psplot@init{}% + \@pstfalse% + \@nameuse{testqp@\psplotstyle}% + \addto@pscode{ + mark + x 0 \tx@ScreenCoor % start point + /n 2 def + #3 { + F@pstplot /yVal ED + x yVal \tx@ScreenCoor + yVal newxVal x add /x ED + x 0 \tx@ScreenCoor + \ifPst@showDerivation /n n 4 add def \else moveto /n n 2 add def\fi + } repeat + }% + \@nameuse{endplot@\psplotstyle}% + \endgroup% + \ignorespaces} +% \def\psResetPlotValues{% \psset{method={}}% }% diff --git a/Master/texmf-dist/tex/latex/pst-plot/pst-plot.sty b/Master/texmf-dist/tex/latex/pst-plot/pst-plot.sty index 466b97c4748..8113c9ff340 100644 --- a/Master/texmf-dist/tex/latex/pst-plot/pst-plot.sty +++ b/Master/texmf-dist/tex/latex/pst-plot/pst-plot.sty @@ -1,6 +1,8 @@ -% $Id: pst-plot.sty 265 2010-01-22 13:12:25Z herbert $ +% $Id: pst-plot.sty 485 2011-04-13 13:09:14Z herbert $ \RequirePackage{pstricks} -\ProvidesPackage{pst-plot}[2010/01/22 package wrapper for pst-plot.tex] +\RequirePackage{pst-xkey} +\RequirePackage{multido} +\ProvidesPackage{pst-plot}[2011/04/13 package wrapper for pst-plot.tex (hv)] \input{pst-plot.tex} \ProvidesFile{pst-plot.tex} [\filedate\space \fileversion\space `pst-plot' (tvz,hv)] |