From 06f7a405653fe4c505885607d76e5ad98a2b8da5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 11 Feb 2010 23:46:22 +0000 Subject: pstricks-add 0.14 (11feb10) git-svn-id: svn://tug.org/texlive/trunk@16971 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pstricks-add/Changes | 58 +- .../doc/generic/pstricks-add/pstricks-add-doc.pdf | Bin 2425244 -> 1674646 bytes .../doc/generic/pstricks-add/pstricks-add-doc.tex | 9184 ++++++-------------- .../texmf-dist/dvips/pstricks-add/pstricks-add.pro | 49 +- .../source/generic/pstricks-add/Makefile | 1 + .../texmf-dist/tex/generic/pstricks-add/pst-fp.tex | 701 -- .../tex/generic/pstricks-add/pstricks-add.tex | 2423 +----- .../tex/latex/pstricks-add/pstricks-add.sty | 7 +- 8 files changed, 2997 insertions(+), 9426 deletions(-) delete mode 100644 Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/pstricks-add/Changes b/Master/texmf-dist/doc/generic/pstricks-add/Changes index 6b5992028dc..e9336c7bce3 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/Changes +++ b/Master/texmf-dist/doc/generic/pstricks-add/Changes @@ -1,41 +1,47 @@ -%% $Id: Changes 155 2009-11-30 07:58:45Z herbert $ +%% $Id: Changes 259 2010-01-17 09:51:50Z herbert $ %% pstricks-add.pro ----------- - v 0.22 2009-03-17 - add LineByHand stuff - v 0.21 2008-10-13 - add bubblesort macro - v 0.20 2008-01-12 - moved the AlgParser into pst-algparser.pro - - moved Pyth2 and tan into pstricks.pro - v 0.14 2007-09-17 - moved Pyth2 into tx@Add part - v 0.13 2007-09-12 - temporarely version for \psbrace, code +0.23 2009-12-20 - add RGBtoGRAY and WavelengthToGRAY + - intiialize the random generator with realtime +0.22 2009-03-17 - add LineByHand stuff +0.21 2008-10-13 - add bubblesort macro +0.20 2008-01-12 - moved the AlgParser into pst-algparser.pro + - moved Pyth2 and tan into pstricks.pro +0.14 2007-09-17 - moved Pyth2 into tx@Add part +0.13 2007-09-12 - temporarely version for \psbrace, code will later go into pstricks.pro - v 0.12 2007-09-03 - Added - RGBtoGRAY, CMYKtoGRAY, HSBtoGRAY (hv) - v 0.11 2007-06-23 - Added wavelengthToCMYK routine (hv) - - RGBtoCMYK - v 0.10 2006-10-15 - bug correction, x^-1 (dr) - - Constants into tx@Dict to make them global (hv) - - small stuff (hv) - - define tan - v 0.09 2006-10-10 cvi for the wavelength to get an integer (hv) - v 0.08 2006-06-17 more improvements to the code (hv) - v 0.07 2006-04-03 remove whitespace (dr) - v 0.06 2006-01-16 EXP -> Exp, to prevent missmatch with pst-math (hv) - v 0.05 2005-11-12 fix bug in GTriangle (hv) - v 0.04 2005-10-06 added subroutines for calculating wavelength to rgb color(hv) +0.12 2007-09-03 - Added + RGBtoGRAY, CMYKtoGRAY, HSBtoGRAY (hv) +0.11 2007-06-23 - Added wavelengthToCMYK routine (hv) + - RGBtoCMYK +0.10 2006-10-15 - bug correction, x^-1 (dr) + - Constants into tx@Dict to make them global (hv) + - small stuff (hv) + - define tan +0.09 2006-10-10 cvi for the wavelength to get an integer (hv) +0.08 2006-06-17 more improvements to the code (hv) +0.07 2006-04-03 remove whitespace (dr) +0.06 2006-01-16 EXP -> Exp, to prevent missmatch with pst-math (hv) +0.05 2005-11-12 fix bug in GTriangle (hv) +0.04 2005-10-06 added subroutines for calculating wavelength to rgb color(hv) changing name of pst-eqdf.pro to pstricks-add.pro - v 2005.03 2005/05/16 (hv) small changes to the code - v 2005.02 2005/03/05 (dr) white space removal from expression - v 2004.02 2004/11/14 (dr) correction of a priority problem ^ before unary - (new rule FS) - v 2004.01 2004/09/14 (dr) initial version +2005.03 2005/05/16 (hv) small changes to the code +2005.02 2005/03/05 (dr) white space removal from expression +2004.02 2004/11/14 (dr) correction of a priority problem ^ before unary - (new rule FS) +2004.01 2004/09/14 (dr) initial version pstricks-add.sty ----------- (hv) + v. 0.14 2010-02-11 move pst-fp message into pstricks.sty v. 0.13 2009-04-17 change pro file version number v. 0.12 2007-11-18 change pro file version number v. 0.11 2007-09-04 add a message for loading the prolouge file pstrick-add.pro pstricks-add.tex ----------- (Dominik Rodriguez/hv) + v 3.38 2009-12-13 - moved \Pst@algebraic into the base pstricks.tex + - add SAveFinalState for plots + v 3.37 2009-12-01 - fix bug with Tnormal in \psPlotTangent v 3.36 2009-11-14 - fix bug with missing \def\pst@par in objects - add \pstGetDistance v 3.35 2009-08-13 - fix bug with trailing space in \psaxes@vi @@ -244,6 +250,8 @@ pstricks-add.tex ----------- (Dominik Rodriguez/hv) pst-fp.tex ----------- (hv) + v 0.05 2010-01-17 add \pst@Int + add \pst@int v 0.04 2009-11-24 add \pstFPadd v 0.03 2009-11-14 add \pstFPmul v 0.02 2009-04-02 initial version diff --git a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf index 9bc199cd856..f241af37d7b 100644 Binary files a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf and b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex index 642390ab7f1..72901032fcb 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex +++ b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add-doc.tex 149 2009-11-14 09:11:05Z herbert $ +%% $Id: pstricks-add-doc.tex 288 2010-02-11 15:43:29Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings headexclude,footexclude,oneside]{pst-doc} \listfiles @@ -6,89 +6,22 @@ \input{pstricks-add-doc.dat} \usepackage[utf8]{inputenc} -\usepackage{pst-eucl,pst-fun,multirow} \usepackage{pstricks-add} -\usepackage{pifont} \let\pstricksaddFV\fileversion +\usepackage{pst-eucl,pst-fun,pst-func,multirow} +\usepackage{pifont} \let\belowcaptionskip\abovecaptionskip % -\newcommand{\pstEllipse}[5][]{% - \psset{#1} - \parametricplot{#4}{#5}{#2\space t cos mul #3\space t sin mul}% -} -% -\newcommand{\pstEllipseWedge}[5][]{% - \psset{#1} - \pscustom{% - \parametricplot{#4}{#5}{#2\space t cos mul #3\space t sin mul}% - \psline(! #2\space #5\space cos mul #3\space #5\space sin mul)% - (0,0)% - (! #2\space #4\space cos mul #3\space #4\space sin mul)% - }% -} -% \def\textat{\char064}% \newdimen\fullWidth \makeatletter -\renewcommand\ON{% - \gdef\lst@alloverstyle##1{% - \fboxrule=0pt - \fboxsep=0pt - \fcolorbox{DarkBlue}{DarkBlue}{\textcolor{white}{\bfseries\strut##1}}% -}} -\renewcommand\OFF{\xdef\lst@alloverstyle##1{##1}} -\define@key[psset]{}{PSfont}[Times-Roman]{\def\psk@PSfont{/#1 }} -\define@key[psset]{}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth } -\define@key[psset]{}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale } -\define@key[psset]{}{decimals}[-1]{\pst@getint{#1}\psk@decimals } -\psset{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1} -\define@key[psset]{}{xShift}[0]{\def\psk@xShift{#1 }} -\psset{xShift=0} -% -\def\psPrintValue{\pst@object{psPrintValue}} -\def\psPrintValue@i#1{% - \begin@SpecialObj - \addto@pscode{ - gsave \psk@PSfont findfont \psk@fontscale scalefont setfont - #1 \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if - \psk@valuewidth string cvs \psk@xShift 0 moveto show grestore - }% - \end@SpecialObj% -} -\renewcommand*\l@section[2]{% - \ifnum \c@tocdepth >\z@ - \ifnum \lastpenalty<20009 - \addpenalty{\@secpenalty}% - \fi - \addvspace{1.0em \@plus\p@}% - \setlength\@tempdima{2.5em}% - \if@tocleft - \ifx\toc@l@number\@empty\else - \setlength\@tempdima{0\toc@l@number}% - \fi - \fi - \begingroup - \raggedsectionentry - \parindent \z@ \advance\rightskip \@pnumwidth - \parfillskip -\@pnumwidth - \interlinepenalty\@M - \leavevmode - \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip - \usekomafont{sectionentry}{#1\nobreak - \usekomafont{sectionentrypagenumber}{% - \hfill\nobreak - \hb@xt@\@pnumwidth{\hss#2}}}\par - \endgroup - \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax - \penalty20008 - \fi - \fi -} -\renewcommand*\l@subsection{\bprot@dottedtocline{2}{1.5em}{3.6em}} -\renewcommand*\l@subsubsection{\bprot@dottedtocline{3}{3.8em}{4.5em}} -\renewcommand*\l@paragraph{\bprot@dottedtocline{4}{7.0em}{5em}} +\renewcommand*\l@section{\@dottedtocline{1}{2em}{2.3em}} +\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}} +\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}} +\renewcommand*\l@paragraph{\@dottedtocline{4}{10em}{5em}} \makeatother -\lstset{escapechar=§} +\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}}, + escapechar=§} \def\bgImage{\psset{unit=1.5} \begin{pspicture}(-3,-3)(3,3) @@ -124,6 +57,8 @@ \advance\fullWidth by \marginparsep \advance\fullWidth by \marginparwidth +\fileversion + \begin{abstract} This version of \verb+pstricks-add+ needs \verb+pstricks.tex+ version >1.04 from June 2004, otherwise the additional macros may @@ -176,197 +111,10 @@ Timothy Van Zandt \clearpage \tableofcontents -\clearpage -%-------------------------------------------------------------------------------------- -\part{\texttt{pstricks}} -%-------------------------------------------------------------------------------------- - -%-------------------------------------------------------------------------------------- -\section{Numeric functions} -%-------------------------------------------------------------------------------------- - -All macros have a \textat{} in their name, because they are -only for internal use, but it is no problem to use them like other -macros. One can define another name without a \textat{}: -\begin{lstlisting}[style=syntax] -\makeatletter -\let\pstdivide\pst@divide -\makeatother -\end{lstlisting} - -or put the macro inside the \Lcs{makeatletter} -- -\Lcs{makeatother} sequence. - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@divide}} -%-------------------------------------------------------------------------------------- - -\LPack{pstricks} itself has its own divide macro, called -\Lcs{pst@divide}, which can divide two lengths and save the -quotient as a \Index{floating point} number: \index{Division} -% -\begin{BDef} -\Lcs{pst@divide}\Largb{dividend}\Largb{divisor}\Largb{result as a macro} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\makeatletter -\pst@divide{34pt}{6pt}\quotient \quotient\\ -\pst@divide{-6pt}{34pt}\quotient \quotient -\makeatother -\end{LTXexample} - -\noindent this gives the output $5.66666$. The result is not a length! - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@mod}} -%-------------------------------------------------------------------------------------- -\LPack{pstricks-add} defines an additional numeric function for the modulus: -\index{Modulus} - -\begin{BDef} -\Lcs{pst@mod}\Largb{integer}\Largb{integer}\Largb{result as a macro} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\makeatletter -\pst@mod{34}{6}\modulo \modulo\\ -\pst@mod{25}{-6}\modulo \modulo -\makeatother -\end{LTXexample} - -\noindent this gives the output $4$. Using this internal numeric -function in documents requires a setting inside the -\verb+makeatletter+ and \verb+makeatother+ environment. It makes -some sense to define a new macroname in the preamble and use it -throughout, e.g. \verb+\let\modulo\pst@mod+. - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@max}} -%-------------------------------------------------------------------------------------- - -\begin{BDef} -\Lcs{pst@max}\Largb{integer}\Largb{integer}\Largb{result as count register} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\newcount\maxNo -\makeatletter -\pst@max{-34}{-6}\maxNo \the\maxNo\\ -\pst@max{0}{11}\maxNo \the\maxNo -\makeatother -\end{LTXexample} - - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@maxdim}} -%-------------------------------------------------------------------------------------- - -\begin{BDef} -\Lcs{pst@maxdim}\Largb{dimension}\Largb{dimension}\Largb{result as a dimension register} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\newdimen\maxDim -\makeatletter -\pst@maxdim{34cm}{1234pt}\maxDim \the\maxDim\\ -\pst@maxdim{34cm}{123pt}\maxDim \the\maxDim -\makeatother -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@mindim}} -%-------------------------------------------------------------------------------------- - -\begin{BDef} -\Lcs{pst@mindim}\Largb{dimension}\Largb{dimension}\Largb{result as dimension register} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\newdimen\minDim -\makeatletter -\pst@mindim{34cm}{1234pt}\minDim \the\minDim\\ -\pst@mindim{34cm}{123pt}\minDim \the\minDim -\makeatother -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@abs}} -%-------------------------------------------------------------------------------------- - -\begin{BDef} -\Lcs{pst@abs}\Largb{integer}\Largb{result as a count register} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\newcount\absNo -\makeatletter -\pst@abs{-34}\absNo \the\absNo\\ -\pst@abs{4}\absNo \the\absNo -\makeatother -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@absdim}} -%-------------------------------------------------------------------------------------- -\begin{BDef} -\Lcs{pst@absdim}\Largb{dimension}\Largb{result as a dimension register} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\newdimen\absDim -\makeatletter -\pst@absdim{-34cm}\absDim \the\absDim\\ -\pst@absdim{4sp}\absDim \the\absDim -\makeatother -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pst@int}} -%-------------------------------------------------------------------------------------- -\begin{BDef} -\Lcs{pst@int}\Largb{number}\Largb{result as a truncated integer} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\makeatletter -\pst@int{-34.0}\\ -\pst@int{234.123} -\makeatother -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{pstFPMul} and \nxLcs{pstFPDiv}} -%-------------------------------------------------------------------------------------- -Integer multiplication and division: - -\begin{BDef} -\Lcs{pstFPMul}\Largb{result as a truncated integer}\Largb{number}\Largb{number}\\ -\Lcs{pstFPDiv}\Largb{result as a truncated integer}\Largb{number}\Largb{number} -\end{BDef} - -\begin{LTXexample}[width=2cm] -\makeatletter -\pstFPMul\Result{-3.405}{0.02345} \Result\quad -\pstFPDiv\Result{-3.405}{0.02345} \Result\\ -\pstFPMul\Result{0.02345}{-3.405} \Result\quad -\pstFPDiv\Result{0.02345}{-3.405} \Result\\ -\pstFPMul\Result{234.123}{33} \Result\quad -\pstFPDiv\Result{234.123}{33} \Result -\makeatother -\end{LTXexample} - -You can also use the default operations like \nxLcs{pstFPmul}, \nxLcs{pstFPdiv} -and \Lcs{pstFPadd} (always with a lower case letter!) -\begin{BDef} -\Lcs{pstFPadd}\Largb{result}\Largb{number}\Largb{number}\\ -\Lcs{pstFPmul}\Largb{result}\Largb{number}\Largb{number}\\ -\Lcs{pstFPdiv}\Largb{result}\Largb{number}\Largb{number} -\end{BDef} +\clearpage -%-------------------------------------------------------------------------------------- -\subsection{\nxLcs{psGetSlope} and \nxLcs{psGetDistance}} +\section{\nxLcs{psGetSlope} and \nxLcs{psGetDistance}} %-------------------------------------------------------------------------------------- \begin{BDef} @@ -386,36 +134,13 @@ and \Lcs{pstFPadd} (always with a lower case letter!) \end{LTXexample} \clearpage -%-------------------------------------------------------------------------------------- -\section{Dashed Lines} -%-------------------------------------------------------------------------------------- -Tobias Nähring has implemented an enhanced feature for dashed -lines. The number of arguments is no longer limited. - -\begin{BDef} -\Lkeyword{dash}=value1\OptArg*{unit} value2\OptArg*{unit} \ldots -\end{BDef} - -\begin{LTXexample}[width=0.4\linewidth] -\psset{linewidth=2.5pt,unit=0.6} -\begin{pspicture}(-5,-4)(5,4) - \psgrid[subgriddiv=0,griddots=10,gridlabels=0pt] - \psset{linestyle=dashed} - \pscurve[dash=5mm 1mm 1mm 1mm,linewidth=0.1](-5,4)(-4,3)(-3,4)(-2,3) - \psline[dash=5mm 1mm 1mm 1mm 1mm 1mm 1mm 1mm 1mm 1mm](-5,0.9)(5,0.9) - \psccurve[linestyle=solid](0,0)(1,0)(1,1)(0,1) - \psccurve[linestyle=dashed,dash=5mm 2mm 0.1 0.2,linetype=0](0,0)(-2.5,0)(-2.5,-2.5)(0,-2.5) - \pscurve[dash=3mm 3mm 1mm 1mm,linecolor=red,linewidth=2pt](5,-4)(5,2)(4.5,3.5)(3,4)(-5,4) -\end{pspicture} -\end{LTXexample} -\clearpage %-------------------------------------------------------------------------------------- \section{"`Handmade"' lines :-)} %-------------------------------------------------------------------------------------- \begin{BDef} -\Lcs{pslineByHand}\OptArgs\Largr(\coord1)\Largr(\coord2)\Largr(\coord3) \ldots +\Lcs{pslineByHand}\OptArgs\coord1\coord2\coord3 \ldots \end{BDef} \begin{LTXexample}[width=0.4\linewidth] @@ -449,6 +174,16 @@ lines. The number of arguments is no longer limited. \end{pspicture} \end{LTXexample} +The amplitude and the width can be changed by the optional arguments \Lkeyword{varsteptol} and +\Lkeyword{VarStepEpsilon}. Both are preset to \verb+VarStepEpsilon=2,varsteptol=0.8+. + + +\begin{LTXexample}[pos=t] +\begin{pspicture}(\linewidth,3) +\multido{\rA=0.00+0.25}{12}{% + \pslineByHand[linecolor=blue,VarStepEpsilon=4,varsteptol=2](0,\rA)(\linewidth,\rA)} +\end{pspicture} +\end{LTXexample} \clearpage @@ -505,12 +240,12 @@ only valid if they are part of the \verb+\pscustom+ macro. \begin{LTXexample}[width=6cm] +\begin{pspicture}(-1,-1)(3,6) \def\canne{% Idea by Manuel Luque \psgrid[subgriddiv=0](-1,0)(1,5) \pscustom[linewidth=2mm]{\psline(0,4)\psarcn(0.3,4){0.3}{180}{360}}% \pscircle*(0.6,4){0.1}\pstriangle*(0,0)(0.2,-0.3)} \def\Object{} -\begin{pspicture}(-1,-1)(3,6) \canne \psrotate(0.3,4){45}{\psset{linecolor=red!50}\canne} \psrotate(0.3,4){90}{\psset{linecolor=blue!50}\canne} @@ -521,10 +256,10 @@ only valid if they are part of the \verb+\pscustom+ macro. \begin{LTXexample}[pos=t] +\begin{pspicture}(0,-6)(15,5) \def\majorette{\psline[linewidth=0.5mm](0,2)% Idea by Manuel Luque \pscircle[fillstyle=solid]{0.1} \pscircle[fillstyle=solid](0,2){0.1}} -\begin{pspicture}(0,-6)(15,5) \psaxes[linewidth=0.5pt]{->}(0,0)(0,-5)(15,5) \pstVerb{/V0 10 def /Alpha 45 def}% vitesse initiale, angle de lancement \multido{\nT=0.0+0.05,\iA=0+40}{41}{% @@ -539,6 +274,7 @@ only valid if they are part of the \verb+\pscustom+ macro. \end{pspicture} \end{LTXexample} + \clearpage %-------------------------------------------------------------------------------------- @@ -627,7 +363,7 @@ and can be used by the user for coloring lines or text. \begin{LTXexample}[width=6cm] \begin{pspicture}(-3,-3)(3,3) -\psChart[chartColor=color]{ 45, 90 }{ 1 }{2} +\psChart[chartColor=color]{45,90}{1}{2} \ncline[linecolor=-chartFillColor1, nodesepB=-20pt]{psChartO1}{psChart1} \rput[l](psChartO1){% @@ -686,6 +422,7 @@ and can be used by the user for coloring lines or text. \rput(psChartI4){Car}\rput(psChartI5){Gas}\rput(psChartI6){Food} \end{pspicture} %\end{LTXexample} +\psset{unit=1cm} \begin{lstlisting} \psset{unit=1.5} @@ -736,33 +473,10 @@ and can be used by the user for coloring lines or text. %-------------------------------------------------------------------------------------- \section{\nxLcs{psbrace}} %-------------------------------------------------------------------------------------- -\subsection{Syntax} \begin{BDef} \LcsStar{psbrace}\OptArgs\Largr{A}\Largr{B}\Largb{text} \end{BDef} - -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,4) -\psgrid[subgriddiv=0,griddots=10] -\pnode(0,0){A} -\pnode(4,4){B} -\psbrace[linecolor=red,ref=lC](A)(B){Text I} -\psbrace*[linecolor=blue,ref=lC](3,4)(0,1){Text II} -\psbrace[fillcolor=white](3,0)(3,4){III} -\end{pspicture} -\end{LTXexample} - -\bigskip -The option \Lcs{specialCoor} is enabled, so that all types of coordinates -are possible, (nodename), ($x,y$), ($nodeA|nodeB$), \ldots -The star version fills the inner of the \Index{brace} with the current linecolor. -With the fillcolor \verb+white+ or any other background color the brace can -be "`unfilled"'. -%-------------------------------------------------------------------------------------- -\subsection{Options} -%-------------------------------------------------------------------------------------- - Additional to all other available options from \LPack{pstricks} or the other related packages, there are two new option, named \Lkeyword{braceWidth} and \Lkeyword{bracePos}. All important ones are shown in the following graphics @@ -811,9 +525,25 @@ reference point can be any value of the combination of \Lkeyval{l} (Baseline) or \Lkeyval{C} (center) or \Lkeyval{t} (top), where the default is \Lkeyval{c}, the center of the object. -%-------------------------------------------------------------------------------------- -%\subsection{Examples} -%-------------------------------------------------------------------------------------- + + +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,4) +\psgrid[subgriddiv=0,griddots=10] +\pnode(0,0){A} +\pnode(4,4){B} +\psbrace[linecolor=red,ref=lC](A)(B){Text I} +\psbrace*[linecolor=blue,ref=lC](3,4)(0,1){Text II} +\psbrace[fillcolor=white](3,0)(3,4){III} +\end{pspicture} +\end{LTXexample} + +\bigskip +The option \Lcs{specialCoor} is enabled, so that all types of coordinates +are possible, (nodename), ($x,y$), ($nodeA|nodeB$), \ldots +The star version fills the inner of the \Index{brace} with the current linecolor. +With the fillcolor \verb+white+ or any other background color the brace can +be "`unfilled"'. \begin{LTXexample} \begin{pspicture}(8,2.5) @@ -891,11 +621,13 @@ default is \Lkeyval{c}, the center of the object. \end{LTXexample} +\clearpage It is also possible to put a vertical brace around a default paragraph. This works by setting two invisible nodes at the beginning and the end of the paragraph. Indentation is possible with a minipage. +\small Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. @@ -933,6 +665,8 @@ Some nonsense text, which is nothing more than nonsense. \noindent\rnode{B}{}\psbrace[linecolor=red](A)(B){} \end{minipage} +\normalsize + \begin{lstlisting} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. @@ -973,6 +707,7 @@ Some nonsense text, which is nothing more than nonsense. \clearpage + %-------------------------------------------------------------------------------------- \section{Random dots} %-------------------------------------------------------------------------------------- @@ -1037,7 +772,7 @@ name & default\\\hline \clearpage %-------------------------------------------------------------------------------------- -\section{Dice} +\section{\nxLcs{psDice}} %-------------------------------------------------------------------------------------- \Lcs{psdice} creates the view of a dice. The number on the dice is the only parameter. The optional parameters, like the color can be used as usual. The macro is a box of @@ -1084,6598 +819,3463 @@ the dice $1\mathrm{cm}\times1\mathrm{cm}$. \clearpage %-------------------------------------------------------------------------------------- -\section{Arrows} -%-------------------------------------------------------------------------------------- -\subsection{Definition} +\section{\nxLcs{psFormatInt}} %-------------------------------------------------------------------------------------- -\LPack{pstricks-add} defines the following "`arrows"': +There exist some packages and a lot of code to format an integer like $1\,000\,000$ +or $1,234,567$ (in Europe $1.234.567$). But all packages expect a real number as +argument and cannot handle macros as an argument. For this case \LPack{pstricks-add} +has a macro \Lcs{psFormatInt} which can handle both: -\begin{center} - \bgroup - \def\myline#1{\psline[linecolor=red,linewidth=0.5pt,arrowscale=1.5]{#1}(0,1ex)(1.3,1ex)}% - \psset{arrowscale=1.5} - \begin{tabular}{@{} c @{\qquad} p{3cm} l @{}}% - Value & Example & Name \\[2pt]\hline - \Lnotation{-} & \myline{-} & None\\ - \Lnotation{<->} & \myline{<->} & Arrowheads.\\ - \Lnotation{>-<} & \myline{>-<} & Reverse arrowheads.\\ - \Lnotation{<{<}-{>}>} & \myline{<<->>} & Double arrowheads.\\ - \Lnotation{{>}>-{<}<} & \myline{>>-<<} & Double reverse arrowheads.\\ - \Lnotation{{|}-{|}} & \myline{|-|} & T-bars, flush to endpoints.\\ - \Lnotation{{|}*-{|}*} & \myline{|*-|*} & T-bars, centered on endpoints.\\ - \Lnotation{[-]} & \myline{[-]} & Square brackets.\\ - \Lnotation{]-[} & \myline{]-[} & Reversed square brackets.\\ - \Lnotation{(-)} & \myline{(-)} & Rounded brackets.\\ - \Lnotation{)-(} & \myline{)-(} & Reversed rounded brackets.\\ - \Lnotation{o-o} & \myline{o-o} & Circles, centered on endpoints.\\ - \Lnotation{*-*} & \myline{*-*} & Disks, centered on endpoints.\\ - \Lnotation{oo-oo} & \myline{oo-oo} & Circles, flush to endpoints.\\ - \Lnotation{**-**} & \myline{**-**} & Disks, flush to endpoints.\\ - \Lnotation{{|}<->{|}} & \myline{|<->|} & T-bars and arrows.\\ - \Lnotation{{|}>-<{|}} & \myline{|>-<|} & T-bars and reverse arrows.\\ - \Lnotation{h-h{|}} & \myline{h-h} & left/right hook arrows.\\ - \Lnotation{H-H{|}} & \myline{H-H} & left/right hook arrows.\\ - \Lnotation{v-v|} & \myline{v-v} & left/right inside vee arrows.\\ - \Lnotation{V-V|} & \myline{V-V} & left/right outside vee arrows.\\ - \Lnotation{f-f|} & \myline{f-f} & left/right inside filled arrows.\\ - \Lnotation{F-F|} & \myline{F-F} & left/right outside filled arrows.\\ - \Lnotation{t-t|} & \myline{t-t} & left/right inside slash arrows.\\[5pt] - \Lnotation{T-T|} & \myline{T-T} & left/right outside slash arrows.\\ - \end{tabular} - \egroup -\end{center} +\begin{LTXexample}[width=3cm] +\psFormatInt{1234567}\\ +\psFormatInt[intSeparator={,}]{1234567}\\ +\psFormatInt[intSeparator=.]{1234567}\\ +\psFormatInt[intSeparator=$\cdot$]{1234567}\\ +\def\temp{965432} +\psFormatInt{\temp} +\end{LTXexample} +With the option \Lkeyword{intSeparator} the symbol can be changed to any any non-number character. -You can also mix and match, e.g., \Lnotation{->}, \Lnotation{*-)} and \Lnotation{[->} are all valid values -of the \Lkeyword{arrows} parameter. The parameter can be set with +\clearpage + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{psRelNode} and \nxLcs{psDefPSPNodes}} +%-------------------------------------------------------------------------------------- +With these macros it is possible to put a node relative to a given line or given +\Lenv{pspicture}-environment. In the frist case the parameters are +the angle and the length factor: \begin{BDef} -\Lcs{psset}\Largb{arrows=} +\Lcs{psRelNode}\Largs{P0}\Largs{P1}\Largb{length factor}\Largb{end node name}\\ +\Lcs{psDefPSPNodes} \end{BDef} -\noindent or for some macros with a special option, like\\[5pt] -\noindent\verb|\psline[]{}(A)(B)|\\ -\noindent\verb/\psline[linecolor=red,linewidth=2pt]{|->}(0,0)(0,2)/ \ \psline[linecolor=red,linewidth=2pt]{|->}(0,0)(0,2) - -\subsection{Multiple arrows} -There are two new options which are only valid for the arrow type \verb+<<+ or \verb+>>+. -\verb+nArrow+ sets both, the \verb+nArrowA+ and the \verb+nArrowB+ parameter. The meaning -is declared in the following tables. Without setting one of these parameters the behaviour -is like the one described in the old PSTricks manual. - -\begin{center} -\begin{tabular}{@{}lc@{}}% - Value & Meaning \\[2pt]\hline - \Lnotation{-{>}>} & \ -A \\ - \Lnotation{{<}<-{>}>} & A-A\\ - \Lnotation{{<}<-} & A-\ \\ - \Lnotation{{>}>-} & B-\ \\ - \Lnotation{-{<}<} & \ -B\\ - \Lnotation{{>}>-{<}<} & B-B\\ - \Lnotation{{>}>-{>}>} & B-A\\ - \Lnotation{{<}<-{<}<} & A-B - \end{tabular} -\end{center} - - +The length factor relates to the distance $\overline{P_0P_1}$ and +the end node name must be a valid nodename and shouldn't contain +any of the special PostScript characters. There are two valid +options: +\begin{tabularx}{\linewidth}{@{} l|l| X @{} } +name & default & meaning\\\hline +\Lkeyword{angle} & $0$ & angle between the given line $\overline{P_0P_1}$ and the new one + $\overline{P_0P_{endNode}}$\tabularnewline +\Lkeyword{trueAngle} & \false & defines whether the angle refers to the seen line or to +the mathematical one, which respect the scaling factors +\Lkeyword{xunit} and \Lkeyword{yunit}. +\end{tabularx} -\begin{center} - \bgroup - \psset{linecolor=red,linewidth=1pt,arrowscale=2}% - \begin{tabular}{lp{2.8cm}}% - Value & Example \\[2pt]\hline - \verb+\psline{->>}(0,1ex)(2.3,1ex)+ & \psline{->>}(0,1ex)(2.3,1ex) \\ - \verb+\psline[nArrowsA=3]{->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{->>}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=5]{->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{->>}(0,1ex)(2.3,1ex)\\ - \verb+\psline{<<-}(0,1ex)(2.3,1ex)+ & \psline{<<-}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=3]{<<-}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{<<-}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=5]{<<-}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{<<-}(0,1ex)(2.3,1ex)\\ - \verb+\psline{<<->>}(0,1ex)(2.3,1ex)+ & \psline{<<->>}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=3]{<<->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{<<->>}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=5]{<<->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{<<->>}(0,1ex)(2.3,1ex)\\ - \verb+\psline{<<-|}(0,1ex)(2.3,1ex)+ & \psline{<<-|}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=3]{<<-<<}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{<<-<<}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=5]{<<-o}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{<<-o}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=3,nArrowsB=4]{<<-<<}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3,nArrowsB=4]{<<-<<}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=3,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)\\ - \verb+\psline[nArrowsA=1,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=1,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)\\ - \end{tabular} - \egroup -\end{center} +\begin{LTXexample}[width=7cm] +\begin{pspicture}[showgrid](7,6) + \pnode(3,3){A}\pnode(4,2){B} + \psline[nodesep=-3,linewidth=0.5pt](A)(B) + \multido{\iA=0+30}{12}{% + \psRelNode[angle=\iA](A)(B){2}{C}% + \qdisk(C){2pt} + \uput[0](C){\iA}} +\end{pspicture} +\end{LTXexample} +In the second case the new macro \Lcs{psDefPSPNodes} defines nine nodes that corresponds to +nine particular points (namely bottom left, bottom center, +bottom right, center left, center center, center right, top left, +top center, top right) of the \Lenv{pspicture} box. +\begin{LTXexample}[width=6cm,wide=false] +\begin{pspicture}[showgrid=true](-1,-1)(4,4) + \psDefPSPNodes + \psdots(PSPbl)(PSPbc)(PSPbr) + (PSPcl)(PSPcc)(PSPcr)(PSPtl)(PSPtc)(PSPtr) + \uput[90](PSPbl){PSPbl} \uput[90](PSPbc){PSPbc} + \uput[90](PSPbr){PSPbr} \uput[90](PSPcl){PSPcl} + \uput[90](PSPcc){PSPcc} \uput[90](PSPcr){PSPcr} + \uput[90](PSPtl){PSPtl} \uput[90](PSPtc){PSPtc} + \uput[90](PSPtr){PSPtr} +\end{pspicture} +\end{LTXexample} -\subsection{\texttt{hookarrow}} -%\begin{LTXexample} -\bgroup -\psset{arrowsize=8pt,arrowlength=1,linewidth=1pt,nodesep=2pt,shortput=tablr} -\large -\begin{psmatrix}[colsep=12mm,rowsep=10mm] - & & $R_2$ \\ - & & 0 & & $R_3$\\ -$e_b:S$ & 1 & & 1 & 0 \\ - & & 0 \\ - & & $R_1$ \\ -\end{psmatrix} -\ncline{h-}{1,3}{2,3}<{$e_{r2}$}>{$f_{r2}$} -\ncline{-h}{2,3}{3,2}<{$e_1$} -\ncline{-h}{3,1}{3,2}^{$e_s$}_{$f_{s}$} -\ncline{-h}{3,2}{4,3}>{$e_3$}<{$f_3$} -\ncline{-h}{4,3}{3,4}>{$e_4$}<{$f_4$} -\ncline{-h}{3,4}{2,3}>{$e_2$}<{$f_2$} -\ncline{-h}{3,4}{3,5}^{$e_5$} -\ncline{-h}{3,5}{2,5}<{$e_{r3}$}>{$f_{r3}$} -\ncline{-h}{4,3}{5,3}<{$e_{r1}$}>{$f_{r1}$} -%\end{LTXexample} -\egroup +The name of the nodes are predefined as: -\begin{lstlisting} -\psset{arrowsize=8pt,arrowlength=1,linewidth=1pt,nodesep=2pt,shortput=tablr} -\large -\begin{psmatrix}[colsep=12mm,rowsep=10mm] - & & $R_2$ \\ - & & 0 & & $R_3$\\ -$e_b:S$ & 1 & & 1 & 0 \\ - & & 0 \\ - & & $R_1$ \\ -\end{psmatrix} -\ncline{h-}{1,3}{2,3}<{$e_{r2}$}>{$f_{r2}$}\ncline{-h}{2,3}{3,2}<{$e_1$} -\ncline{-h}{3,1}{3,2}^{$e_s$}_{$f_{s}$} \ncline{-h}{3,2}{4,3}>{$e_3$}<{$f_3$} -\ncline{-h}{4,3}{3,4}>{$e_4$}<{$f_4$} \ncline{-h}{3,4}{2,3}>{$e_2$}<{$f_2$} -\ncline{-h}{3,4}{3,5}^{$e_5$} -\ncline{-h}{3,5}{2,5}<{$e_{r3}$}>{$f_{r3}$} -\ncline{-h}{4,3}{5,3}<{$e_{r1}$}>{$f_{r1}$} +\begin{lstlisting}[style=syntax] +\psset[pst-PSPNodes]{blName=PSPbl,bcName=PSPbc,brName=PSPbr, + clName=PSPcl,ccName=PSPcc,crName=PSPcr,tlName=PSPtl,tcName=PSPtc,trName=PSPtr} \end{lstlisting} +and can be modified in the same way. +%I guess you modified the family to have the pstricks-add one so the +%\xkvview would have to be adapted. +%-------------------------------------------------------------------------------------- +\section{\nxLcs{psRelLine}} +%-------------------------------------------------------------------------------------- +With this macro it is possible to plot lines relative to a given one. Parameter are +the angle and the length factor: -\subsection{\texttt{hookrightarrow} and \texttt{hookleftarrow}} -This is another type of arrow and is abbreviated with \Lnotation{H}. -The length and width of the hook is set by the new options -\Lkeyword{hooklength} and \Lkeyword{hookwidth}, which are by default set -to -% \begin{BDef} -\Lcs{psset}\Largb{hooklength=3mm,hookwidth=1mm} +\Lcs{psRelLine}\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{}\\ +\Lcs{psRelLine}\OptArg{\Largb{arrows}}\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{end node name}\\ +\Lcs{psRelLine}\OptArgs\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{end node name}\\ +\Lcs{psRelLine}\OptArgs\OptArg{\Largb{arrows}}\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{end node name} \end{BDef} -% -If the line begins with a right hook then the line ends with a left hook and vice versa: -\begin{LTXexample}[width=3cm] -\begin{pspicture}(3,4) -\psline[linewidth=5pt,linecolor=blue,hooklength=5mm,hookwidth=-3mm]{H->}(0,3.5)(3,3.5) -\psline[linewidth=5pt,linecolor=red,hooklength=5mm,hookwidth=3mm]{H->}(0,2.5)(3,2.5) -\psline[linewidth=5pt,hooklength=5mm,hookwidth=3mm]{H-H}(0,1.5)(3,1.5) -\psline[linewidth=1pt]{H-H}(0,0.5)(3,0.5) +The length factor relates to the distance $\overline{P_0P_1}$ and +the end node name must be a valid nodename and shouldn't contain +any of the special PostScript characters. There are two valid +options which are described in the foregoing section for +\Lcs{psRelNode}. + +The following two figures show the same, the first one with a scaling different to $1:1$, +this is the reason why the end points are on an ellipse and not on a circle like in the +second figure. + +\begin{LTXexample}[width=5cm] +\psset{yunit=2,xunit=1} +\begin{pspicture}(-2,-2)(3,2) +\psgrid[subgriddiv=2,subgriddots=10,gridcolor=lightgray] +\pnode(-1,0){A}\pnode(3,2){B} +\psline[linecolor=red](A)(B) +\psRelLine[linecolor=blue,angle=30](-1,0)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=blue,angle=-30](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=magenta,angle=90](-1,0)(3,2){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=magenta,angle=-90](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} \end{pspicture} \end{LTXexample} - -\begin{LTXexample}[width=7.25cm] -$\begin{psmatrix} -E&W_i(X)&&Y\\ -&&W_j(X) -\psset{arrows=->,nodesep=3pt,linewidth=2pt} -\everypsbox{\scriptstyle} -\ncline[linecolor=red,arrows=H->,% - hooklength=4mm,hookwidth=2mm]{1,1}{1,2} -\ncline{1,2}{1,4}^{\tilde{t}} -\ncline{1,2}{2,3}<{W_{ij}} -\ncline{2,3}{1,4}>{\tilde{s}} -\end{psmatrix}$ +\begin{LTXexample}[width=5cm] +\begin{pspicture}(-2,-2)(3,2) +\psgrid[subgriddiv=2,subgriddots=10,gridcolor=lightgray] +\pnode(-1,0){A}\pnode(3,2){B} +\psline[linecolor=red](A)(B) +\psarc[linestyle=dashed](A){2.23}{-90}{135} +\psRelLine[linecolor=blue,angle=30](-1,0)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=blue,angle=-30](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=magenta,angle=90](-1,0)(3,2){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=magenta,angle=-90](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\end{pspicture} \end{LTXexample} +\medskip +The following figure has also a different scaling, but has set the +option \Lkeyword{trueAngle}, all angles refer to "what you see". -%-------------------------------------------------------------------------------------- -\subsection{\nxLkeyword{ArrowInside} Option} -%-------------------------------------------------------------------------------------- +\begin{LTXexample}[width=6.5cm] +\psset{yunit=2,xunit=1} +\begin{pspicture}(-3,-1)(3,2)\psgrid[subgridcolor=lightgray] +\pnode(-1,0){A}\pnode(3,2){B} +\psline[linecolor=red](A)(B) +\psarc(A){2.83}{-45}{135} +\psRelLine[linecolor=blue,angle=30,trueAngle](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=blue,angle=-30,trueAngle](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=magenta,angle=90,trueAngle](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\psRelLine[linecolor=magenta,angle=-90,trueAngle](A)(B){0.5}{EndNode} +\qdisk(EndNode){2pt} +\end{pspicture} +\end{LTXexample} -It is now possible to have arrows inside lines and not only at the -beginning or the end. The new defined options - -\psset{arrowscale=2,linecolor=red,unit=1cm,linewidth=1.5pt} -\begin{longtable}{l|>{\RaggedRight}p{8.5cm}|p{2.2cm}} -Name & Example & Output\\\hline -\endfirsthead -Name & Example & Output\\\hline -\endhead -\Lkeyword{ArrowInside} & - \texttt{\textbackslash psline[ArrowInside=->](0,0)(2,0)} & - \psline[ArrowInside=->](0,0.1)(2,0.1) \\ -\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsidePos=0.25](0,0)(2,0)} -& \psline[ArrowInside=->, ArrowInsidePos=0.25](0,0.1)(2,0.1) \\ -\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsidePos=10](0,0)(2,0)} -& \psline[ArrowInside=->, ArrowInsidePos=10](0,0.1)(2,0.1) \\ -\Lkeyword{ArrowInsideNo} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsideNo=2](0,0)(2,0)} -& \psline[ArrowInside=->, ArrowInsideNo=2](0,0.1)(2,0.1) \\ -\Lkeyword{ArrowInsideOffset} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsideNo=2,\%}\newline - \hspace*{20pt}\texttt{ArrowInsideOffset=0.1](0,0)(2,0)} -& \psline[ArrowInside=->, ArrowInsideNo=2,ArrowInsideOffset=0.1](0,0.1)(2,0.1) \\ -% -\Lkeyword{ArrowInside} & \texttt{\textbackslash psline[ArrowInside=->]\{->\}(0,0)(2,0)} & - \psline[ArrowInside=->]{->}(0,0)(2,0)\\ -\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsidePos=0.25]\{->\}(0,0)(2,0)} - & \psline[ArrowInside=->, ArrowInsidePos=0.25]{->}(0,0)(2,0) \\ -\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsidePos=10]\{->\}(0,0)(2,0)} - & \psline[ArrowInside=->, ArrowInsidePos=10]{->}(0,0)(2,0) \\ -\Lkeyword{ArrowInsideNo} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsideNo=2]\{->\}(0,0)(2,0)} - & \psline[ArrowInside=->, ArrowInsideNo=2]{->}(0,0)(2,0) \\ -\Lkeyword{ArrowInsideOffset} & \texttt{\textbackslash psline[ArrowInside=->,\%} - \hspace*{20pt}\texttt{ArrowInsideNo=2,\%}\newline - \hspace*{20pt}\texttt{ArrowInsideOffset=0.1]\{->\}(0,0)(2,0)} - & \psline[ArrowInside=->, ArrowInsideNo=2,ArrowInsideOffset=0.1]{->}(0,0)(2,0) \\ -% -\Lkeyword{ArrowFill} & \texttt{\textbackslash psline[ArrowFill=false,\%} - \hspace*{20pt}\texttt{arrowinset=0]\{->\}(0,0)(2,0)} & - \psline[ArrowFill=false,arrowinset=0]{->}(0,0)(2,0)\\ -\Lkeyword{ArrowFill} & \texttt{\textbackslash psline[ArrowFill=false,\%} - \hspace*{20pt}\texttt{arrowinset=0]\{<<->>\}(0,0)(2,0)} & - \psline[ArrowFill=false,arrowinset=0]{<<->>}(0,0)(2,0)\\ -\Lkeyword{ArrowFill} & \texttt{\textbackslash psline[ArrowInside=->,\%}\newline - \hspace*{20pt}\texttt{arrowinset=0,\%}\newline - \hspace*{20pt}\texttt{ArrowFill=false,\%}\newline - \hspace*{20pt}\texttt{ArrowInsideNo=2,\%}\newline - \hspace*{20pt}\texttt{ArrowInsideOffset=0.1]\{->\}(0,0)(2,0)} - & \psline[ArrowInside=->, ArrowFill=false,ArrowInsideNo=2,ArrowInsideOffset=0.1]{->}(0,0)(2,0) \\ -\end{longtable} - -\medskip -Without the default arrow definition there is only the one inside -the line, defined by the type and the position. The position is -relative to the length of the whole line. $0.25$ means at $25\%$ -of the line length. The peak of the arrow gets the coordinates -which are calculated by the macro. If you want arrows with an -absolute position difference, then choose a value greater than -\verb|1|, e.\,g. \verb|10| which places an arrow every 10~pt. The -default unit \verb|pt| cannot be changed. +\medskip +Two examples using \verb+\multido+ to show the behaviour of the +options \verb+trueAngle+ and \verb+angle+. \medskip -\noindent -\begin{tabularx}{\linewidth}{@{\color{red}\vrule width 2pt}lX@{}} -& The \Lkeyword{ArrowInside} takes only arrow definitions like \Lnotation{->} into account. -Arrows from right to left (\Lnotation{<-}) are not possible and ignored. If you need -such arrows, change the order of the pairs of coordinates for the line or curve macro. -\end{tabularx} - -%-------------------------------------------------------------------------------------- -\subsection{\nxLkeyword{ArrowFill} Option} -%-------------------------------------------------------------------------------------- - -By default all arrows are filled polygons. With the option -\Lkeyset{ArrowFill=false} there are ''white`` arrows. Only for the -beginning/end arrows are they empty, the inside arrows are -overpainted by the line. - - -\psset{arrowscale=1} -\begin{LTXexample}[width=3.5cm] -\psset{arrowscale=2.5} -\psline[linecolor=red,arrowinset=0]{<->}(-1,0)(2,0) +\begin{LTXexample}[width=8cm] +\psset{yunit=4,xunit=2} +\begin{pspicture}(-1,0)(3,2)\psgrid[subgridcolor=lightgray] +\pnode(-1,0){A}\pnode(1,1){B} +\psline[linecolor=red](A)(3,2) +\multido{\iA=0+10}{36}{% + \psRelLine[linecolor=blue,angle=\iA](B)(A){-0.5}{EndNode} + \qdisk(EndNode){2pt} +} +\end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=3.5cm] -\psset{arrowscale=2.5} -\psline[linecolor=red,arrowinset=0,ArrowFill=false]{<->}(-1,0)(2,0) +\begin{LTXexample}[width=8cm] +\psset{yunit=4,xunit=2} +\begin{pspicture}(-1,0)(3,2)\psgrid[subgridcolor=lightgray] +\pnode(-1,0){A}\pnode(1,1){B} +\psline[linecolor=red](A)(3,2) +\multido{\iA=0+10}{36}{% + \psRelLine[linecolor=magenta,angle=\iA,trueAngle]{->}(B)(A){-0.5}{EndNode} +} +\end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=3.5cm] -\psset{arrowscale=2.5} -\psline[linecolor=red,arrowinset=0,arrowsize=0.2, - ArrowFill=false]{<->}(-1,0)(2,0) -\end{LTXexample} +\begin{center} +\bgroup +\psset{xunit=0.75\linewidth,yunit=0.75\linewidth,trueAngle}% +\begin{pspicture}(1,0.6)%\psgrid + \pnode(.3,.35){Vk} \pnode(.375,.35){D} \pnode(0,.4){DST1} \pnode(1,.18){DST2} + \pnode(0,.1){A1} \pnode(1,.31){A1} + { \psset{linewidth=.02,linestyle=dashed,linecolor=gray}% + \pcline(DST1)(DST2) % <- Druckseitentangente + \pcline(A2)(A1) % <- Anstr\"omrichtung + \lput*{:U}{\small Anstr\"omrichtung $v_{\infty}$} }% + \psIntersectionPoint(A1)(A2)(DST1)(DST2){Hk} + \pscurve(Hk)(.4,.38)(Vk)(.36,.33)(.5,.32)(Hk) + \psParallelLine[linecolor=red!75!green,arrows=->,arrowscale=2](Vk)(Hk)(D){.1}{FtE} + \psRelLine[linecolor=red!75!green,arrows=->,arrowscale=2,angle=90](D)(FtE){4}{Fn}% why "4"? + \psParallelLine[linestyle=dashed](D)(FtE)(Fn){.1}{Fnr1} + \psRelLine[linestyle=dashed,angle=90](FtE)(D){-4}{Fnr2} % why "-4"? + \psline[linewidth=1.5pt,arrows=->,arrowscale=2](D)(Fnr2) + \psIntersectionPoint(D)([nodesep=2]D)(Fnr1)([offset=-4]Fnr1){Fh} + \psIntersectionPoint(D)([offset=2]D)(Fnr1)([nodesep=4]Fnr1){Fv} + \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fh) + \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fv) + \psline[linestyle=dotted](Fh)(Fnr1) \psline[linestyle=dotted](Fv)(Fnr1) + \uput{.1}[0](Fh){\blue $F_{H}$} \uput{.1}[180](Fv){\blue $F_{V}$} + \uput{.1}[-45](Fnr1){$F_{R}$} \uput{.1}[90](Fn){\color{red!75!green}$F_{N}$} + \uput{.25}[-90](FtE){\color{red!75!green}$F_{T}$} +\end{pspicture} +\egroup +\end{center} +\begin{lstlisting} +\psset{xunit=0.75\linewidth,yunit=0.75\linewidth,trueAngle}% +\end{center} +\begin{pspicture}(1,0.6)%\psgrid + \pnode(.3,.35){Vk} \pnode(.375,.35){D} \pnode(0,.4){DST1} \pnode(1,.18){DST2} + \pnode(0,.1){A1} \pnode(1,.31){A1} + { \psset{linewidth=.02,linestyle=dashed,linecolor=gray}% + \pcline(DST1)(DST2) % <- Druckseitentangente + \pcline(A2)(A1) % <- Anstr"omrichtung + \lput*{:U}{\small Anstr"omrichtung $v_{\infty}$} }% + \psIntersectionPoint(A1)(A2)(DST1)(DST2){Hk} + \pscurve(Hk)(.4,.38)(Vk)(.36,.33)(.5,.32)(Hk) + \psParallelLine[linecolor=red!75!green,arrows=->,arrowscale=2](Vk)(Hk)(D){.1}{FtE} + \psRelLine[linecolor=red!75!green,arrows=->,arrowscale=2,angle=90](D)(FtE){4}{Fn}% why "4"? + \psParallelLine[linestyle=dashed](D)(FtE)(Fn){.1}{Fnr1} + \psRelLine[linestyle=dashed,angle=90](FtE)(D){-4}{Fnr2} % why "-4"? + \psline[linewidth=1.5pt,arrows=->,arrowscale=2](D)(Fnr2) + \psIntersectionPoint(D)([nodesep=2]D)(Fnr1)([offset=-4]Fnr1){Fh} + \psIntersectionPoint(D)([offset=2]D)(Fnr1)([nodesep=4]Fnr1){Fv} + \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fh) + \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fv) + \psline[linestyle=dotted](Fh)(Fnr1) \psline[linestyle=dotted](Fv)(Fnr1) + \uput{.1}[0](Fh){\blue $F_{H}$} \uput{.1}[180](Fv){\blue $F_{V}$} + \uput{.1}[-45](Fnr1){$F_{R}$} \uput{.1}[90](Fn){\color{red!75!green}$F_{N}$} + \uput{.25}[-90](FtE){\color{red!75!green}$F_{T}$} +\end{pspicture} +\end{lstlisting} -\begin{LTXexample}[width=3.5cm] -\psline[linecolor=blue,arrowscale=4, - ArrowFill]{>>->>}(-1,0)(2,0) -\end{LTXexample} -\begin{LTXexample}[width=3.5cm] -\psline[linecolor=blue,arrowscale=4, - ArrowFill=false]{>>->>}(-1,0)(2,0) -\rule{3cm}{0pt}\\[30pt] -\end{LTXexample} +%-------------------------------------------------------------------------------------- +\section{\nxLcs{psParallelLine}} +%-------------------------------------------------------------------------------------- +With this macro it is possible to plot lines relative to a given one, which is parallel. +There is no special parameter here. -\begin{LTXexample}[width=3.5cm] -\psline[linecolor=blue,arrowscale=4, - ArrowFill]{>|->|}(-1,0)(2,0) -\end{LTXexample} +\begin{lstlisting}[style=syntax] +\psParallelLine()()(){}{} +\psParallelLine{}()()(){}{} +\psParallelLine[]()()(){}{} +\psParallelLine[]{}()()(){}{} +\end{lstlisting} -\begin{LTXexample}[width=3.5cm] -\psline[linecolor=blue,arrowscale=4, - ArrowFill=false]{>|->|}(-1,0)(2,0)% +The line starts at $P_2$, is parallel to $\overline{P_0P_1}$ and +the length of this parallel line depends on the length factor. The +end node name must be a valid nodename and shouldn't contain any +of the special PostScript characters. + +\begin{LTXexample} +\begin{pspicture*}(-5,-4)(5,3.5) + \psgrid[subgriddiv=0,griddots=5] + \pnode(2,-2){FF}\qdisk(FF){1.5pt} + \pnode(-5,5){A}\pnode(0,0){O} + \multido{\nCountA=-2.4+0.4}{9}{% + \psParallelLine[linecolor=red](O)(A)(0,\nCountA){9}{P1} + \psline[linecolor=red](0,\nCountA)(FF) + \psRelLine[linecolor=red](0,\nCountA)(FF){9}{P2} + } + \psline[linecolor=blue](A)(FF) + \psRelLine[linecolor=blue](A)(FF){5}{END1} + \psline[linewidth=2pt,arrows=->](2,0)(FF) +\end{pspicture*} \end{LTXexample} %-------------------------------------------------------------------------------------- -\subsection{Examples} +\section{\nxLcs{psIntersectionPoint}} %-------------------------------------------------------------------------------------- +This macro calculates the intersection point of two lines, given by the four coordinates. +There is no special parameter here. +\begin{lstlisting}[style=syntax] +\psIntersectionPoint()()()(){} +\end{lstlisting} -All examples are printed with \verb|\psset{arrowscale=2,linecolor=red}|. -\subsubsection{\nxLcs{psline}} - -\bigskip -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=->]{|<->|}(2,1) +\begin{LTXexample}[width=5.5cm] +\psset{unit=0.5cm} +\begin{pspicture}(-5,-4)(5,5) + \psaxes[labelFontSize=\scriptstyle, + dx=2,Dx=2,dy=2,Dy=2]{->}(0,0)(-5,-4)(5,5) + \psline[linecolor=red,linewidth=2pt](-5,-1)(5,5) + \psline[linecolor=blue,linewidth=2pt](-5,3)(5,-4) + \qdisk(-5,-1){2pt}\uput[-90](-5,-1){A} + \qdisk(5,5){2pt}\uput[-90](5,5){B} + \qdisk(-5,3){2pt}\uput[-90](-5,3){C} + \qdisk(5,-4){2pt}\uput[-90](5,-4){D} + \psIntersectionPoint(-5,-1)(5,5)(-5,3)(5,-4){IP} + \qdisk(IP){3pt}\uput{0.3}[90](IP){IP} + \psline[linestyle=dashed](IP|0,0)(IP)(0,0|IP) \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=-|]{|-|}(2,1) -\end{pspicture} -\end{LTXexample} +\clearpage -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=->,ArrowInsideNo=2]{->}(2,1) -\end{pspicture} -\end{LTXexample} +%-------------------------------------------------------------------------------------- +\section[\nxLenv{psCancel} environment]{\nxLenv{psCancel} environment\footnotemark} +%-------------------------------------------------------------------------------------- +\footnotetext{Thanks to by Stefano Baroni} This macro works like +the \Lcs{cancel} macro from the package of the same name but it +allows as argument any contents, not only letters but also a +complex graphic. -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=->,ArrowInsideNo=2,ArrowInsideOffset=0.1]{->}(2,1) -\end{pspicture} -\end{LTXexample} +\begin{BDef} +\LcsStar{psCancel}\OptArgs\Largb{contents}% +\end{BDef} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=-*]{->}(0,0)(2,1)(3,0)(4,0)(6,2) -\end{pspicture} -\end{LTXexample} +All optional arguments for lines and boxes are valid and can be +used in the usual way. The star option fills the underlying box +rectangle with the linecolor. This can be transparent if +\Lkeyword{opacity} is set to a value less than 1. This can be used +in presentation to strike out words, equations, and graphic +objects. Lines can also be transparent when the option +\Lkeyword{strokeopacity} is used. -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=-*,ArrowInsidePos=0.25]{->}(0,0)(2,1)(3,0)(4,0)(6,2) -\end{pspicture} -\end{LTXexample} +\begingroup +\psCancel{A} \psCancel[linecolor=red]{Tikz :-)} \quad +\psCancel[linecolor=blue,doubleline=true]{% + \readdata{\data}{demo1.data} + \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-13mm,lly=-7mm, + xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} + \pstScalePoints(1,0.00000001){}{} + \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, + ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} + \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} + \end{psgraph}} \qquad% end of Cancel +\psCancel[linewidth=3pt,linecolor=red, + strokeopacity=0.5]{\tabular[b]{c}first line\\second line\endtabular}\quad +\psCancel*[linecolor=red!50,opacity=0.5]{\tabular[b]{c}first line\\second line\endtabular} +\quad +\psCancel*[linecolor=blue!30,opacity=0.5]{% + \readdata{\data}{demo1.data} + \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-15mm,lly=-7mm,urx=1mm, + xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} + \pstScalePoints(1,0.00000001){}{} + \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, + ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} + \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} + \end{psgraph}} \quad% end of Cancel +\psCancel[linewidth=4pt,strokeopacity=0.5]{\parbox{8cm}{\[ + \binom{x_R}{y_R} = \underbrace{r\vphantom{\binom{A}{B}}}_{\text{Scaling}}\cdot + \underbrace{\begin{pmatrix} + \sin\gamma & -\cos\gamma \\ + \cos \gamma & \sin \gamma \\ + \end{pmatrix}}_{\text{Rotation}} \binom{x_K}{y_K} + + \underbrace{\binom{t_x}{t_y}}_{\text{Translation}} \]} }% end of psCancel +\endgroup -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=-*,ArrowInsidePos=0.25,ArrowInsideNo=2]{->}% - (0,0)(2,1)(3,0)(4,0)(6,2) -\end{pspicture} -\end{LTXexample} +\bigskip +\begin{lstlisting} +\psCancel{A} \psCancel[linecolor=red]{Tikz :-)} \quad +\psCancel[linecolor=blue,doubleline=true]{% + \readdata{\data}{demo1.data} + \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-13mm,lly=-7mm, + xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} + \pstScalePoints(1,0.00000001){}{} + \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, + ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} + \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} + \end{psgraph}} \qquad% end of Cancel +\psCancel[linewidth=3pt,linecolor=red, + strokeopacity=0.5]{\tabular[b]{c}first line\\second line\endtabular}\quad +\psCancel*[linecolor=red!50,opacity=0.5]{\tabular[b]{c}first line\\second line\endtabular} +\quad +\psCancel*[linecolor=blue!30,opacity=0.5]{% + \readdata{\data}{demo1.data} + \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-15mm,lly=-7mm,urx=1mm, + xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} + \pstScalePoints(1,0.00000001){}{} + \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, + ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} + \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} + \end{psgraph}} \quad% end of Cancel +\psCancel[linewidth=4pt,strokeopacity=0.5]{\parbox{8cm}{\[ + \binom{x_R}{y_R} = \underbrace{r\vphantom{\binom{A}{B}}}_{\text{Scaling}}\cdot + \underbrace{\begin{pmatrix} + \sin\gamma & -\cos\gamma \\ + \cos \gamma & \sin \gamma \\ + \end{pmatrix}}_{\text{Rotation}} \binom{x_K}{y_K} + + \underbrace{\binom{t_x}{t_y}}_{\text{Translation}} \]} }% end of psCancel +\end{lstlisting} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=->, ArrowInsidePos=0.25]{->}% - (0,0)(2,1)(3,0)(4,0)(6,2) + +\clearpage +%-------------------------------------------------------------------------------------- +\section{\nxLcs{psStep}} +%-------------------------------------------------------------------------------------- +\Lcs{psStep} calculates a step function for the upper or lower +sum or the max/min of the \Index{Riemann} integral definition of a given +function. The available option is + +\Lkeyset{StepType=lower}|\Lkeyval{upper}|\Lkeyval{Riemann}|\Lkeyval{infimum}|\Lkeyval{supremum} or alternative +\Lkeyset{StepType=l}|\Lkeyval{u}|\Lkeyval{R}|\Lkeyval{i}|\Lkeyval{s} + +with \Lkeyword{lower} as the default setting. The syntax of the function is + +\begin{BDef} +\Lcs{psStep}\OptArgs\Largr(x1,x2)\Largb{n}\Largb{function} +\end{BDef} + + +(x1,x2) is the given interval for the step wise calculated +function, n is the number of the rectangles and \Larg{function} is +the mathematical function in postfix or algebraic=true notation (with +\Lkeyset{algebraic=true}). + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(-0.5,-0.5)(10,3) + \psaxes[labelFontSize=\scriptstyle]{->}(10,3) + \psplot[plotpoints=100,linewidth=1.5pt,algebraic=true]{0}{10}{sqrt(x)} + \psStep[linecolor=magenta,StepType=upper,fillstyle=hlines](0,9){9}{x sqrt} + \psStep[linecolor=blue,fillstyle=vlines](0,9){9}{x sqrt } \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[linestyle=none,ArrowInside=->,ArrowInsidePos=0.25]{->}% - (0,0)(2,1)(3,0)(4,0)(6,2) +\begin{LTXexample}[pos=t,preset=\centering] +\psset{plotpoints=200} +\begin{pspicture}(-0.5,-2.25)(10,3) + \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-2.25)(10,3) + \psplot[linewidth=1.5pt,algebraic=true]{0}{10}{sqrt(x)*sin(x)} + \psStep[algebraic=true,linecolor=magenta,StepType=upper](0,9){20}{sqrt(x)*sin(x)} + \psStep[linecolor=blue,linestyle=dashed](0,9){20}{x sqrt x RadtoDeg sin mul} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=-<, ArrowInsidePos=0.75]{->}% - (0,0)(2,1)(3,0)(4,0)(6,2) +\begin{LTXexample}[pos=t,preset=\centering] +\psset{yunit=1.25cm,plotpoints=200} +\begin{pspicture}(-0.5,-1.5)(10,1.5) + \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-1.5)(10,1.5) + \psStep[algebraic=true,StepType=Riemann,fillstyle=solid,fillcolor=black!10](0,10){50}% + {sqrt(x)*cos(x)*sin(x)} + \psplot[linewidth=1.5pt,algebraic=true]{0}{10}{sqrt(x)*cos(x)*sin(x)} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true,ArrowInside=-*} -\psline(0,0)(2,1)(3,0)(4,0)(6,2) -\psset{linestyle=none} -\psline[ArrowInsidePos=0](0,0)(2,1)(3,0)(4,0)(6,2) -\psline[ArrowInsidePos=1](0,0)(2,1)(3,0)(4,0)(6,2) + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{yunit=1.25cm,plotpoints=200} +\begin{pspicture}(-0.5,-1.5)(10,1.5) + \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-1.5)(10,1.5) + \psStep[algebraic=true,StepType=infimum,fillstyle=solid,fillcolor=black!10](0,10){50}% + {sqrt(x)*cos(x)*sin(x)} + \psplot[linewidth=1.5pt,algebraic=true]{0}{10}{sqrt(x)*cos(x)*sin(x)} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,5) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=->,ArrowInsidePos=20](0,0)(3,0)% - (3,3)(1,3)(1,5)(5,5)(5,0)(7,0)(6,3) +\begin{LTXexample}[pos=t,preset=\centering] +\psset{yunit=1.25cm,plotpoints=200} +\begin{pspicture}(-0.5,-1.5)(10,1.5) + \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-1.5)(10,1.5) + \psStep[algebraic=true,StepType=supremum,fillstyle=solid,fillcolor=black!10](0,10){50}% + {sqrt(x)*cos(x)*sin(x)} + \psplot[linewidth=1.5pt,algebraic=true]{0}{10}{sqrt(x)*cos(x)*sin(x)} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,2) -\psset{arrowscale=2,ArrowFill=true} -\psline[ArrowInside=-|]{<->}(0,2)(2,0)(3,2)(4,0)(6,2) +\begin{LTXexample}[pos=t,preset=\centering] +\psset{unit=1.5cm,plotpoints=200} +\begin{pspicture}[plotpoints=200](-0.5,-3)(10,2.5) + \psStep[algebraic=true,fillstyle=solid,fillcolor=yellow](0.001,9.5){40}{2*sqrt(x)*cos(ln(x))*sin(x)} + \psStep[algebraic=true,StepType=Riemann,fillstyle=solid,fillcolor=blue](0.001,9.5){40}{2*sqrt(x)*cos(ln(x))*sin(x)} + \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-2.75)(10,2.5) + \psplot[algebraic=true,linecolor=white]{0.001}{9.75}{2*sqrt(x)*cos(ln(x))*sin(x)} + \uput[90](6,1.2){$f(x)=2\cdot\sqrt{x}\cdot\cos{(\ln{x})}\cdot\sin{x}$} \end{pspicture} \end{LTXexample} +\clearpage %-------------------------------------------------------------------------------------- -\subsubsection{\nxLcs{pspolygon}} -%-------------------------------------------------------------------------------------- -% Polygons (\pspolygon macro) -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,3) -\psset{arrowscale=2} -\pspolygon[ArrowInside=-|](0,0)(3,3)(6,3)(6,1) -\end{pspicture} -\end{LTXexample} +\section{Tangent lines} +There are two macros for plotting a tangent line or the tangent normal line. +The first one is \Lcs{psTangentLine} which expects three pairs of coordinates, +a $x$ and a $dx$ value. The second one is \Lcs{psplotTangent} which expects +a function for the curve. \xLkeyword{Tnormal} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,3) -\psset{arrowscale=2} -\pspolygon[ArrowInside=->,ArrowInsidePos=0.25]% - (0,0)(3,3)(6,3)(6,1) -\end{pspicture} -\end{LTXexample} +\subsection{\nxLcs{psTangentLine} and option \nxLkeyword{Tnormal}} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,3) -\psset{arrowscale=2} -\pspolygon[ArrowInside=->,ArrowInsideNo=4]% - (0,0)(3,3)(6,3)(6,1) -\end{pspicture} -\end{LTXexample} +\begin{BDef} +\Lcs{psTangentLine}\OptArgs\Largr{\coord1}\Largr{\coord2}\Largr{\coord3}\Largb{x}\Largb{dx} +\end{BDef} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,3) -\psset{arrowscale=2} -\pspolygon[ArrowInside=->,ArrowInsideNo=4,% - ArrowInsideOffset=0.1](0,0)(3,3)(6,3)(6,1) +\begin{LTXexample}[width=0.45\linewidth,wide] +\psset{unit=2} +\begin{pspicture}[showgrid=true](1,-1)(4,1) + \pscurve[showpoints=true] + (2.1,-0.2)(2.5,0.2)(3.2,0.235)(3.8,-0.2) + \psTangentLine[Tnormal,arrows=->, + linecolor=red](2.5,0.2)(3.2,0.235)% + (3.8,-0.2){3}{0.1} + \psTangentLine[arrows=<->, + linecolor=blue](2.5,0.2)(3.2,0.235)% + (3.8,-0.2){3}{0.5} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,3) -\psset{arrowscale=2} - \pspolygon[ArrowInside=-|](0,0)(3,3)(6,3)(6,1) - \psset{linestyle=none,ArrowInside=-*} - \pspolygon[ArrowInsidePos=0](0,0)(3,3)(6,3)(6,1) - \pspolygon[ArrowInsidePos=1](0,0)(3,3)(6,3)(6,1) - \psset{ArrowInside=-o} - \pspolygon[ArrowInsidePos=0.25](0,0)(3,3)(6,3)(6,1) - \pspolygon[ArrowInsidePos=0.75](0,0)(3,3)(6,3)(6,1) -\end{pspicture} -\end{LTXexample} +In special cases one has to use \Lkeyword{curvature}\verb+=1 1 1+ for the macro \Lcs{pscurve} +to get the same equation for the curve as \Lcs{psplotTangentLine} does. -\begin{LTXexample}[width=6.5cm] -\begin{pspicture}(6,5) -\psset{arrowscale=2} - \pspolygon[ArrowInside=->,ArrowInsidePos=20]% - (0,0)(3,0)(3,3)(1,3)(1,5)(5,5)(5,0)(7,0)(6,3) +\begin{LTXexample}[pos=t,preset=\centering,wide] +\psset{unit=2} +\begin{pspicture}[showgrid=true](2,-1)(6,2) +\pscurve[showpoints=true, + curvature=1 1 1](2.1,-0.2)(2.5,0.2)(3.2,0.235)(5.8,2) +\pscurve[showpoints=true,linecolor=green, + curvature=1 1 1](2.5,0.2)(3.2,0.235)(5.8,2) +\psTangentLine[Tnormal,arrows=->,linecolor=red](2.5,0.2)(3.2,0.235)(5.8,2){4.6}{0.6} +\psTangentLine[arrows=<->,linecolor=blue](2.5,0.2)(3.2,0.235)(5.8,2){4.5}{0.6} \end{pspicture} \end{LTXexample} +\subsection{\nxLcs{psplotTangent} and option \nxLkeyword{Tnormal}} %-------------------------------------------------------------------------------------- -\subsubsection{\nxLcs{psbezier}} -%-------------------------------------------------------------------------------------- -% Bezier curves (\psbezier macro) - -\resetOptions -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(3,3) -\psset{arrowscale=2} - \psbezier[ArrowInside=-|](0,1)(1,0)(2,1)(3,3) - \psset{linestyle=none,ArrowInside=-o} - \psbezier[ArrowInsidePos=0.25](0,1)(1,0)(2,1)(3,3) - \psbezier[ArrowInsidePos=0.75](0,1)(1,0)(2,1)(3,3) - \psset{linestyle=none,ArrowInside=-*} - \psbezier[ArrowInsidePos=0](0,1)(1,0)(2,1)(3,3) - \psbezier[ArrowInsidePos=1](0,1)(1,0)(2,1)(3,3) -\end{pspicture} -\end{LTXexample} +There is an additional option, named \Lkeyword{Derive} for an +alternative function (see following example) to calculate the +slope of the tangent. This will be in general the first +derivative, but can also be any other function. If this option is +different to to the default value \Lkeyset{Derive=default}, then this +function is taken to calculate the slope. For the other cases, +\LPack{pstricks-add} builds a secant with -0.00005,showpoints=true]% - {*-*}(0,0)(2,3)(3,0)(4,2) -\end{pspicture} -\end{LTXexample} -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,3) -\psset{arrowscale=2} - \psbezier[ArrowInside=->,showpoints=true, - ArrowInsideNo=2](0,0)(2,3)(3,0)(4,2) -\end{pspicture} -\end{LTXexample} +The macro expects three parameters: -\resetOptions -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,3) -\psset{arrowscale=2} - \psbezier[ArrowInside=->,showpoints=true, - ArrowInsideNo=2,ArrowInsideOffset=-0.2]% - {->}(0,0)(2,3)(3,0)(4,2) +\begin{description} +\item[$x$]: the $x$ value of the function for which the tangent should be calculated +\item[$dx$]: the $dx$ to both sides of the $x$ value +\item[$f(x)$]: the function in infix (with option \Lkeyword{algebraic}) or the default +postfix (PostScript) notation +\end{description} + +The following examples show the use of the algebraic=true option together with the Derive option. +Remember that using the \Lkeyword{algebraic} option implies that the angles have to be in the +radian unit! + +\begin{center} +\bgroup +\def\F{x RadtoDeg dup dup cos exch 2 mul cos add exch 3 mul cos add} +\def\Fp{x RadtoDeg dup dup sin exch 2 mul sin 2 mul add exch 3 mul sin 3 mul add neg} +\psset{plotpoints=1001} +\begin{pspicture}(-7.5,-2.5)(7.5,4)%X\psgrid + \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) + \psplot[linewidth=3\pslinewidth]{-7}{7}{\F} + \psset{linecolor=red, arrows=<->, arrowscale=2} + \multido{\n=-7+1}{8}{\psplotTangent{\n}{1}{\F}} + \psset{linecolor=magenta, arrows=<->, arrowscale=2}% + \multido{\n=0+1}{8}{\psplotTangent[linecolor=blue, Derive=\Fp]{\n}{1}{\F}} \end{pspicture} -\end{LTXexample} +\egroup +\end{center} + +\begin{lstlisting} +\def\F{x RadtoDeg dup dup cos exch 2 mul cos add exch 3 mul cos add} +\def\Fp{x RadtoDeg dup dup sin exch 2 mul sin 2 mul add exch 3 mul sin 3 mul add neg} +\psset{plotpoints=1001} +\begin{pspicture}(-7.5,-2.5)(7.5,4)%X\psgrid + \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) + \psplot[linewidth=3\pslinewidth]{-7}{7}{\F} + \psset{linecolor=red, arrows=<->, arrowscale=2} + \multido{\n=-7+1}{8}{\psplotTangent{\n}{1}{\F}} + \psset{linecolor=magenta, arrows=<->, arrowscale=2}% + \multido{\n=0+1}{8}{\psplotTangent[linecolor=blue, §\ON§Derive=\Fp§\OFF§]{\n}{1}{\F}} +\end{pspicture} +\end{lstlisting} +The star version plots only the tangent line in the positive $x$-direction: -\begin{LTXexample}[width=5.5cm] -\begin{pspicture}(5,3) -\psset{arrowscale=2} - \psbezier[ArrowInsideNo=9,ArrowInside=-|,% - showpoints=true]{*-*}(0,0)(1,3)(3,0)(5,3) +\begin{center} +\bgroup +\def\Falg{cos(x)+cos(2*x)+cos(3*x)} \def\Fpalg{-sin(x)-2*sin(2*x)-3*sin(3*x)} +\begin{pspicture}(-7.5,-2.5)(7.5,4)%\psgrid + \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) + \psplot[linewidth=1.5pt,algebraic=true,plotpoints=500]{-7.5}{7.5}{\Falg} + \multido{\n=-7+1}{8}{\psplotTangent*[linecolor=red,arrows=->,arrowscale=2,algebraic=true]{\n}{1}{\Falg}} + \multido{\n=0+1}{8}{\psplotTangent*[linecolor=magenta,% + arrows=->,arrowscale=2,algebraic=true,Derive={\Fpalg}]{\n}{1}{\Falg}} \end{pspicture} -\end{LTXexample} +\egroup +\end{center} -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,3) -\psset{arrowscale=2} - \psset{ArrowInside=-|} - \psbezier[ArrowInsidePos=0.25,showpoints=true]{*-*}(2,3)(3,0)(4,2) - \psset{linestyle=none} - \psbezier[ArrowInsidePos=0.75](0,0)(2,3)(3,0)(4,2) +\begin{lstlisting} +\def\Falg{cos(x)+cos(2*x)+cos(3*x)} \def\Fpalg{-sin(x)-2*sin(2*x)-3*sin(3*x)} +\begin{pspicture}(-7.5,-2.5)(7.5,4)%\psgrid + \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) + \psplot[linewidth=1.5pt,algebraic=true,plotpoints=500]{-7.5}{7.5}{\Falg} + \multido{\n=-7+1}{8}{\psplotTangent*[linecolor=red,arrows=->,arrowscale=2,algebraic=true]{\n}{1}{\Falg}} + \multido{\n=0+1}{8}{\psplotTangent*[linecolor=magenta,% + arrows=->,arrowscale=2,algebraic=true,Derive={\Fpalg}]{\n}{1}{\Falg}} \end{pspicture} -\end{LTXexample} +\end{lstlisting} -\begin{LTXexample}[width=5.5cm] -\begin{pspicture}(5,6) -\psset{arrowscale=2} - \pnode(3,4){A}\pnode(5,6){B}\pnode(5,0){C} - \psbezier[ArrowInside=->,% - showpoints=true](A)(B)(C) - \psset{linestyle=none,ArrowInside=-<} - \psbezier[ArrowInsideNo=4](0,0)(A)(B)(C) - \psset{ArrowInside=-o} - \psbezier[ArrowInsidePos=0.1](0,0)(A)(B)(C) - \psbezier[ArrowInsidePos=0.9](0,0)(A)(B)(C) - \psset{ArrowInside=-*} - \psbezier[ArrowInsidePos=0.3](0,0)(A)(B)(C) - \psbezier[ArrowInsidePos=0.7](0,0)(A)(B)(C) +The next example shows the use of the \Lkeyword{Derive} option to draw +the perpendicular line to the tangent. + +\begin{LTXexample}[width=8cm,wide] +\begin{pspicture}(-0.5,-0.5)(7.25,7.25) + \def\Func{10 x div} + \psaxes[arrowscale=1.5]{->}(7,7) + \psplot[linewidth=2pt,algebraic=true]{1.5}{5}{10/x} + \psplotTangent[linewidth=.5\pslinewidth,linecolor=red,algebraic=true]{3}{2}{10/x} + \psplotTangent[linewidth=.5\pslinewidth,linecolor=blue,algebraic=true,Derive=(x*x)/10]{3}{2}{10/x} + \psline[linestyle=dashed](!0 /x 3 def \Func)(!3 /x 3 def \Func)(3,0) \end{pspicture} \end{LTXexample} +By setting the optional argument \Lkeyword{Tnormal} one can plot the +normal of the tangent line. It always starts at the given point. -\begin{LTXexample}[pos=t] -\begin{pspicture}(-3,-5)(15,5) - \psbezier[ArrowInsideNo=19,% - ArrowInside=->,ArrowFill=false,% - showpoints=true]{->}(-3,0)(5,-5)(8,5)(15,-5) +\begin{LTXexample}[width=8cm,wide] +\begin{pspicture}(-0.5,-0.5)(7.25,7.25) + \def\Func{10 x div} + \psaxes[arrowscale=1.5]{->}(7,7) + \psplot[linewidth=2pt]{1.5}{5}{\Func} + \psplotTangent[linewidth=1.5\pslinewidth,linecolor=red]{3}{2}{\Func} + \psplotTangent[linewidth=1.5\pslinewidth,linecolor=blue,Tnormal]{3}{2}{\Func} + \psline[linestyle=dashed](!0 /x 3 def \Func)(!3 /x 3 def \Func)(3,0) \end{pspicture} \end{LTXexample} +Let's work with the classical \Index{cardioid}: $r=2(1+\cos(\theta))$ and +$\displaystyle \frac{d r}{d\theta}=-2\sin(\theta)$. The \Lkeyword{Derive} +option always expects the $\frac{d r}{d\theta}$ value and uses +internally the equation for the derivative of implicitly defined +functions: -%-------------------------------------------------------------------------------------- -\subsubsection{\nxLcs{pcline}} -%-------------------------------------------------------------------------------------- -These examples need the package \verb|pst-node|. +\[ +\frac{dy}{dx}=\frac{r^\prime\cdot\sin\theta + x}{r^\prime\cdot\cos\theta - y} +\] +where $x=r\cdot\cos\theta$ and $y=r\cdot\sin\theta$ -% Lines (\pcline macro) -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,1) -\psset{arrowscale=2} -\pcline[ArrowInside=->](0,0)(2,1) + +\begin{LTXexample}[width=6cm,wide] +\begin{pspicture}(-1,-3)(5,3)%\psgrid[subgridcolor=lightgray] + \psaxes{->}(0,0)(-1,-3)(5,3) + \psplot[polarplot,linewidth=3\pslinewidth,linecolor=blue,% + plotpoints=500]{0}{360}{1 x cos add 2 mul} \end{pspicture} \end{LTXexample} +\psset{algebraic=false} +\begin{LTXexample}[width=6cm,wide] +\begin{pspicture}(-1,-3)(5,3)%\psgrid[subgridcolor=lightgray] + \psaxes{->}(0,0)(-1,-3)(5,3) + \psplot[polarplot,linewidth=3\pslinewidth,linecolor=blue,plotpoints=500]{0}{360}{1 x cos add 2 mul} + \multido{\n=0+36}{10}{% + \psplotTangent[polarplot,linecolor=red,arrows=<->]{\n}{1.5}{1 x cos add 2 mul} } +\end{pspicture} +\end{LTXexample} -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,1) -\psset{arrowscale=2} -\pcline[ArrowInside=->]{<->}(0,0)(2,1) +\begin{LTXexample}[width=6cm,wide] +\begin{pspicture}(-1,-3)(5,3)%\psgrid[subgridcolor=lightgray] + \psaxes{->}(0,0)(-1,-3)(5,3) + \psplot[polarplot,linewidth=3\pslinewidth,linecolor=blue,algebraic=true,plotpoints=500]{0}{6.289}{2*(1+cos(x))} + \multido{\r=0.000+0.314}{21}{% + \psplotTangent[polarplot,Derive=-2*sin(x),algebraic=true,linecolor=red,arrows=<->]{\r}{1.5}{2*(1+cos(x))} } \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,1) -\psset{arrowscale=2} -\pcline[ArrowInside=-|,ArrowInsidePos=0.75]{|-|}(0,0)(2,1) +Let's work with a \Index{Lissajou curve}: + $\displaystyle\left\{\begin{array}{l}x=3.5\cos(2t)\\y=3.5\sin(6t)\end{array}\right.$ +whose derivative is : + $\displaystyle\left\{\begin{array}{l}x=-7\sin(2t)\\y=21\cos(6t)\end{array}\right.$ + +The parameter must be the letter $t$ instead of $x$ and when using +the \Lkeyword{algebraic=true} option you must separate the two equations by +a \Lnotation{|} (see example). + +\begin{LTXexample}[pos=t,wide] +\def\Lissa{t dup 2 RadtoDeg mul cos 3.5 mul exch 6 mul RadtoDeg sin 3.5 mul}% +\psset{yunit=0.6} +\begin{pspicture}(-4,-4)(4,6) + \parametricplot[plotpoints=500,linewidth=3\pslinewidth]{0}{3.141592}{\Lissa} + \multido{\r=0.000+0.314}{11}{% + \psplotTangent[linecolor=red,arrows=<->]{\r}{1.5}{\Lissa} } + \multido{\r=0.157+0.314}{11}{% + \psplotTangent[linecolor=blue,arrows=<->]{\r}{1.5}{\Lissa} } +\end{pspicture}\hfill% +\def\LissaAlg{3.5*cos(2*t)|3.5*sin(6*t)} \def\LissaAlgDer{-7*sin(2*t)|21*cos(6*t)}% +\begin{pspicture}(-4,-4)(4,6) + \parametricplot[algebraic=true,plotpoints=500,linewidth=3\pslinewidth]{0}{3.141592}{\LissaAlg} + \multido{\r=0.000+0.314}{11}{% + \psplotTangent[algebraic=true,linecolor=red,arrows=<->]{\r}{1.5}{\LissaAlg} } + \multido{\r=0.157+0.314}{11}{% + \psplotTangent[algebraic=true,linecolor=blue,arrows=<->,% + Derive=\LissaAlgDer]{\r}{1.5}{\LissaAlg} } \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=2.5cm] -\psset{arrowscale=2} -\pcline[ArrowInside=->,ArrowInsidePos=0.65]{*-*}(0,0)(2,0) -\naput[labelsep=0.3]{\large$g$} -\end{LTXexample} +\clearpage +\section{Successive derivatives of a function} +The new PostScript function \Lps{Derive} has been added for +plotting successive derivatives of a function. It must be used +with the \Lkeyword{algebraic=true} option. This function has two arguments: -\begin{LTXexample}[width=2.5cm] -\psset{arrowscale=2} -\pcline[ArrowInside=->,ArrowInsidePos=10]{|-|}(0,0)(2,0) -\naput[labelsep=0.3]{\large$l$} -\end{LTXexample} +\begin{enumerate} +\item a positive integer which defines the order of the derivative; obviously $0$ means the + function itself! +\item a function of variable $x$ which can be any function using common operators, +\end{enumerate} +Do not think that the derivative is approximated, the internal PostScript engine will +compute the real derivative using a formal derivative engine. +The following diagram contains the plot of the polynomial: -%-------------------------------------------------------------------------------------- -\subsubsection{\nxLcs{pccurve}} -%-------------------------------------------------------------------------------------- -These examples also need the package \verb|pst-node|. +\[ f(x)=\sum_{i=0}^{14}\frac{(-1)^{i}x^{2i}}{i!}=1-\frac{x^2}{2}+\frac{x^4}{4!}-\frac{x^6}{6!}+\frac{x^8}{8!}- + \frac{x^{10}}{10!}+\frac{x^{12}}{12!}-\frac{x^{14}}{14!}\] -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,2) -\psset{arrowscale=2} -\pccurve[ArrowInside=->,ArrowInsidePos=0.65,showpoints=true]{*-*}(0,0)(2,2) -\naput[labelsep=0.3]{\large$h$} -\end{pspicture} -\end{LTXexample} +and of its first 15 derivatives. It is the sequence definition of +the cosine. -\begin{LTXexample}[width=2.5cm] -\begin{pspicture}(2,2) -\psset{arrowscale=2} -\pccurve[ArrowInside=->,ArrowInsideNo=3,showpoints=true]{|->}(0,0)(2,2) -\naput[labelsep=0.3]{\large$i$} +\begin{LTXexample}[pos=t,wide,preset=\centering] +\psset{unit=2} +\def\getColor#1{\ifcase#1 Tan\or RedOrange\or magenta\or yellow\or green\or Orange\or blue\or + DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or Mahogany\or + OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi} +\begin{pspicture}[showgrid=true](0,-1.2)(7,1.5) + \psclip{\psframe[linestyle=none](0,-1.1)(7,1.1)} + \multido{\in=0+1}{16}{% + \psplot[linewidth=1pt,algebraic=true,linecolor=\getColor{\in}]{0}{7} + {Derive(\in,1-x^2/2+x^4/24-x^6/720+x^8/40320-x^10/3628800+x^12/479001600-x^14/87178291200)}} + \endpsclip \end{pspicture} \end{LTXexample} - -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,4) -\psset{arrowscale=2} -\pccurve[ArrowInside=->,ArrowInsidePos=20]{|-|}(0,0)(4,4) -\naput[labelsep=0.3]{\large$k$} +\begin{LTXexample}[width=3.5cm] +\begin{pspicture}[shift=-2.5,showgrid=true,linewidth=1pt](0,-2)(3,3) + \psplot[algebraic=true]{.001}{3}{x*ln(x)} % f(x) + \psplot[algebraic=true,linecolor=red]{.05}{3}{Derive(1,x*ln(x))} % f'(x)=1+ln(x) \end{pspicture} \end{LTXexample} + \clearpage +\section{Variable step for plotting a curve} +\subsection{Theory} -\subsection{Special arrows \texttt{v--V},\texttt{t--T}, and \texttt{f--F}} +As you know with the \Lcs{psplot} macro, the curve is plotted +using a piece-wise linear curve. The step is given by the +parameter \Lkeyword{plotpoints}. For each step between $x_i$ and +$x_{i+1}$, the area defined between the curve and its +approximation (a segment) is majored by this formula : -Possible optional arguments are +\begin{minipage}[m]{.5\linewidth} +\[|\varepsilon|\le\frac{M_2(f)(x_{i+1}-x_i)^3}{12}\] -\psset{linecolor=black} +$M_2(f)$ is a majorant of the second derivative of $f$ in the interval $[x_i;x_{i+1}]$. +\end{minipage} +{\psset{unit=1cm, showpoints=false} +\begin{pspicture}[shift=-2,showgrid=true](0,-1)(6,3) + \pscurve(0,0)(1,1)(3,2.2)(5,2)(6,1)\psline(1,1)(5,2) + \psline(.5,0)(5.5,0)\psline(1,0)(1,1)\psline(5,0)(5,2) + \rput[t](1,-.1){$x_n$}\rput[t](5,-.1){$x_{n+1}$} + \psclip{\pscustom{\psecurve(0,0)(1,1)(3,2.2)(5,2)(6,1)\psline(5,2)}} + \psframe[fillstyle=solid, fillcolor=gray](0,0)(5,5) + \endpsclip + \rput*(3,1.8){$\varepsilon$} +\end{pspicture}} + + + +The parameter \Lkeyword{VarStep} (\false\ by default) activates +the variable step algorithm. It is set to a tolerance defined by +the parameter \Lkeyword{VarStepEpsilon} (\Lkeyval{default} by default, +accept real value). If this parameter is not set by the user, then +it is automatically computed using the default first step given by +the parameter \Lkeyword{plotpoints}. Then, for each step, $f''(x_n)$ +and $f''(x_{n+1})$ are computed and the smaller is used as +$M_2(f)$, and then the step is approximated. This means that the +step is constant for second order polynomials. + +\subsection{The cosine} + +Different value for the tolerance from $0.01$ to $0.000\,1$, a factor $10$ between +each of them. In black, there is the classic \Lcs{psplot} behavior, and in +magenta the default variable step behavior. \begin{center} -\begin{tabular}{l|l} -name & meaning\\\hline -\Lkeyword{veearrowlength} & default is 3mm\\ -\Lkeyword{veearrowangle} & default is 30\\ -\Lkeyword{veearrowlinewidth} & default is 0.35mm\\ -\Lkeyword{filledveearrowlength} & default is 3mm\\ -\Lkeyword{filledveearrowangle} & default is 15\\ -\Lkeyword{filledveearrowlinewidth} & default is 0.35mm\\ -\Lkeyword{tickarrowlength} & default is 1.5mm\\ -\Lkeyword{tickarrowlinewidth} & default is 0.35mm\\ -\end{tabular} +\bgroup +\psset{algebraic=true, VarStep=true, unit=2, showpoints=true, linecolor=red} +\begin{pspicture}(-0,-1)(3.14,2)\psgrid + \psplot[VarStepEpsilon=.01]{0}{3.14}{cos(x)} + \psplot[VarStepEpsilon=.001]{0}{3.14}{cos(x)+.15} + \psplot[VarStepEpsilon=.0001]{0}{3.14}{cos(x)+.3} + \psplot[linecolor=magenta]{0}{3.14}{cos(x)+.45} + \psplot[VarStep=false, linewidth=2\pslinewidth, linecolor=black]{-0}{3.14}{cos(x)+.6} +\end{pspicture} +\egroup \end{center} - -\begin{LTXexample}[width=4cm] -\psset{unit=5mm} -\begin{pspicture}(4,6) - \psset{dimen=middle,arrows=c-c, - arrowscale=2,linewidth=.25mm} - \psline[linecolor=red,linewidth=.05mm](0,0)(0,6) - \psline[linecolor=red,linewidth=.05mm](4,0)(4,6) - \psline{v-v}(0,6)(4,6) - \psline{v-V}(0,4)(4,4) - \psline{V-v}(0,2)(4,2) - \psline{V-V}(0,0)(4,0) +\begin{lstlisting} +\psset{algebraic=true, VarStep=true, unit=2, showpoints=true, linecolor=red} +\begin{pspicture}[showgrid=true](-0,-1)(3.14,2) + \psplot[VarStepEpsilon=.01]{0}{3.14}{cos(x)} + \psplot[VarStepEpsilon=.001]{0}{3.14}{cos(x)+.15} + \psplot[VarStepEpsilon=.0001]{0}{3.14}{cos(x)+.3} + \psplot[linecolor=magenta]{0}{3.14}{cos(x)+.45} + \psplot[VarStep=false,linewidth=1pt,linecolor=black]{-0}{3.14}{cos(x)+.6} \end{pspicture} -\end{LTXexample} +\end{lstlisting} -\begin{LTXexample}[width=4cm] -\psset{unit=5mm} -\begin{pspicture}(4,6) - \psset{dimen=middle,arrows=c-c, - arrowscale=2,linewidth=.25mm} - \psline[linecolor=red,linewidth=.05mm](0,0)(0,6) - \psline[linecolor=red,linewidth=.05mm](4,0)(4,6) - \psline{f-f}(0,6)(4,6) - \psline{f-F}(0,4)(4,4) - \psline{F-f}(0,2)(4,2) - \psline{F-F}(0,0)(4,0) -\end{pspicture} -\end{LTXexample} +\subsection{The Napierian Logarithm} +A really classic example which gives a bad beginning, the tolerance is set to $0.001$. -\begin{LTXexample}[width=4cm] -\psset{unit=5mm} -\begin{pspicture}(4,6) - \psset{dimen=middle,arrows=c-c,linewidth=.25mm} - \psline[linecolor=red,linewidth=.05mm](0,0)(0,6) - \psline[linecolor=red,linewidth=.05mm](4,0)(4,6) - \psline{t-t}(0,6)(4,6) - \psline{t-T}(0,4)(4,4) - \psline{T-t}(0,2)(4,2) - \psline{T-T}(0,0)(4,0) +\begin{center} +\bgroup +\psset{algebraic=true, VarStep=true, linecolor=red, showpoints=true} +\begin{pspicture}[showgrid=true](0,-5)(16,4) + \psplot[VarStep=false, linecolor=black]{.01}{16}{ln(x)+1} + \psplot[linecolor=magenta]{.51}{16}{ln(x-1/2)+1/2} + \psplot[VarStepEpsilon=.001]{1.01}{16}{ln(x-1)} + \psplot[VarStepEpsilon=.01]{1.51}{16}{ln(x-1.5)-100/200} \end{pspicture} -\end{LTXexample} +\egroup +\end{center} -\subsection{Special arrow option \texttt{arrowLW}} +\begin{lstlisting} +\psset{algebraic=true, VarStep=true, linecolor=red, showpoints=true} +\begin{pspicture}[showgrid=true](0,-5)(16,4) + \psplot[VarStep=false, linecolor=black]{.01}{16}{ln(x)+1} + \psplot[linecolor=magenta]{.51}{16}{ln(x-1/2)+1/2} + \psplot[VarStepEpsilon=.001]{1.01}{16}{ln(x-1)} + \psplot[VarStepEpsilon=.01]{1.51}{16}{ln(x-1.5)-100/200} +\end{pspicture} +\end{lstlisting} -Only for the arrowtype \Lnotation{o} and \Lnotation{*} it is possible to -set the arrowlinewidth with the optional keyword \Lkeyword{arrowLW}. -When scaling an arrow by the keyword \Lkeyword{arrowscale} the width -of the borderline is also scaled. With the optional argument -\Lkeyword{arrowLW} the line width can be set separately and is not -taken into account by the scaling value. -\begin{LTXexample}[width=4cm] -\begin{pspicture}(4,6) -\psline[arrowscale=3,arrows=*-o](0,5)(4,5) -\psline[arrowscale=3,arrows=*-o, - arrowLW=0.5pt](0,3)(4,3) -\psline[arrowscale=3,arrows=*-o, - arrowLW=0.3333\pslinewidth](0,1)(4,1) +\clearpage +\subsection{Sine of the inverse of $x$} +Impossible to draw, but let's try! + +\begin{center} +\bgroup +\psset{xunit=64,algebraic=true,VarStep,linecolor=red,showpoints=true,linewidth=1pt} +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStepEpsilon=.0001]{.01}{.25}{sin(1/x)} +\end{pspicture}\\ +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStepEpsilon=.00001]{.01}{.25}{sin(1/x)} +\end{pspicture}\\ +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStepEpsilon=.000001]{.01}{.25}{sin(1/x)} +\end{pspicture}\\ +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStep=false, linecolor=black]{.01}{.25}{sin(1/x)} \end{pspicture} -\end{LTXexample} +\egroup +\end{center} +\begin{lstlisting} +\psset{xunit=64,algebraic=true,VarStep,linecolor=red,showpoints=true,linewidth=1pt} +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStepEpsilon=.0001]{.01}{.25}{sin(1/x)} +\end{pspicture}\\ +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStepEpsilon=.00001]{.01}{.25}{sin(1/x)} +\end{pspicture}\\ +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStepEpsilon=.000001]{.01}{.25}{sin(1/x)} +\end{pspicture}\\ +\begin{pspicture}[showgrid=true](0,-1)(.5,1) + \psplot[VarStep=false, linecolor=black]{.01}{.25}{sin(1/x)} +\end{pspicture} +\end{lstlisting} -\clearpage -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psFormatInt}} -%-------------------------------------------------------------------------------------- -There exist some packages and a lot of code to format an integer like $1\,000\,000$ -or $1,234,567$ (in Europe $1.234.567$). But all packages expect a real number as -argument and cannot handle macros as an argument. For this case \LPack{pstricks-add} -has a macro \Lcs{psFormatInt} which can handle both: -\begin{LTXexample}[width=3cm] -\psFormatInt{1234567}\\ -\psFormatInt[intSeparator={,}]{1234567}\\ -\psFormatInt[intSeparator=.]{1234567}\\ -\psFormatInt[intSeparator=$\cdot$]{1234567}\\ -\def\temp{965432} -\psFormatInt{\temp} -\end{LTXexample} -With the option \Lkeyword{intSeparator} the symbol can be changed to any any non-number character. -%-------------------------------------------------------------------------------------- -\section{Color} -%-------------------------------------------------------------------------------------- -%-------------------------------------------------------------------------------------- -\subsection{Transparent colors} -%-------------------------------------------------------------------------------------- +\clearpage +\subsection{A really complecated function} -Transparency is now part of the main \texttt{pstricks} package. -But pay attention, the names and syntax have changed and you need -to run \Lprog{ps2pdf} with the option -\Loption{-dCompatibilityLevel}=1.4. +Just appreciate the difference between the normal behavior and the plotting with the +\Lkeyword{varStep} option. The function is: +\[f(x)=x-\frac{x^2}{10}+\ln(x)+\cos(2x)+\sin(x^2)-1\] -%-------------------------------------------------------------------------------------- -\subsection{,,Manipulating transparent colors''} -%-------------------------------------------------------------------------------------- +\begin{center} +\bgroup +\psset{xunit=3, algebraic=true, VarStep, showpoints=true} +\begin{pspicture}[showgrid=true](0,-2)(5,6) + \psplot[VarStepEpsilon=.0005, linecolor=red]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)} + \psplot[linecolor=magenta]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)+.5} + \psplot[VarStep=false]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)-1} +\end{pspicture} +\egroup +\end{center} -\LPack{pstricks-add} supports real transparency and a simulated one with hatch lines: \begin{lstlisting} -\def\defineTColor{\@ifnextchar[{\defineTColor@i}{\defineTColor@i[]}} -\def\defineTColor@i[#1]#2#3{% transparency "Colors" - \newpsstyle{#2}{% - fillstyle=vlines,hatchwidth=0.1\pslinewidth, - hatchsep=1\pslinewidth,hatchcolor=#3,#1% - }% -} -\defineTColor{TRed}{red} -\defineTColor{TGreen}{green} -\defineTColor{TBlue}{blue} +\psset{xunit=3, algebraic=true, VarStep, showpoints=true} +\begin{pspicture}[showgrid=true](0,-2)(5,6) + \psplot[VarStepEpsilon=.0005, linecolor=red]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)} + \psplot[linecolor=magenta]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)+.5} + \psplot[VarStep=false]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)-1} +\end{pspicture} \end{lstlisting} -There are three predefined "'transparent"` colors \verb+TRed+, -\verb+TGreen+, \verb+TBlue+. They are used as \PST{} styles and -not as colors: -\resetOptions +\clearpage +\subsection{A hyperbola} + +\begin{center} \bgroup -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(-3,-5)(5,5) -\psframe(-1,-3)(5,5) % objet de base -\psrotate(2,-2){15}{% - \psframe[style=TRed](-1,-3)(5,5)} -\psrotate(2,-2){30}{% - \psframe[style=TGreen](-1,-3)(5,5)} -\psrotate(2,-2){45}{% - \psframe[style=TBlue](-1,-3)(5,5)} -\psframe[linewidth=3pt](-1,-3)(5,5) -\psdots[dotstyle=+,dotangle=45,dotscale=3](2,-2) % centre de la rotation +\psset{algebraic=true, showpoints=true, unit=0.75} +\begin{pspicture}(-5,-4)(9,6) + \psplot[linecolor=black]{-5}{1.8}{(x-1)/(x-2)} + \psplot[VarStep=true, VarStepEpsilon=.001, linecolor=red]{2.2}{9}{(x-1)/(x-2)} + \psaxes{->}(0,0)(-5,-4)(9,6) \end{pspicture} -\end{LTXexample} \egroup +\end{center} -%-------------------------------------------------------------------------------------- -\subsection{Calculated colors} -%-------------------------------------------------------------------------------------- -The \verb+xcolor+ package (version 2.6) has a new feature for defining colors: -\begin{lstlisting}[style=syntax] - \definecolor[ps]{}{}{< PS code >} +\begin{lstlisting} +\psset{algebraic=true, showpoints=true, unit=0.75} +\begin{pspicture}(-5,-4)(9,6) + \psplot[linecolor=black]{-5}{1.8}{(x-1)/(x-2)} + \psplot[VarStep=true, VarStepEpsilon=.001, linecolor=red]{2.2}{9}{(x-1)/(x-2)} + \psaxes{->}(0,0)(-5,-4)(9,6) +\end{pspicture} \end{lstlisting} -\verb+model+ can be one of the color models, which \PS will -understand, e.g. \verb+rgb+. With this definition the color is -calculated on the \PS side. -\begin{LTXexample}[pos=t,preset=\centering] -\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}% -\psset{unit=1bp} -\begin{pspicture}(0,-30)(400,100) -\multido{\iLAMBDA=0+1}{400}{% - \pstVerb{ - \iLAMBDA\space 379 add dup /lambda exch def - tx@addDict begin wavelengthToRGB end - }% - \psline[linecolor=bl](\iLAMBDA,0)(\iLAMBDA,100)% -} -\psaxes[yAxis=false,Ox=350,dx=50bp,Dx=50]{->}(-29,-10)(420,100) -\uput[-90](420,-10){$\lambda$[\textsf{nm}]} -\end{pspicture} -\end{LTXexample} -\begin{center} -\newcommand{\Touch}{% -\psframe[linestyle=none,fillstyle=solid,fillcolor=bl,dimen=middle](0.1,0.75)} -\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}% -% Echelle 1cm <-> 40 nm -% 1 nm <-> 0.025 cm -\psframebox[fillstyle=solid,fillcolor=black]{% -\begin{pspicture}(-1,-0.5)(12,1.5) -\multido{\iLAMBDA=380+2}{200}{% - \pstVerb{ - /lambda \iLAMBDA\space def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! lambda 0.025 mul 9.5 sub 0){\Touch} -} -\multido{\n=0+1,\iDiv=380+40}{11}{% - \psline[linecolor=white](\n,0.1)(\n,-0.1) - \uput[270](\n,0){\textbf{\white\iDiv}}} - \psline[linecolor=white]{->}(11,0) - \uput[270](11,0){\textbf{\white$\lambda$(nm)}} -\end{pspicture}} +\clearpage +\subsection{Using \nxLcs{parametricplot}} -\psframebox[fillstyle=solid,fillcolor=black]{% -\begin{pspicture}(-1,-0.5)(12,1) - \pstVerb{ - /lambda 656 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 656 0.025 mul 9.5 sub 0){\Touch} - \pstVerb{ - /lambda 486 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 486 0.025 mul 9.5 sub 0){\Touch} - \pstVerb{ - /lambda 434 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 434 0.025 mul 9.5 sub 0){\Touch} - \pstVerb{ - /lambda 410 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 410 0.025 mul 9.5 sub 0){\Touch} -\multido{\n=0+1,\iDiv=380+40}{11}{% - \psline[linecolor=white](\n,0.1)(\n,-0.1) - \uput[270](\n,0){\textbf{\white\iDiv}}} - \psline[linecolor=white]{->}(11,0) - \uput[270](11,0){\textbf{\white$\lambda$(nm)}} -\end{pspicture}} +\begin{BDef} +\Lcs{parametricplot}\OptArgs\Largb{t0}\Largb{t1}\OptArg{PS commands}\Largb{x(t) y(t)} +\end{BDef} -\Index{Spectrum} of \Index{hydrogen} emission (Manuel Luque) +\begin{center} +\bgroup +\psset{unit=2.5} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, + VarStepEpsilon=.0001] + {-3.14}{3.14}{cos(3*t)|sin(2*t)} +\end{pspicture} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, + VarStepEpsilon=.0001] + {-3.14}{3.14}{cos(3*t)|sin(2*t)} +\end{pspicture} +\egroup \end{center} \begin{lstlisting} -\newcommand{\Touch}{% -\psframe[linestyle=none,fillstyle=solid,fillcolor=bl,dimen=middle](0.1,0.75)} -\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}% -% Echelle 1cm <-> 40 nm -% 1 nm <-> 0.025 cm -\psframebox[fillstyle=solid,fillcolor=black]{% -\begin{pspicture}(-1,-0.5)(12,1.5) -\multido{\iLAMBDA=380+2}{200}{% - \pstVerb{ - /lambda \iLAMBDA\space def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! lambda 0.025 mul 9.5 sub 0){\Touch} -} -\multido{\n=0+1,\iDiv=380+40}{11}{% - \psline[linecolor=white](\n,0.1)(\n,-0.1) - \uput[270](\n,0){\textbf{\white\iDiv}}} - \psline[linecolor=white]{->}(11,0) - \uput[270](11,0){\textbf{\white$\lambda$(nm)}} -\end{pspicture}} - -\psframebox[fillstyle=solid,fillcolor=black]{% -\begin{pspicture}(-1,-0.5)(12,1) - \pstVerb{ - /lambda 656 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 656 0.025 mul 9.5 sub 0){\Touch} - \pstVerb{ - /lambda 486 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 486 0.025 mul 9.5 sub 0){\Touch} - \pstVerb{ - /lambda 434 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 434 0.025 mul 9.5 sub 0){\Touch} - \pstVerb{ - /lambda 410 def - lambda - tx@addDict begin wavelengthToRGB end - }% - \rput(! 410 0.025 mul 9.5 sub 0){\Touch} -\multido{\n=0+1,\iDiv=380+40}{11}{% - \psline[linecolor=white](\n,0.1)(\n,-0.1) - \uput[270](\n,0){\textbf{\white\iDiv}}} - \psline[linecolor=white]{->}(11,0) - \uput[270](11,0){\textbf{\white$\lambda$(nm)}} -\end{pspicture}} - -Spectrum of hydrogen emission (Manuel Luque) +\psset{unit=3} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, + VarStepEpsilon=.0001] + {-3.14}{3.14}{cos(3*t)|sin(2*t)} +\end{pspicture} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, + VarStepEpsilon=.0001] + {-3.14}{3.14}{cos(3*t)|sin(2*t)} +\end{pspicture} \end{lstlisting} +\begin{center} +\bgroup +\psset{unit=2.5} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, + VarStepEpsilon=.0001] + {0}{47.115}{cos(5*t)|sin(3*t)} +\end{pspicture} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, + VarStepEpsilon=.0001] + {0}{47.115}{cos(5*t)|sin(3*t)} +\end{pspicture} +\egroup +\end{center} -%-------------------------------------------------------------------------------------- -\subsection{Gouraud shading} -%-------------------------------------------------------------------------------------- -\begin{quotation} -\Index{Gouraud} shading is a method used in computer graphics to simulate the differing effects of -light and colour across the surface of an object. In practice, Gouraud shading is used to -achieve smooth lighting on low-polygon surfaces without the heavy computational requirements -of calculating lighting for each pixel. The technique was first presented by Henri Gouraud in 1971.\\ -~\hfill{\small \url{http://www.wikipedia.org}} -\end{quotation} - -PostScript level 3 supports this kind of shading and it can only -be seen with Acroread 7 or later. The syntax is easy: - -\begin{lstlisting}[style=syntax] - \psGTriangle(x1,y1)(x2,y2)(x3,y3){color1}{color2}{color3} +\begin{lstlisting} +\psset{unit=2.5} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, + VarStepEpsilon=.0001] + {0}{47.115}{cos(5*t)|sin(3*t)} +\end{pspicture} +\begin{pspicture}[showgrid=true](-1,-1)(1,1) +\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, + VarStepEpsilon=.0001] + {0}{47.115}{cos(5*t)|sin(3*t)} +\end{pspicture} \end{lstlisting} -\psset{unit=0.75cm} -\resetOptions -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(0,-.25)(10,10) - \psGTriangle(0,0)(5,10)(10,0){red}{green}{blue} +\begin{center} +\bgroup +\psset{xunit=.5} +\begin{pspicture}[showgrid=true](0,0)(12.566,2) +\parametricplot[algebraic=true,linecolor=red,VarStep, showpoints=true, + VarStepEpsilon=.01]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} \end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(0,-.25)(10,10) - \psGTriangle*(0,0)(9,10)(10,3){black}{white!50}{red!50!green!95} +% +\begin{pspicture}[showgrid=true](0,0)(12.566,2) +\parametricplot[algebraic=true,linecolor=blue,VarStep, showpoints=false, + VarStepEpsilon=.001]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} \end{pspicture} -\end{LTXexample} +\egroup +\end{center} -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(0,-.25)(10,10) - \psGTriangle*(0,0)(5,10)(10,0){-red!100!green!84!blue!86} - {-red!80!green!100!blue!40} - {-red!60!green!30!blue!100} +\begin{lstlisting} +\psset{xunit=.5} +\begin{pspicture}[showgrid=true](0,0)(12.566,2) +\parametricplot[algebraic=true,linecolor=red,VarStep, showpoints=true, + VarStepEpsilon=.01]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} \end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\definecolor{rose}{rgb}{1.00, 0.84, 0.88} -\definecolor{vertpommepasmure}{rgb}{0.80, 1.0, 0.40} -\definecolor{fushia}{rgb}{0.60, 0.30, 1.0} -\begin{pspicture}(0,-.25)(10,10) - \psGTriangle(0,0)(5,10)(10,0){rose}{vertpommepasmure}{fushia} +% +\begin{pspicture}[showgrid=true](0,0)(12.566,2) +\parametricplot[algebraic=true,linecolor=blue,VarStep, showpoints=false, + VarStepEpsilon=.001]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} \end{pspicture} -\end{LTXexample} +\end{lstlisting} -\newpage -%-------------------------------------------------------------------------------------- -\part{\nxLPack{pst-node}} -%-------------------------------------------------------------------------------------- +\section{New math functions and their derivatives} -%-------------------------------------------------------------------------------------- -\section{Relative nodes with \nxLcs{psGetNodeCenter}} -%-------------------------------------------------------------------------------------- -The command \Lcs{psGetNodeCenter}\Largb{node} makes sense only at -the PostScript level. It defines the two variables \Larg{node.x} -and \Larg{node.y} which can be used to define relative nodes. The -following example defines the node \verb+MyNode+ and a second one -relative to the first one, with 4 units left and 4 units up. -\Larg{node} must be an existing node name. +\subsection{The inverse sine and its derivative} -\begin{LTXexample}[width=5cm] -\begin{pspicture}[showgrid=true,arrowscale=2](5,5) -\pnode(4.5,0.5){MyNode} -\psdot(MyNode) -\pnode(! \psGetNodeCenter{MyNode} - MyNode.x 4 sub MyNode.y 4 add){MySecondNode} -\psdot(MySecondNode) -\ncline[linecolor=red]{<->}{MyNode}{MySecondNode} +\begin{center} +\bgroup +\psset{unit=1.5} +\begin{pspicture}[showgrid=true](-1,-2)(1,2) + \psplot[linecolor=blue,algebraic=true]{-1}{1}{asin(x)} \end{pspicture} -\end{LTXexample} - - -%-------------------------------------------------------------------------------------- -\section{\nxLcs{ncdiag} and \nxLcs{pcdiag}} -%-------------------------------------------------------------------------------------- -With the new option \Lkeyword{lineAngle} the lines drawn by the \Lcs{ncdiag} macro -can now have a specified gradient. Without this option one has to define the two -arms (which maybe zero) and PSTricks draws the connection between them. Now there -is only a static \Lkeyword{armA}, the second one \Lkeyword{armB} is calculated when an angle -\Lkeyword{lineAngle} is defined. This angle is the gradient of the intermediate line -between the two arms. The syntax of \Lcs{ncdiag} is +\hspace{1em} +\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,-2)(1,2) + \psplot[linecolor=blue]{-.999}{.999}{asin(x)} +\end{pspicture} +\hspace{1em} +\begin{pspicture}[showgrid=true](-1,0)(1,4) + \psplot[linecolor=blue]{-.97}{.97}{Derive(1,asin(x))} +\end{pspicture} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.0001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,0)(1,4) + \psplot[linecolor=blue]{-.97}{.97}{Derive(1,asin(x))} +\end{pspicture} +\egroup +\end{center} -\begin{lstlisting}[style=syntax] -\ncdiag[]{}{} -\pcdiag[]()() +\begin{lstlisting} +\psset{unit=1.5} +\begin{pspicture}[showgrid=true](-1,-2)(1,2) + \psplot[linecolor=blue,algebraic=true]{-1}{1}{asin(x)} +\end{pspicture} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,-2)(1,2) + \psplot[linecolor=blue]{-.999}{.999}{asin(x)} +\end{pspicture} +\hspace{1em} +\begin{pspicture}[showgrid=true](-1,0)(1,4) + \psplot[linecolor=red]{-.97}{.97}{Derive(1,asin(x))} +\end{pspicture} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.0001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,0)(1,4) + \psplot[linecolor=red]{-.97}{.97}{Derive(1,asin(x))} +\end{pspicture} \end{lstlisting} -\begin{tabularx}{\linewidth}{l|X} -name & meaning\\\hline -\verb|lineAngle| & angle of the intermediate line segment. Default is 0, which is the same -than using \Lcs{ncdiag} without the \Lkeyword{lineAngle} option.\tabularnewline -\end{tabularx} +\subsection{The inverse cosine and its derivative} +\begin{center} +\bgroup +\psset{unit=1.5} +\begin{pspicture}[showgrid=true](-1,0)(1,3) + \psplot[linecolor=blue,algebraic=true]{-1}{1}{acos(x)} +\end{pspicture} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,0)(1,3) + \psplot[linecolor=blue]{-.999}{.999}{acos(x)} +\end{pspicture} +\hspace{1em} +\begin{pspicture}[showgrid=true](-1,-4)(1,-1) + \psplot[linecolor=blue]{-.97}{.97}{Derive(1,acos(x))} +\end{pspicture} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.0001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,-4)(1,-1) + \psplot[linecolor=blue]{-.97}{.97}{Derive(1,acos(x))} +\end{pspicture} +\egroup +\end{center} -\resetOptions -\begin{LTXexample}[width=5.5cm] -\begin{pspicture}(5,6) - \circlenode{A}{A}\quad\circlenode{C}{C}% - \quad\circlenode{E}{E} - \rput(0,4){\circlenode{B}{B}} - \rput(1,5){\circlenode{D}{D}} - \rput(2,6){\circlenode{F}{F}} - \psset{arrowscale=2,linearc=0.2,% - linecolor=red,armA=0.5, angleA=90,angleB=-90} - \ncdiag[lineAngle=20]{->}{A}{B} - \ncput*[nrot=:U]{line I} - \ncdiag[lineAngle=20]{->}{C}{D} - \ncput*[nrot=:U]{line II} - \ncdiag[lineAngle=20]{->}{E}{F} - \ncput*[nrot=:U]{line III} +\begin{lstlisting} +\psset{unit=1.5} +\begin{pspicture}[showgrid=true](-1,0)(1,3) + \psplot[linecolor=blue,algebraic=true]{-1}{1}{acos(x)} \end{pspicture} -\end{LTXexample} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,0)(1,3) + \psplot[linecolor=blue]{-.999}{.999}{acos(x)} +\end{pspicture} +\hspace{1em} +\begin{pspicture}[showgrid=true](-1,-4)(1,-1) + \psplot[linecolor=red]{-.97}{.97}{Derive(1,acos(x))} +\end{pspicture} +\hspace{1em} +\psset{algebraic=true, VarStep, VarStepEpsilon=.0001, showpoints=true} +\begin{pspicture}[showgrid=true](-1,-4)(1,-1) + \psplot[linecolor=red]{-.97}{.97}{Derive(1,acos(x))} +\end{pspicture} +\end{lstlisting} -The \Lcs{ncdiag} macro sets the \Lkeyword{armB} dynamically to the calculated value. Any -user setting of \Lkeyword{armB} is overwritten by the macro. The \Lkeyword{armA} could be set to -a zero length: +\subsection{The inverse tangent and its derivative} -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,3) - \rput(0.5,0.5){\circlenode{A}{A}} - \rput(3.5,3){\circlenode{B}{B}} - {\psset{linecolor=red,arrows=<-,arrowscale=2} - \ncdiag[lineAngle=60,% - armA=0,angleA=0,angleB=180]{A}{B} - \ncdiag[lineAngle=60,% - armA=0,angleA=90,angleB=180]{A}{B}} +\begin{center} +\bgroup +\begin{pspicture}[showgrid=true](-4,-2)(4,2) +\psset{algebraic=true} + \psplot[linecolor=blue,linewidth=1pt]{-4}{4}{atg(x)} + \psplot[linecolor=red,VarStep, VarStepEpsilon=.0001, showpoints=true]{-4}{4}{Derive(1,atg(x))} \end{pspicture} -\end{LTXexample} - - -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,3) - \rput(1,0.5){\circlenode{A}{A}} - \rput(4,3){\circlenode{B}{B}} - {\psset{linecolor=red,arrows=<-,arrowscale=2} - \ncdiag[lineAngle=60,% - armA=0.5,angleA=0,angleB=180]{A}{B} - \ncdiag[lineAngle=60,% - armA=0,angleA=70,angleB=180]{A}{B} - \ncdiag[lineAngle=60,% - armA=0.5,angleA=180,angleB=180]{A}{B}} +\hspace{1em} +\begin{pspicture}[showgrid=true](-4,-2)(4,2) +\psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=blue]{-4}{4}{atg(x)} + \psplot[linecolor=red]{-4}{4}{Derive(1,atg(x))} \end{pspicture} -\end{LTXexample} +\egroup +\end{center} -\begin{LTXexample}[width=4.5cm] -\begin{pspicture}(4,5.5) - \cnode*(0,0){2pt}{A}% - \cnode*(0.25,0){2pt}{C}% - \cnode*(0.5,0){2pt}{E}% - \cnode*(0.75,0){2pt}{G}% - \cnode*(2,4){2pt}{B}% - \cnode*(2.5,4.5){2pt}{D}% - \cnode*(3,5){2pt}{F}% - \cnode*(3.5,5.5){2pt}{H}% - {\psset{arrowscale=2,linearc=0.2,% - linecolor=red,armA=0.5, angleA=90,angleB=-90} - \pcdiag[lineAngle=20]{->}(A)(B) - \pcdiag[lineAngle=20]{->}(C)(D) - \pcdiag[lineAngle=20]{->}(E)(F) - \pcdiag[lineAngle=20]{->}(G)(H)} +\begin{lstlisting} +\begin{pspicture}[showgrid=true](-4,-2)(4,2) +\psset{algebraic=true} + \psplot[linecolor=blue,linewidth=1pt]{-4}{4}{atg(x)} + \psplot[linecolor=red,VarStep, VarStepEpsilon=.0001, showpoints=true]{-4}{4}{Derive(1,atg(x))} +\end{pspicture} +\hspace{1em} +\begin{pspicture}[showgrid=true](-4,-2)(4,2) +\psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=blue]{-4}{4}{atg(x)} + \psplot[linecolor=red]{-4}{4}{Derive(1,atg(x))} \end{pspicture} -\end{LTXexample} - - -%-------------------------------------------------------------------------------------- -\section{\nxLcs{ncdiagg} and \nxLcs{pcdiagg}} -%-------------------------------------------------------------------------------------- -This is nearly the same as \Lcs{ncdiag} except that -\Lkeyword{armB}=0 and the \Lkeyword{angleB} value is computed by the -macro, so that the line ends at the node with an angle like a -\Lcs{pcdiagg} line. The syntax of \Lcs{ncdiagg}/\Lcs{pcdiagg} -is - -\begin{lstlisting}[style=syntax] -\ncdiag[]{}{} -\pcdiag[]()() \end{lstlisting} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(4,6) - \psset{linecolor=black} - \circlenode{A}{A}% - \quad\circlenode{C}{C}% - \quad\circlenode{E}{E} - \rput(0,4){\circlenode{B}{B}} - \rput(1,5){\circlenode{D}{D}} - \rput(2,6){\circlenode{F}{F}} - {\psset{arrowscale=2,linearc=0.2,linecolor=red,armA=0.5, angleA=90} - \ncdiagg[lineAngle=-160]{->}{A}{B} - \ncput*[nrot=:U]{line I} - \ncdiagg[lineAngle=-160]{->}{C}{D} - \ncput*[nrot=:U]{line II} - \ncdiagg[lineAngle=-160]{->}{E}{F} - \ncput*[nrot=:U]{line III}} +\subsection{Hyperbolic functions} + +\begin{center} +\bgroup +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} + \psaxes{->}(0,0)(-3,-4)(3,4) \end{pspicture} -\end{LTXexample} +\hspace{1em} +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} + \psaxes{->}(0,0)(-3,-4)(3,4) +\end{pspicture} +\egroup +\end{center} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(4,6) - \psset{linecolor=black} - \cnode*(0,0){2pt}{A}% - \cnode*(0.25,0){2pt}{C}% - \cnode*(0.5,0){2pt}{E}% - \cnode*(0.75,0){2pt}{G}% - \cnode*(2,4){2pt}{B}% - \cnode*(2.5,4.5){2pt}{D}% - \cnode*(3,5){2pt}{F}% - \cnode*(3.5,5.5){2pt}{H}% - {\psset{arrowscale=2,linearc=0.2,linecolor=red,armA=0.5, angleA=90} - \pcdiagg[lineAngle=20]{->}(A)(B) - \pcdiagg[lineAngle=20]{->}(C)(D) - \pcdiagg[lineAngle=20]{->}(E)(F) - \pcdiagg[lineAngle=20]{->}(G)(H)} +\begin{lstlisting} +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} + \psaxes{->}(0,0)(-3,-4)(3,4) \end{pspicture} -\end{LTXexample} +\hspace{1em} +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} + \psaxes{->}(0,0)(-3,-4)(3,4) +\end{pspicture} +\end{lstlisting} -The only catch for \Lcs{ncdiagg} is that you need the right -value for \Lkeyword{lineAngle}. If the node connection is on the wrong -side of the second node, then choose the corresponding angle, -e.\,g.: if $20$ is wrong then take $-160$, which differs by $180$. -\begin{LTXexample}[width=4cm] -\begin{pspicture}(4,1.5) - \circlenode{a}{A} - \rput[l](3,1){\rnode{b}{H}} - \ncdiagg[lineAngle=60,angleA=180,armA=.5,nodesepA=3pt,linecolor=blue]{b}{a} +\begin{center} +\bgroup +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} + \psaxes{->}(0,0)(-3,-4)(3,4) \end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=4cm] -\begin{pspicture}(4,1.5) - \circlenode{a}{A} - \rput[l](3,1){\rnode{b}{H}} - \ncdiagg[lineAngle=60,armA=.5,nodesepB=3pt,linecolor=blue]{a}{b} +\hspace{1em} +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} + \psaxes{->}(0,0)(-3,-4)(3,4) \end{pspicture} -\end{LTXexample} +\egroup +\end{center} -\begin{LTXexample}[width=4cm] -\begin{pspicture}(4,1.5) - \circlenode{a}{A} - \rput[l](3,1){\rnode{b}{H}} - \ncdiagg[lineAngle=-120,armA=.5,nodesepB=3pt,linecolor=blue]{a}{b} +\begin{lstlisting} +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true,linewidth=1pt} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} + \psaxes{->}(0,0)(-3,-4)(3,4) \end{pspicture} -\end{LTXexample} +\hspace{1em} +\begin{pspicture}(-3,-4)(3,4) +\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} + \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} + \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} + \psaxes{->}(0,0)(-3,-4)(3,4) +\end{pspicture} +\end{lstlisting} -%-------------------------------------------------------------------------------------- -\section{\nxLcs{ncbarr}} -%-------------------------------------------------------------------------------------- -This has the same behaviour as \Lcs{ncbar}, but has 5 segments -and all are horizontal ones. This is the reason why \Lkeyword{angleA} -must be $0$ or alternatively $180$. All other values are set to -$0$ by the macro. The intermediate horizontal line is symmetrical -to the distance of the two nodes. -\begin{LTXexample}[width=3.5cm] -\psset{arrowscale=2}% -\circlenode{X}{X}\\[1cm] -\circlenode{Y}{Y} -\ncbarr[angleA=0,arrows=->,arrowscale=2]{X}{Y} -\end{LTXexample} +\begin{center} +\bgroup +\begin{pspicture}(-7,-3)(7,3) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} + \psplot[linecolor=blue,linewidth=1pt]{1}{7}{Argch(x)} + \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} + \psaxes{->}(0,0)(-7,-3)(7,3) +\end{pspicture}\\[\baselineskip] +\begin{pspicture}(-7,-3)(7,3) + \psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} + \psplot[linecolor=blue,linewidth=1pt]{1.001}{7}{Argch(x)} + \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} + \psaxes{->}(0,0)(-7,-3)(7,3) +\end{pspicture} +\egroup +\end{center} -\begin{LTXexample}[width=3.5cm] -\psset{arrowscale=2}% -\ovalnode{X}{Xxxxx}\\[1cm] -\circlenode{Y}{Yyyy} -\ncbarr[angleA=180,arrows=->,arrowscale=2,linecolor=red]{X}{Y} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\psset{arrowscale=2}% -\ovalnode{X}{Xxxxx}\\[1cm] -\circlenode{Y}{Yyyy} -\ncbarr[angleA=20,arm=1cm,arrows=->,arrowscale=2]{X}{Y} -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psRelNode} and \nxLcs{psDefPSPNodes}} -%-------------------------------------------------------------------------------------- -With these macros it is possible to put a node relative to a given line or given -\Lenv{pspicture}-environment. In the frist case the parameters are -the angle and the length factor: -\begin{lstlisting}[style=syntax] -\psRelNode()(){}{} -\psRelLine[]()(){}{} +\begin{lstlisting} +\begin{pspicture}(-7,-3)(7,3) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} + \psplot[linecolor=blue,linewidth=1pt]{1}{7}{Argch(x)} + \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} + \psaxes{->}(0,0)(-7,-3)(7,3) +\end{pspicture}\\[\baselineskip] +\begin{pspicture}(-7,-3)(7,3) + \psset{algebraic=true, VarStep, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} + \psplot[linecolor=blue,linewidth=1pt]{1.001}{7}{Argch(x)} + \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} + \psaxes{->}(0,0)(-7,-3)(7,3) +\end{pspicture} \end{lstlisting} -The length factor relates to the distance $\overline{P_0P_1}$ and -the end node name must be a valid nodename and shouldn't contain -any of the special PostScript characters. There are two valid -options: -\begin{tabularx}{\linewidth}{@{} l|l| X @{} } -name & default & meaning\\\hline -\Lkeyword{angle} & $0$ & angle between the given line $\overline{P_0P_1}$ and the new one - $\overline{P_0P_{endNode}}$\tabularnewline -\Lkeyword{trueAngle} & \false & defines whether the angle refers to the seen line or to -the mathematical one, which respect the scaling factors -\Lkeyword{xunit} and \Lkeyword{yunit}. -\end{tabularx} -\begin{LTXexample}[width=7cm] -\begin{pspicture}(7,6) - \psgrid[gridwidth=0pt,gridcolor=gray,gridlabels=0pt,subgriddiv=2] - \pnode(3,3){A}\pnode(4,2){B} - \psline[nodesep=-3,linewidth=0.5pt](A)(B) - \multido{\iA=0+30}{12}{% - \psRelNode[angle=\iA](A)(B){2}{C}% - \qdisk(C){2pt} - \uput[0](C){\iA}} +\begin{center} +\bgroup +\begin{pspicture}(-7,-0.5)(7,6) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} + \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} + \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} + \psaxes{->}(0,0)(-7,0)(7,6) +\end{pspicture}\\[\baselineskip] +\begin{pspicture}(-7,-0.5)(7,6) +\psset{algebraic=true} + \psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} + \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} + \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} + \psaxes{->}(0,0)(-7,0)(7,6) \end{pspicture} -\end{LTXexample} - -In the second case the new macro \Lcs{psDefPSPNodes} defines nine nodes that corresponds to -nine particular points (namely bottom left, bottom center, -bottom right, center left, center center, center right, top left, -top center, top right) of the \Lenv{pspicture} box. +\egroup +\end{center} -\begin{LTXexample}[width=6cm,wide=false] -\begin{pspicture}[showgrid=true](-1,-1)(4,4) - \psDefPSPNodes - \psdots(PSPbl)(PSPbc)(PSPbr) - (PSPcl)(PSPcc)(PSPcr)(PSPtl)(PSPtc)(PSPtr) - \uput[90](PSPbl){PSPbl} \uput[90](PSPbc){PSPbc} - \uput[90](PSPbr){PSPbr} \uput[90](PSPcl){PSPcl} - \uput[90](PSPcc){PSPcc} \uput[90](PSPcr){PSPcr} - \uput[90](PSPtl){PSPtl} \uput[90](PSPtc){PSPtc} - \uput[90](PSPtr){PSPtr} +\begin{lstlisting} +\begin{pspicture}(-7,-0.5)(7,6) +\psset{algebraic=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} + \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} + \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} + \psaxes{->}(0,0)(-7,0)(7,6) +\end{pspicture}\\[\baselineskip] +\begin{pspicture}(-7,-0.5)(7,6) +\psset{algebraic=true} + \psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} + \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} + \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} + \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} + \psaxes{->}(0,0)(-7,0)(7,6) \end{pspicture} -\end{LTXexample} +\end{lstlisting} -The name of the nodes are predefined as: -\begin{lstlisting}[style=syntax] -\psset[pst-PSPNodes]{blName=PSPbl,bcName=PSPbc,brName=PSPbr, - clName=PSPcl,ccName=PSPcc,crName=PSPcr,tlName=PSPtl,tcName=PSPtc,trName=PSPtr} -\end{lstlisting} +\clearpage +%-------------------------------------------------------------------------------------- +\section[\nxLcs{psplotDiffEqn} -- solving diffential equations]% + {\nxLcs{psplotDiffEqn} -- solving diffential equations} +%-------------------------------------------------------------------------------------- -and can be modified in the same way. -%I guess you modified the family to have the pstricks-add one so the -%\xkvview would have to be adapted. + A differential equation of first order is like +\begin{align} y^\prime=f(x,y,y^\prime) \end{align} -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psRelLine}} -%-------------------------------------------------------------------------------------- -With this macro it is possible to plot lines relative to a given one. Parameter are -the angle and the length factor: +where $y$ is a function of $x$. We define some vectors $Y=[y, y', +\cdots , y^{(n-1)}]$ and $Y^\prime=[y^\prime, y^{\prime\prime}, +\cdots , y^{n}]$, depending on the order $n$. The syntax of the +macro is \begin{BDef} -\Lcs{psRelLine}\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{}\\ -\Lcs{psRelLine}\OptArg{\Largb{arrows}}\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{end node name}\\ -\Lcs{psRelLine}\OptArgs\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{end node name}\\ -\Lcs{psRelLine}\OptArgs\OptArg{\Largb{arrows}}\Largr{P0}\Largr{P1}\Largb{length factor}\Largb{end node name} +\Lcs{psplotDiffEqn}\OptArgs\Largb{x0}\Largb{x1}\Largb{y0}\Largb{f(x,y,y',...)} \end{BDef} -The length factor relates to the distance $\overline{P_0P_1}$ and -the end node name must be a valid nodename and shouldn't contain -any of the special PostScript characters. There are two valid -options which are described in the foregoing section for -\Lcs{psRelNode}. +\begin{itemize}\setlength\itemsep{0pt}\setlength\parsep{0pt}\setlength\parskip{0pt} +\item \verb+options+: the \verb+\psplotDiffEqn+ specific options and all other of PSTricks, which +make sense; +\item $x_0$: the start value; +\item $x_1$: the end value of the definition interval; +\item $y_0$: the initial values for $y(x_0)\ y'(x_0)\ \ldots$; +\item $f(x,y,y',...)$: the differential equation, depending to the number of initial values, e.g.: + \verb+{0 1}+ for $y_0$ are two initial values, so that we have a differential equation of + second order $f(x,y,y')$ and the macro leaves $y\ y'$ on the stack. +\end{itemize} -The following two figures show the same, the first one with a scaling different to $1:1$, -this is the reason why the end points are on an ellipse and not on a circle like in the -second figure. +The new options are: -\begin{LTXexample}[width=5cm] -\psset{yunit=2,xunit=1} -\begin{pspicture}(-2,-2)(3,2) -\psgrid[subgriddiv=2,subgriddots=10,gridcolor=lightgray] -\pnode(-1,0){A}\pnode(3,2){B} -\psline[linecolor=red](A)(B) -\psRelLine[linecolor=blue,angle=30](-1,0)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=blue,angle=-30](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=magenta,angle=90](-1,0)(3,2){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=magenta,angle=-90](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\end{pspicture} -\end{LTXexample} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(-2,-2)(3,2) -\psgrid[subgriddiv=2,subgriddots=10,gridcolor=lightgray] -\pnode(-1,0){A}\pnode(3,2){B} -\psline[linecolor=red](A)(B) -\psarc[linestyle=dashed](A){2.23}{-90}{135} -\psRelLine[linecolor=blue,angle=30](-1,0)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=blue,angle=-30](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=magenta,angle=90](-1,0)(3,2){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=magenta,angle=-90](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\end{pspicture} -\end{LTXexample} +\begin{itemize}\setlength\itemsep{0pt}\setlength\parsep{0pt}\setlength\parskip{0pt} +\item \Lkeyword{method}: integration method (\verb+euler+ for order 1 euler method, \verb+rk4+ for + 4\textsuperscript{th} order Runge-Kutta method); +\item \Lkeyword{whichabs}: select the abscissa for plotting the graph, by default it is + $x$, but you can specify a number which represent a position in the vector $y$; +\item \Lkeyword{whichord}: same as precedent for the ordinate, by default $y(0)$; +\item \Lkeyword{plotfuncx}: describe a ps function for the abscissa, parameter + \Lkeyword{whichabs} becomes useless; +\item \Lkeyword{plotfuncy}: idem for the ordinate; +\item \Lkeyword{buildvector}: boolean parameter for specifying the input-output of the + $f$ description: + \begin{description} + \item[\texttt{true}] (default): $y$ is put on the stack element by element, $y'$ + must be given in the same way; + \item[\texttt{false}]: $y$ is put on the stack as a vector, $y'$ must be returned + in the same way; + \end{description} -\medskip -The following figure has also a different scaling, but has set the -option \Lkeyword{trueAngle}, all angles refer to "what you see". +\item \Lkeyword{algebraic=true}: algebraic=true description for $f$, \Lkeyword{buildvector} + parameter is useless when activating this option. +\end{itemize} -\begin{LTXexample}[width=6.5cm] -\psset{yunit=2,xunit=1} -\begin{pspicture}(-3,-1)(3,2)\psgrid[subgridcolor=lightgray] -\pnode(-1,0){A}\pnode(3,2){B} -\psline[linecolor=red](A)(B) -\psarc(A){2.83}{-45}{135} -\psRelLine[linecolor=blue,angle=30,trueAngle](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=blue,angle=-30,trueAngle](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=magenta,angle=90,trueAngle](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\psRelLine[linecolor=magenta,angle=-90,trueAngle](A)(B){0.5}{EndNode} -\qdisk(EndNode){2pt} -\end{pspicture} -\end{LTXexample} -\medskip -Two examples using \verb+\multido+ to show the behaviour of the -options \verb+trueAngle+ and \verb+angle+. -\medskip -\begin{LTXexample}[width=8cm] -\psset{yunit=4,xunit=2} -\begin{pspicture}(-1,0)(3,2)\psgrid[subgridcolor=lightgray] -\pnode(-1,0){A}\pnode(1,1){B} -\psline[linecolor=red](A)(3,2) -\multido{\iA=0+10}{36}{% - \psRelLine[linecolor=blue,angle=\iA](B)(A){-0.5}{EndNode} - \qdisk(EndNode){2pt} -} -\end{pspicture} -\end{LTXexample} +\clearpage +\subsection{Variable step for differential equations} -\begin{LTXexample}[width=8cm] -\psset{yunit=4,xunit=2} -\begin{pspicture}(-1,0)(3,2)\psgrid[subgridcolor=lightgray] -\pnode(-1,0){A}\pnode(1,1){B} -\psline[linecolor=red](A)(3,2) -\multido{\iA=0+10}{36}{% - \psRelLine[linecolor=magenta,angle=\iA,trueAngle]{->}(B)(A){-0.5}{EndNode} -} -\end{pspicture} -\end{LTXexample} +A new algorithm has been added for adjusting the step according to the variations of +the curve. The parameter \Lkeyword{method} has a new possible value : \Lkeyword{varrkiv} to +activate the \Index{Runge-Kutta} method with variable step, then the parameter +\Lkeyword{varsteptol} (real value; \verb+.01+ by default) can control the tolerance of +the algortihm. \begin{center} \bgroup -\psset{xunit=0.75\linewidth,yunit=0.75\linewidth,trueAngle}% -\begin{pspicture}(1,0.6)%\psgrid - \pnode(.3,.35){Vk} \pnode(.375,.35){D} \pnode(0,.4){DST1} \pnode(1,.18){DST2} - \pnode(0,.1){A1} \pnode(1,.31){A1} - { \psset{linewidth=.02,linestyle=dashed,linecolor=gray}% - \pcline(DST1)(DST2) % <- Druckseitentangente - \pcline(A2)(A1) % <- Anstr\"omrichtung - \lput*{:U}{\small Anstr\"omrichtung $v_{\infty}$} }% - \psIntersectionPoint(A1)(A2)(DST1)(DST2){Hk} - \pscurve(Hk)(.4,.38)(Vk)(.36,.33)(.5,.32)(Hk) - \psParallelLine[linecolor=red!75!green,arrows=->,arrowscale=2](Vk)(Hk)(D){.1}{FtE} - \psRelLine[linecolor=red!75!green,arrows=->,arrowscale=2,angle=90](D)(FtE){4}{Fn}% why "4"? - \psParallelLine[linestyle=dashed](D)(FtE)(Fn){.1}{Fnr1} - \psRelLine[linestyle=dashed,angle=90](FtE)(D){-4}{Fnr2} % why "-4"? - \psline[linewidth=1.5pt,arrows=->,arrowscale=2](D)(Fnr2) - \psIntersectionPoint(D)([nodesep=2]D)(Fnr1)([offset=-4]Fnr1){Fh} - \psIntersectionPoint(D)([offset=2]D)(Fnr1)([nodesep=4]Fnr1){Fv} - \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fh) - \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fv) - \psline[linestyle=dotted](Fh)(Fnr1) \psline[linestyle=dotted](Fv)(Fnr1) - \uput{.1}[0](Fh){\blue $F_{H}$} \uput{.1}[180](Fv){\blue $F_{V}$} - \uput{.1}[-45](Fnr1){$F_{R}$} \uput{.1}[90](Fn){\color{red!75!green}$F_{N}$} - \uput{.25}[-90](FtE){\color{red!75!green}$F_{T}$} +\def\Funct{neg}\def\FunctAlg{-y[0]} +\psset{xunit=1.5, yunit=8, showpoints=true} +\begin{pspicture}[showgrid=true](0,0)(10,1.2) + \psplot[linewidth=6\pslinewidth, linecolor=green, showpoints=false]{0}{10}{Euler x neg exp} + \psplotDiffEqn[linecolor=magenta, method=varrkiv, varsteptol=.1, plotpoints=2]{0}{10}{1}{\Funct} + \rput(0,.0){\psplotDiffEqn[linecolor=blue, method=varrkiv, varsteptol=.01, plotpoints=2]{0}{10}{1}{\Funct}} + \rput(0,.1){\psplotDiffEqn[linecolor=Orange, method=varrkiv, varsteptol=.001, plotpoints=2]{0}{10}{1}{\Funct}} + \rput(0,.2){\psplotDiffEqn[linecolor=red, method=varrkiv, varsteptol=.0001, plotpoints=2]{0}{10}{1}{\Funct}} + \psset{linewidth=4\pslinewidth,showpoints=false} + \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](3.3,.9){\small RK ordre 4 : $\varepsilon<10^{-1}$} + \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](3.3,.8){\small RK ordre 4 : $\varepsilon<10^{-2}$} + \rput*(3.3,.7){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](3.3,.7){\small RK ordre 4 : $\varepsilon<10^{-3}$} + \rput*(3.3,.6){\psline[linecolor=red](-.75cm,0)} + \rput*[l](3.3,.6){\small RK ordre 4 : $\varepsilon<10^{-4}$} + \rput*(3.3,.5){\psline[linecolor=green](-.75cm,0)} + \rput*[l](3.3,.5){\small solution exacte} \end{pspicture} +{\captionof{figure}{Equation $y'=-y$ with $y_0=1$.}\label{fig:minusexpvarstep}} \egroup \end{center} -\begin{lstlisting} -\psset{xunit=0.75\linewidth,yunit=0.75\linewidth,trueAngle}% -\end{center} -\begin{pspicture}(1,0.6)%\psgrid - \pnode(.3,.35){Vk} \pnode(.375,.35){D} \pnode(0,.4){DST1} \pnode(1,.18){DST2} - \pnode(0,.1){A1} \pnode(1,.31){A1} - { \psset{linewidth=.02,linestyle=dashed,linecolor=gray}% - \pcline(DST1)(DST2) % <- Druckseitentangente - \pcline(A2)(A1) % <- Anstr"omrichtung - \lput*{:U}{\small Anstr"omrichtung $v_{\infty}$} }% - \psIntersectionPoint(A1)(A2)(DST1)(DST2){Hk} - \pscurve(Hk)(.4,.38)(Vk)(.36,.33)(.5,.32)(Hk) - \psParallelLine[linecolor=red!75!green,arrows=->,arrowscale=2](Vk)(Hk)(D){.1}{FtE} - \psRelLine[linecolor=red!75!green,arrows=->,arrowscale=2,angle=90](D)(FtE){4}{Fn}% why "4"? - \psParallelLine[linestyle=dashed](D)(FtE)(Fn){.1}{Fnr1} - \psRelLine[linestyle=dashed,angle=90](FtE)(D){-4}{Fnr2} % why "-4"? - \psline[linewidth=1.5pt,arrows=->,arrowscale=2](D)(Fnr2) - \psIntersectionPoint(D)([nodesep=2]D)(Fnr1)([offset=-4]Fnr1){Fh} - \psIntersectionPoint(D)([offset=2]D)(Fnr1)([nodesep=4]Fnr1){Fv} - \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fh) - \psline[linecolor=blue,arrows=->,arrowscale=2](D)(Fv) - \psline[linestyle=dotted](Fh)(Fnr1) \psline[linestyle=dotted](Fv)(Fnr1) - \uput{.1}[0](Fh){\blue $F_{H}$} \uput{.1}[180](Fv){\blue $F_{V}$} - \uput{.1}[-45](Fnr1){$F_{R}$} \uput{.1}[90](Fn){\color{red!75!green}$F_{N}$} - \uput{.25}[-90](FtE){\color{red!75!green}$F_{T}$} -\end{pspicture} -\end{lstlisting} - -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psParallelLine}} -%-------------------------------------------------------------------------------------- -With this macro it is possible to plot lines relative to a given one, which is parallel. -There is no special parameter here. -\begin{lstlisting}[style=syntax] -\psParallelLine()()(){}{} -\psParallelLine{}()()(){}{} -\psParallelLine[]()()(){}{} -\psParallelLine[]{}()()(){}{} +\begin{lstlisting}[wide=true] +\def\Funct{neg}\def\FunctAlg{-y[0]} +\psset{xunit=1.5, yunit=8, showpoints=true} +\begin{pspicture}[showgrid=true](0,0)(10,1.2) + \psplot[linewidth=6\pslinewidth, linecolor=green, showpoints=false]{0}{10}{Euler x neg exp} + \psplotDiffEqn[linecolor=magenta, method=varrkiv, varsteptol=.1, plotpoints=2]{0}{10}{1}{\Funct} + \rput(0,.0){\psplotDiffEqn[linecolor=blue, method=varrkiv, varsteptol=.01, plotpoints=2]{0}{10}{1}{\Funct}} + \rput(0,.1){\psplotDiffEqn[linecolor=Orange, method=varrkiv, varsteptol=.001, plotpoints=2]{0}{10}{1}{\Funct}} + \rput(0,.2){\psplotDiffEqn[linecolor=red, method=varrkiv, varsteptol=.0001, plotpoints=2]{0}{10}{1}{\Funct}} + \psset{linewidth=4\pslinewidth,showpoints=false} + \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](3.3,.9){\small RK ordre 4 : $\varepsilon<10^{-1}$} + \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](3.3,.8){\small RK ordre 4 : $\varepsilon<10^{-2}$} + \rput*(3.3,.7){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](3.3,.7){\small RK ordre 4 : $\varepsilon<10^{-3}$} + \rput*(3.3,.6){\psline[linecolor=red](-.75cm,0)} + \rput*[l](3.3,.6){\small RK ordre 4 : $\varepsilon<10^{-4}$} + \rput*(3.3,.5){\psline[linecolor=green](-.75cm,0)} + \rput*[l](3.3,.5){\small solution exacte} +\end{pspicture} \end{lstlisting} -The line starts at $P_2$, is parallel to $\overline{P_0P_1}$ and -the length of this parallel line depends on the length factor. The -end node name must be a valid nodename and shouldn't contain any -of the special PostScript characters. - -\begin{LTXexample} -\begin{pspicture*}(-5,-4)(5,3.5) - \psgrid[subgriddiv=0,griddots=5] - \pnode(2,-2){FF}\qdisk(FF){1.5pt} - \pnode(-5,5){A}\pnode(0,0){O} - \multido{\nCountA=-2.4+0.4}{9}{% - \psParallelLine[linecolor=red](O)(A)(0,\nCountA){9}{P1} - \psline[linecolor=red](0,\nCountA)(FF) - \psRelLine[linecolor=red](0,\nCountA)(FF){9}{P2} - } - \psline[linecolor=blue](A)(FF) - \psRelLine[linecolor=blue](A)(FF){5}{END1} - \psline[linewidth=2pt,arrows=->](2,0)(FF) -\end{pspicture*} -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psIntersectionPoint}} -%-------------------------------------------------------------------------------------- -This macro calculates the intersection point of two lines, given by the four coordinates. -There is no special parameter here. -\begin{lstlisting}[style=syntax] -\psIntersectionPoint()()()(){} -\end{lstlisting} -\begin{LTXexample}[width=5.5cm] -\psset{unit=0.5cm} -\begin{pspicture}(-5,-4)(5,5) - \psaxes[labelFontSize=\scriptstyle, - dx=2,Dx=2,dy=2,Dy=2]{->}(0,0)(-5,-4)(5,5) - \psline[linecolor=red,linewidth=2pt](-5,-1)(5,5) - \psline[linecolor=blue,linewidth=2pt](-5,3)(5,-4) - \qdisk(-5,-1){2pt}\uput[-90](-5,-1){A} - \qdisk(5,5){2pt}\uput[-90](5,5){B} - \qdisk(-5,3){2pt}\uput[-90](-5,3){C} - \qdisk(5,-4){2pt}\uput[-90](5,-4){D} - \psIntersectionPoint(-5,-1)(5,5)(-5,3)(5,-4){IP} - \qdisk(IP){3pt}\uput{0.3}[90](IP){IP} - \psline[linestyle=dashed](IP|0,0)(IP)(0,0|IP) +\begin{center} +\bgroup +\def\Funct{exch neg} +\psset{xunit=1.5, yunit=5, method=varrkiv, showpoints=true}%% +\def\quatrepi{12.5663706144} +\begin{pspicture}(0,-1)(10,1.3) + \psaxes{->}(0,0)(0,-1)(10,1.3) + \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{10}{cos(x)} + \rput(0,.0){\psplotDiffEqn[linecolor=magenta, plotpoints=7, varsteptol=.1]{0}{10}{1 0}{\Funct}} + \rput(0,.0){\psplotDiffEqn[linecolor=blue, plotpoints=201, varsteptol=.01]{0}{10}{1 0}{\Funct}} + \rput(0,.1){\psplotDiffEqn[linewidth=2\pslinewidth, linecolor=red, varsteptol=.001]{0}{10}{1 0}{\Funct}} + \rput(0,.2){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{10}{1 0}{\Funct}} + \rput(0,.3){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{10}{1 0}{\Funct}} + \psset{linewidth=4\pslinewidth,showpoints=false} + \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} + \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} + \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} + \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} + \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} + \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} + \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} + \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} + \rput*[l](2.3,.4){\small solution exacte} \end{pspicture} -\end{LTXexample} - -\clearpage -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psLNode} and \nxLcs{psLCNode}} -%-------------------------------------------------------------------------------------- -\Lcs{psLNode} interpolates the Line $\overline{AB}$ by the given value and sets a node at this -point. The syntax is -% -\begin{lstlisting}[style=syntax] -\psLNode(P1)(P2){value}{Node name} -\end{lstlisting} +{\captionof{figure}{Equation $y''=-y$}\label{fig:trigfunc}} +\egroup +\end{center} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(5,5) -\psgrid[subgriddiv=0,griddots=10] -\psset{linecolor=red} -\psline{o-o}(1,1)(5,5) -\psLNode(1,1)(5,5){0.75}{PI} -\qdisk(PI){4pt} -\psset{linecolor=blue} -\psline{o-o}(4,3)(2,5) -\psLNode(4,3)(2,5){-0.5}{PII} -\qdisk(PII){4pt} +\begin{lstlisting}[wide=true] +\def\Funct{exch neg} +\psset{xunit=1.5, yunit=5, method=varrkiv, showpoints=true}%% +\def\quatrepi{12.5663706144} +\begin{pspicture}(0,-1)(10,1.3) + \psaxes{->}(0,0)(0,-1)(10,1.3) + \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{10}{cos(x)} + \rput(0,.0){\psplotDiffEqn[linecolor=magenta, plotpoints=7, varsteptol=.1]{0}{10}{1 0}{\Funct}} + \rput(0,.0){\psplotDiffEqn[linecolor=blue, plotpoints=201, varsteptol=.01]{0}{10}{1 0}{\Funct}} + \rput(0,.1){\psplotDiffEqn[linewidth=2\pslinewidth, linecolor=red, varsteptol=.001]{0}{10}{1 0}{\Funct}} + \rput(0,.2){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{10}{1 0}{\Funct}} + \rput(0,.3){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{10}{1 0}{\Funct}} + \psset{linewidth=4\pslinewidth,showpoints=false} + \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} + \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} + \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} + \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} + \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} + \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} + \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} + \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} + \rput*[l](2.3,.4){\small solution exacte} \end{pspicture} -\end{LTXexample} - - -\bigskip -The \Lcs{psLCNode} macro builds the linear combination of the two given -vectors and stores the end of -the new vector as a node. All vectors start at $(0,0)$, so a \verb+\rput+ maybe appropriate. -The syntax is -% -\begin{lstlisting}[style=syntax] -\psLCNode(P1){value 1}(P2){value 2}{Node name} \end{lstlisting} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(5,5) -\psgrid[subgriddiv=0,griddots=10] -\psset{linecolor=black} -\psline[linestyle=dashed]{->}(3,1.5) -\psline[linestyle=dashed]{->}(0.375,1.5) -\psset{linecolor=red} -\psline{->}(2,1)\psline{->}(0.5,2) -\psLCNode(2,1){1.5}(0.5,2){0.75}{PI} -\psline[linewidth=2pt]{->}(PI) -\psset{linecolor=black} -\psline[linestyle=dashed](3,1.5)(PI) -\psline[linestyle=dashed](0.375,1.5)(PI) -\end{pspicture} -\end{LTXexample} - -\clearpage - -%-------------------------------------------------------------------------------------- -\section{\nxLcs{nlput} and \nxLcs{psLDNode}} -%-------------------------------------------------------------------------------------- -\Lcs{ncput} allows you to set a label relative to the first node -of the last node connection. With \Lcs{nlput} this can be done -absolute to a given node. The syntax is different to the other -node connection macros. It uses internally the macro -\Lcs{psLDNode} which places a node absolute to two given points, -starting from the first one. -\begin{lstlisting}[style=syntax] -\nlput[options](A)(B){distance}{text} -\psLDNode[options](A)(B){distance}{node name} -\end{lstlisting} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(5,2) -\pnode(0,0){A} -\pnode(5,2){B} -\ncline{A}{B} -\psLDNode(A)(B){1.5cm}{KN}\qdisk(KN){2pt} -\nlput[nrot=:U](A)(B){1cm}{Test} -\nlput[nrot=:D](A)(B){2cm}{Test} -\nlput[nrot=:U](A)(B){3cm}{Test} -\nlput(A)(B){4cm}{Test} +\begin{center} +\bgroup +\def\Funct{exch} +\psset{xunit=4, yunit=1, method=varrkiv, showpoints=true}%% +\def\quatrepi{12.5663706144} +\begin{pspicture}(0,-0.5)(3,11) + \psaxes{->}(0,0)(3,11) + \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{3}{ch(x)} + \rput(0,.0){\psplotDiffEqn[linecolor=magenta, varsteptol=.1]{0}{3}{1 0}{\Funct}} + \rput(0,.3){\psplotDiffEqn[linecolor=blue, varsteptol=.01]{0}{3}{1 0}{\Funct}} + \rput(0,.6){\psplotDiffEqn[linecolor=red, varsteptol=.001]{0}{3}{1 0}{\Funct}} + \rput(0,.9){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{3}{1 0}{\Funct}} + \rput(0,1.2){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{3}{1 0}{\Funct}} + \psset{linewidth=4\pslinewidth,showpoints=false} + \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} + \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} + \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} + \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} + \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} + \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} + \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} + \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} + \rput*[l](2.3,.4){\small solution exacte} \end{pspicture} -\end{LTXexample} - - - +\captionof{figure}{Equation $y''=y$} +\egroup +\end{center} -\clearpage -%-------------------------------------------------------------------------------------- -\part{\nxLPack{pst-plot}} -%-------------------------------------------------------------------------------------- -\section{New syntax} -There is now a new optional argument for \Lcs{psplot} and \Lcs{parametricplot} to pass -additional \PS commands into the code. This makes the use of \Lcs{pstVerb} in most cases superfluous. -\begin{BDef} -\Lcs{psplot}\OptArgs\Largb{x0}\Largb{x1}\OptArg{PS commands}\Largb{function}\\ -\Lcs{parametricplot}\OptArgs\Largb{t0}\Largb{t1}\OptArg{PS commands}\Largb{x(t) y(t)} -\end{BDef} - - -\begin{LTXexample}[pos=t,wide] -\begin{pspicture}(0,-0.5)(12,5) - \psaxes[Dx=100,dx=1,Dy=0.00075,dy=1]{->}(0,0)(12,5) - \psplot[linecolor=red, plotstyle=curve,linewidth=2pt,plotpoints=200]{0}{11}% - [ /const1 3.3 10 8 neg exp mul def /s 10 def /const2 6.04 10 6 neg exp mul def ]% - { const1 x 100 mul dup mul mul Euler const2 neg x 100 mul dup mul mul exp mul 2000 mul} +\begin{lstlisting}[wide=true] +\def\Funct{exch} +\psset{xunit=4, yunit=1, method=varrkiv, showpoints=true}%% +\def\quatrepi{12.5663706144} +\begin{pspicture}(0,-0.5)(3,11) + \psaxes{->}(0,0)(3,11) + \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{3}{ch(x)} + \rput(0,.0){\psplotDiffEqn[linecolor=magenta, varsteptol=.1]{0}{3}{1 0}{\Funct}} + \rput(0,.3){\psplotDiffEqn[linecolor=blue, varsteptol=.01]{0}{3}{1 0}{\Funct}} + \rput(0,.6){\psplotDiffEqn[linecolor=red, varsteptol=.001]{0}{3}{1 0}{\Funct}} + \rput(0,.9){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{3}{1 0}{\Funct}} + \rput(0,1.2){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{3}{1 0}{\Funct}} + \psset{linewidth=4\pslinewidth,showpoints=false} + \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} + \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} + \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} + \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} + \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} + \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} + \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} + \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} + \rput*[l](2.3,.4){\small solution exacte} \end{pspicture} -\end{LTXexample} - - - - -\section{New or extended options} -%-------------------------------------------------------------------------------------- - -The axes macro has now two additional optional arguments for placing labels at -the end of the axes: - -\begin{lstlisting}[style=syntax] -\psaxes[settings]{arrows}(x0,y0)(x1,y1)(x2,y2)[Xlabel,Xangle][Ylabel,Yangle] -\end{lstlisting} - -It has now four optional arguments, one for the setting, one for -the arrows, one for the x-label and one for the y-label. If you -want only a y-label, then leave the x one empty. A missing y-label -is possible. The following examples show how it can be used. - -The option \Lkeyset{tickstyle=full}|\Lkeyval{top}|\Lkeyval{bottom} no longer works in the -usual way. Only the additional value \Lkeyval{inner} is valid for -\LPack{pstricks-add}, because everything can be set by the -\Lkeyword{ticksize} option. When using the \Lkeyword{comma} or -\Lkeyword{trigLabels} option, the macros \Lcs{pshlabel} and -\Lcs{psvlabel} shouldn't be redefined, because the package does -it itself internally in these cases. However, if you need a -redefinition, then do it for \Lcs{pst@@hlabel} and -\Lcs{pst@@vlabel} with - -\begin{lstlisting}[style=syntax] -\makeatletter -\def\ps@@hlabel#1{...} -\def\ps@@vlabel#1{...} -\makeatother \end{lstlisting} -{ -\ttfamily -\rowcolors{1}{blue!20}{red!30} -\begin{longtable}{lll} -\caption{All new parameters for \texttt{pst-plot}}\\ -\rowcolor{white}\textrm{\bfseries Name} & \textrm{\bfseries Type} & \textrm{\bfseries Default}\\\hline -\endfirsthead -\rowcolor{white}\textrm{\bfseries Name} & \textrm{\bfseries Type} & \textrm{\bfseries Default}\\\hline -\endhead -\Lkeyword{axesstyle} & <\Lkeyval{none}|\Lkeyval{axes}|\Lkeyval{frame}|\Lkeyval{polar}> & axes\\ -\Lkeyword{labels} & <\Lkeyval{all}|\Lkeyval{x}|\Lkeyval{y}|\Lkeyval{none}> & all\\%ok -\Lkeyword{xlabelPos} & <\Lkeyval{bottom},\Lkeyval{axis},\Lkeyval{top}>& \Lkeyval{bottom}\\ -\Lkeyword{ylabelPos} & <\Lkeyval{left},\Lkeyval{axis},\Lkeyval{right}>& left\\ -\Lkeyword{xlabelFactor} & & \{\textbackslash\@ empty\}\\ -\Lkeyword{ylabelFactor} & & \{\textbackslash\@ empty\}\\ -\Lkeyword{labelFontSize} & & \{\} \\ -\Lkeyword{trigLabels} & false|true & false\\ -\Lkeyword{trigLabelBase} & & 0\\ -\Lkeyword{algebraic} & false|true & false\\ %ok -\Lkeyword{decimalSeparator} & & .\\ %ok -\Lkeyword{comma} & false|true & false\\ %ok -\Lkeyword{xAxis} & false|true & true\\%ok -\Lkeyword{yAxis} & false|true & true\\%ok -\Lkeyword{xyAxes} & false|true & true\\%ok -\Lkeyword{xDecimals} & or empty & \{\}\\%ok -\Lkeyword{yDecimals} & or empty & \{\}\\%ok -\Lkeyword{xyDecimals} & or empty & \{\}\\%ok -%\Lkeyword{xLabel} & & \{\}\\%ok -%\Lkeyword{yLabel} & & \{\}\\%ok -%\Lkeyword{xyLabel} & & \{\}\\%ok -\Lkeyword{ticks} & & all\\%ok -\Lkeyword{tickstyle} & \Lkeyval{full}|\Lkeyval{top}|\Lkeyval{bottom}|\Lkeyval{inner} & full\\%ok -\Lkeyword{subticks} & & 0\\ -\Lkeyword{xsubticks} & & 0\\ -\Lkeyword{ysubticks} & & 0\\ -\Lkeyword{ticksize} & & -4pt 4pt\\ -\Lkeyword{subticksize} & & 0.75\\ -\Lkeyword{tickwidth} & & 0.5\verb+\pslinewidth+\\ -\Lkeyword{subtickwidth} & & 0.25\verb+\pslinewidth+\\ -\Lkeyword{tickcolor} & & black\\ -\Lkeyword{xtickcolor} & & black\\ -\Lkeyword{ytickcolor} & & black\\ -\Lkeyword{subtickcolor} & & darkgray\\ -\Lkeyword{xsubtickcolor} & & darkgray\\ -\Lkeyword{ysubtickcolor} & & darkgray\\ -\Lkeyword{ticklinestyle} & \Lkeyval{solid} | \Lkeyval{dashed} | \Lkeyval{dotted} | \Lkeyval{none} & solid\\ -\Lkeyword{subticklinestyle} & solid | dashed | dotted | none & solid\\ -\Lkeyword{xlogBase} & or empty & \{\}\\ -\Lkeyword{ylogBase} & or empty & \{\}\\ -\Lkeyword{xylogBase} & or empty & \{\}\\ -\Lkeyword{logLines} & & none\\ -\Lkeyword{yMaxValue} & & -1\\ -\Lkeyword{ignoreLines} & & 0\\ -\Lkeyword{nStep} & & 1\\ -\Lkeyword{nStart} & & 0\\ -\Lkeyword{nEnd} & or empty & \{\}\\ -\Lkeyword{xStep} & & 0\\ -\Lkeyword{yStep} & & 0\\ -\Lkeyword{xStart} & or empty & \{\}\\ -\Lkeyword{yStart} & or empty & \{\}\\ -\Lkeyword{xEnd} & or empty & \{\}\\ -\Lkeyword{yEnd} & or empty & \{\}\\ -\Lkeyword{plotNo} & & 1\\ -\Lkeyword{plotNoMax} & & 1\\ -\Lkeyword{xAxisLabel} & & \{\textbackslash\@ empty\}\\ -\Lkeyword{yAxisLabel} & & \{\textbackslash\@ empty\}\\ -\Lkeyword{xAxisLabelPos} & <(x,y)> or empty & \{\textbackslash\@ empty\}\\ -\Lkeyword{yAxisLabelPos} & <(x,y)> or empty & \{\textbackslash\@ empty\}\\ -\Lkeyword{llx} & & 0pt\\ -\Lkeyword{lly} & & 0pt\\ -\Lkeyword{urx} & & 0pt\\ -\Lkeyword{ury} & & 0pt\\ -\Lkeyword{polarplot} & false|true & false\\ -\Lkeyword{ChangeOrder} & false|true & false\\ -\end{longtable} -} \clearpage +\subsection{Equation of second order} -%-------------------------------------------------------------------------------------- -\subsection{\nxLkeyword{axesstyle}} -%-------------------------------------------------------------------------------------- -There is a new axes style \Lkeyval{polar} which plots a polar coordinate system. - -Syntax: -\begin{lstlisting}[style=syntax] -\psplot[axesstyle=polar](Rx,Ry) -\psplot[axesstyle=polar](...)(Rx,Ry) -\psplot[axesstyle=polar](...)(...)(Rx,Ry) -\end{lstlisting} - -Important is the fact, that only one pair of coordinates is taken into account for -the radius. It is \emph{always} the last pair in a sequence of allowed coordinates -for the \Lcs{psaxes} macro. The other ones are ignored; they are not valid for the -polar coordinate system. - -\resetOptions% -\begin{LTXexample}[wide=true,pos=t] -%\usepackage{pstricks-add} - -\begin{pspicture}(-3.5,-3.5)(3.5,3.5) -\psaxes[axesstyle=polar](3,3) -\psplot[polarplot,algebraic,linecolor=blue,linewidth=2pt, - plotpoints=2000]{0}{TwoPi 4 mul}{2*(sin(x)-x)/(cos(x)+x)} -\end{pspicture} -% -\begin{pspicture}(-3.5,-3.5)(3.5,3.5) -\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2, - labelFontSize=\scriptstyle](3,3) -\psplot[polarplot,algebraic,linecolor=red,linewidth=2pt, - plotpoints=2000]{0}{TwoPi}{6*sin(x)*cos(x)} -\end{pspicture} -\end{LTXexample} +Here is the traditional simulation of two stars attracting each +other according to the classical gravitation law in +$\displaystyle\frac{1}{r^2}$. In 2-Dimensions, the system to be +solved is composed of four second order differential equations. In +order to be described, each of them gives two first order +equations, then we obtain a 8 sized vectorial equation. In the +following example the masses of the stars are 1 and 20. -All valid optional arguments for the axes are also possible for the polar style, if they make sense \ldots\ :-) -Important are the \Lkeyword{Dy} option, it defines the angle interval and \Lkeyword{subticks}, for -the intermediate circles and lines. The number can be different for the circles (\Lkeyword{ysubticks}) and the -lines (\Lkeyword{xsubticks}). +\[ +\left\{ +\begin{array}[m]{l} + x''_1=\displaystyle\frac{M_2}{r^2}\cos(\theta)\\ + y''_1=\displaystyle\frac{M_2}{r^2}\sin(\theta)\\ + x''_2=\displaystyle\frac{M_1}{r^2}\cos(\theta)\\ + y''_2=\displaystyle\frac{M_1}{r^2}\sin(\theta)\\ +\end{array} +\right. +\mbox{ avec } +\left\{ +\begin{array}[m]{l} + r^2=(x_1-x_2)^2+(y_1-y_2)^2\\ + \cos(\theta)=\displaystyle\frac{(x_1-x_2)}{r}\\ + \sin(\theta)=\displaystyle\frac{(y_1-y_2)}{r}\\ +\end{array} +\right. +\mbox{% +\begin{pspicture}[shift=-2](5,4)\psset{arrowscale=2} + \psframe[linewidth=.75\pslinewidth](5,4) + \pstGeonode[PosAngle={-90,90}](1,1){M_1}(4,3){M_2} + \pstHomO[HomCoef=.33, PointSymbol=none]{M_1}{M_2}[F_1] + \psline[arrows=->](M_1)(F_1) + \pstHomO[HomCoef=.33, PointSymbol=none]{M_2}{M_1}[F_2] + \psline[arrows=->, arrowscale=2](M_2)(F_2) + \pstGeonode[PointSymbol=none, PointName=none](M_2|M_1){A} + \psline[linewidth=.5\pslinewidth](M_1)(A) + \pstMarkAngle{A}{M_1}{M_2}{$\theta$} + \ncline[linewidth=.5\pslinewidth, offset=.5, arrows=<->]{M_1}{M_2} + \ncput*{$r$} +\end{pspicture}} +\] -\clearpage +\begin{table}[!htbp] + \centering\small + \begin{tabular}{|l@{}>{\ttfamily}l@{}>{ \ttfamily \%\% }l|} + \hline + && x1 y1 x'1 y'1 x2 y2 x'2 y'2\\ + &/yp2 exch def /xp2 exch def /ay2 exch def /ax2 exch def&mise en variables\\ + &/yp1 exch def /xp1 exch def /ay1 exch def /ax1 exch def&mise en variables\\ + &/ro2 ax2 ax1 sub dup mul ay2 ay1 sub dup mul add def&calcul de r*r\\ + &xp1 yp1&\\ + &ax2 ax1 sub ro2 sqrt div ro2 div&calcul de x''1\\ + &ay2 ay1 sub ro2 sqrt div ro2 div&calcul de y''1\\ + &xp2 yp2&\\ + &3 index -20 mul&calcul de x''2=-20x''1\\ + &3 index -20 mul&calcul de y''2=-20y''1\\ + \hline + \end{tabular} + \caption{\PS source code for the gravitational interaction}\label{intgravcode} +\end{table} -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xyAxes}, \texttt{xAxis} and \texttt{yAxis}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -xyAxes=true|false -xAxis=true|false -yAxis=true|false -\end{lstlisting} +\begin{table}[!htbp] + \centering + \small\newcommand{\POW}{\symbol{'136}} + \begin{tabular}{|l@{}>{\ttfamily}l@{}>{ \ttfamily \%\% }l|} + \hline + &y[2]|&y'[0]\\ + &y[3]|&y'[1]\\ + &(y[4]-y[0])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5|&y'[2]=y''[0]\\ + &(y[5]-y[1])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5|&y'[3]=y''[1]\\ + &y[6]|&y'[4]\\ + &y[7]|&y'[5]\\ + &20*(y[0]-y[4])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5|&y'[6]=y''[4]\\ + &20*(y[1]-y[5])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5&y'[7]=y''[5]\\ + \hline + \end{tabular} + \caption{Algebraic description for the gravitational interaction}\label{intgravalgcode} +\end{table} -Sometimes there is only a need for one axis with ticks. In this -case you can set one of the preceding options to false. The -\Lkeyword{xyAxes} only makes sense when you want to set both x and y -to true with only one command, back to the default, because with -\Lkeyword{xyAxes}=\false you get nothing with the \Lcs{psaxes} macro. +\newcommand\Grav{% + /yp2 exch def /xp2 exch def /ay2 exch def /ax2 exch def + /yp1 exch def /xp1 exch def /ay1 exch def /ax1 exch def + /ro2 ax2 ax1 sub dup mul ay2 ay1 sub dup mul add def + xp1 yp1 + ax2 ax1 sub ro2 sqrt div ro2 div + ay2 ay1 sub ro2 sqrt div ro2 div + xp2 yp2 + 3 index -20 mul + 3 index -20 mul} +\newcommand\GravAlg{% + y[2]|y[3]|% + (y[4]-y[0])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5|% + (y[5]-y[1])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5|% + y[6]|y[7]|% + 20*(y[0]-y[4])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5|% + 20*(y[1]-y[5])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5} +%% 0 1 2 3 4 5 6 7 +%% x1 y1 x'1 y'1 x2 y2 x'2 y'2 -\resetOptions% -\begin{LTXexample} -\begin{pspicture}(5,1) -\psaxes[yAxis=false,linecolor=blue]{->}(0,0.5)(5,0.5) -\end{pspicture} -\begin{pspicture}(1,5) -\psaxes[xAxis=false,linecolor=red]{->}(0.5,0)(0.5,5) -\end{pspicture} -\begin{pspicture}(1,5) -\psaxes[xAxis=false,linecolor=red, - ylabelPos=right]{->}(0.5,0)(0.5,5) -\end{pspicture}\\[0.5cm] -\begin{pspicture}(5,1) -\psaxes[yAxis=false,linecolor=blue, - xlabelPos=top]{->}(0,0.5)(5,0.5) +\begin{LTXexample}[width=5cm,wide] +\def\InitCond{ 1 1 .1 0 -1 -1 -2 0} +\begin{pspicture}[shift=-2,showgrid=true](-3,-1.75)(2,1.5) + \psplotDiffEqn[whichabs=0, whichord=1, linecolor=blue, method=rk4, plotpoints=100]{0}{3.95}{\InitCond}{\Grav} + \psset{showpoints=true,whichabs=4, whichord=5} + \psplotDiffEqn[linecolor=black, method=varrkiv, varsteptol=.0001, plotpoints=200]{0}{3.9}{\InitCond}{\Grav} \end{pspicture} \end{LTXexample} +\vspace{-2ex} +{\captionof{figure}{Gravitational interaction: fixed landmark, trajectory of the stars}\label{fig:InterGravRepFix}} -As seen in the example, a single y axis gets the labels on the left side. This can be -changed with the option \Lkeyword{ylabelPos} or with \Lkeyword{xlabelPos} for the -$x$-axis. - - -%-------------------------------------------------------------------------------------- -\subsection{\texttt{labels}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -labels=all|x|y|none -\end{lstlisting} -This option is also already in the \LPack{pst-plot} package and -only mentioned here for completeness. -\begin{LTXexample}[width=3.5cm] -\psset{ticksize=6pt} -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=all,subticks=5]{->}(0,0)(-1,-1)(2,2) +\bigskip +\begin{LTXexample}[width=5cm,wide] +\def\InitCond{ 1 1 .1 0 -1 -1 -2 0} +\begin{pspicture}[shift=-1.5,showgrid=true](-4,-1.75)(1,1) + \psplotDiffEqn[linecolor=red, plotpoints=200,method=varrkiv, varsteptol=.0001, showpoints=true, + plotfuncx=y dup 4 get exch 0 get sub, + plotfuncy=dup 5 get exch 1 get sub ]{0}{3.9}{\InitCond}{\Grav} \end{pspicture} \end{LTXexample} +\vspace{-2ex} +{\captionof{figure}{Gravitational interaction : landmark defined by one star}\label{fig:IGnewrep}} -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=y,subticks=5]{->}(0,0)(-1,-1)(2,2) -\end{pspicture} -\end{LTXexample} -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=x,subticks=5]{->}(0,0)(2,2)(-1,-1) +\begin{center} +\bgroup +\def\InitCond{ 1 1 .1 0 -1 -1 -2 0} +\psset{xunit=2} +\begin{pspicture}[showgrid=true](0,0)(8,9) + \psset{showpoints=true} + \psplotDiffEqn[linecolor=red, method=varrkiv, plotpoints=2, varsteptol=.0001, + plotfuncy=dup 6 get dup mul exch 7 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} + \psplotDiffEqn[linecolor=blue, method=varrkiv, plotpoints=2, varsteptol=.0001, + plotfuncy=dup 2 get dup mul exch 3 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} \end{pspicture} -\end{LTXexample} +\captionof{figure}{Gravitational interaction : speeds of the +stars} \egroup +\end{center} -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[labels=none,subticks=5]{->}(0,0)(2,2)(-1,-1) +\begin{lstlisting} +\psset{xunit=2} +\begin{pspicture}[showgrid=true](0,0)(8,9) + \psset{showpoints=true} + \psplotDiffEqn[linecolor=red, method=varrkiv, plotpoints=2, varsteptol=.0001, + plotfuncy=dup 6 get dup mul exch 7 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} + \psplotDiffEqn[linecolor=blue, method=varrkiv, plotpoints=2, varsteptol=.0001, + plotfuncy=dup 2 get dup mul exch 3 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} \end{pspicture} -\end{LTXexample} - - - -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xlabelPos} and \texttt{ylabelPos}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -xlabelPos=bottom|axis|top -ylabelPos=left|axis|right \end{lstlisting} -By default the labels for ticks are placed at the bottom (x axis) -and left (y-axis). If both axes are drawn in the negative -direction the default is top (x axis) and right (y axis). It be -changed with the two options \Lkeyword{xlabelPos} and -\Lkeyword{ylabelPos}. With the value \Lkeyval{axis} the user can -place the labels depending on the value of \Lkeyword{labelsep}, which is taken into account for \texttt{axis}. - -\resetOptions% -\bigskip -\begin{LTXexample}[width=9cm] -\begin{pspicture}(3,3) -\psaxes{->}(3,3) -\end{pspicture}\hspace{2cm} -\begin{pspicture}(3,-3) -\psaxes[xlabelPos=top]{->}(3,-3) -\end{pspicture} -\end{LTXexample} - -\vspace{1cm} -\begin{LTXexample}[width=9cm] -\begin{pspicture}(-3,-3) -\psaxes{->}(-3,-3) -\end{pspicture}\hspace{2cm} -\begin{pspicture}(3,3) -\psaxes[labelsep=0pt, - ylabelPos=axis, - xlabelPos=axis]{->}(3,3) -\end{pspicture} -\end{LTXexample} - -\vspace{1cm} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(-1,1)(3,-3) -\psaxes[xlabelPos=top, - xticksize=0 20pt, - yticksize=-20pt 0]{->}(3,-3) -\end{pspicture} -\end{LTXexample} - - - - %-------------------------------------------------------------------------------------- -\subsection{Changing the label font size with \texttt{labelFontSize} and \texttt{mathLabel}} +\clearpage +\subsubsection{Simple equation of first order $y'=y$} %-------------------------------------------------------------------------------------- -This option sets the horizontal \textbf{and} vertical font size -for the labels depending on the option \Lkeyword{mathLabel} for the -text or the math mode. It will be overwritten when another package -or a user defines -\begin{lstlisting}[style=syntax] -\def\pshlabel#1{\labelFontSize ...} -\def\psvlabel#1{\labelFontSize ...} -\def\pshlabel#1{$\labelFontSize ...$}% for mathLabel=true (default) -\def\psvlabel#1{$\labelFontSize ...$}% for mathLabel=true (default) -\end{lstlisting} -in another way. Note that for \Lkeyword{mathLabel}=\true the font size -must be set by one of the mathematical styles \Lcs{textstyle}, -\Lcs{displaystyle}, \Lcs{scriptstyle}, or \Lcs{scriptscriptstyle}. - -\begin{LTXexample}[width=6cm] -\psset{mathLabel=false} -\begin{pspicture}(-0.25,-0.25)(5,2.25) -\psaxes{->}(5,2.25)[$x$,0][$y$,90] -\end{pspicture}\\[20pt] -\begin{pspicture}(-0.25,-0.25)(5,2.25) -\psaxes[labelFontSize=\footnotesize]{->}(5,2.25) -\end{pspicture}\\[20pt] -\begin{pspicture}(-0.25,-0.25)(5,2.25) -\psaxes[labelFontSize=\footnotesize]{->}(5,2.25) -\end{pspicture}\\[20pt] -\end{LTXexample} - -\begin{LTXexample}[width=6cm] -\begin{pspicture}(-0.25,-0.25)(5,2.25) -\psaxes[labelFontSize=\scriptstyle]{->}(5,2.25)[\textbf{x},-90][\textbf{y},0] -\end{pspicture}\\[20pt] -\psset{mathLabel=true} -\begin{pspicture}(-0.25,-0.25)(5,2.25) -\psaxes[labelFontSize=\scriptscriptstyle]{->}(5,2.25) -\end{pspicture}\\[20pt] -\end{LTXexample} +For the initial value $y(0)=1$ we have the solution $y(x)=e^x$. $y$ is always +on the stack, so we have to do nothing. Using the \Lkeyword{algebraic=true} option, we write it +as \verb$y[0]$. The following example shows different solutions depending to the number of plotpoints +with $y_0=1$: -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xlabelFactor} and \texttt{ylabelFactor}} -%-------------------------------------------------------------------------------------- -When having big numbers as data records then it makes sense to -write the values as ${\cdot 10^{}}$. These new -options allow you to define the additional part of the value, but -it must be set in math mode when using math operators! - -\resetOptions -\begin{LTXexample}[pos=t] -\readdata{\data}{demo1.data} -\pstScalePoints(1,0.000001){}{}% (x,y){additional x operator}{y op} -\psset{llx=-1cm,lly=-1cm} -\psgraph[ylabelFactor=\cdot 10^6,Dx=5,Dy=100](0,0)(25,750){8cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} -\endpsgraph -\pstScalePoints(1,1){}{}% reset -\end{LTXexample} +\begin{center} +\bgroup +\psset{xunit=4, yunit=.4} +\begin{pspicture}(3,19)\psgrid[subgriddiv=1] + \psplot[linewidth=6\pslinewidth, linecolor=green]{0}{3}{Euler x exp} + \psplotDiffEqn[linecolor=magenta,plotpoints=16,algebraic=true]{0}{3}{1}{y[0]} + \psplotDiffEqn[linecolor=blue,plotpoints=151]{0}{3}{1}{} + \psplotDiffEqn[linecolor=red,method=rk4,plotpoints=15]{0}{3}{1}{} + \psplotDiffEqn[linecolor=Orange,method=rk4,plotpoints=4]{0}{3}{1}{} + \psset{linewidth=4\pslinewidth} + \rput*(0.35,19){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](0.35,19){\small Euler order 1 $h=0{,}2$} + \rput*(0.35,17){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](0.35,17){\small Euler order 1 $h=0{,}02$} + \rput*(0.35,15){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](0.35,15){\small RK ordre 4 $h=1$} + \rput*(0.35,13){\psline[linecolor=red](-.75cm,0)} + \rput*[l](0.35,13){\small RK ordre 4 $h=0{,}2$} + \rput*(0.35,11){\psline[linecolor=green](-.75cm,0)} + \rput*[l](0.35,11){\small solution exacte} +\end{pspicture} +\egroup +\end{center} +\begin{lstlisting} +\psset{xunit=4, yunit=.4} +\begin{pspicture}(3,19)\psgrid[subgriddiv=1] + \psplot[linewidth=6\pslinewidth, linecolor=green]{0}{3}{Euler x exp} + \psplotDiffEqn[linecolor=magenta,plotpoints=16,algebraic=true]{0}{3}{1}{y[0]} + \psplotDiffEqn[linecolor=blue,plotpoints=151]{0}{3}{1}{} + \psplotDiffEqn[linecolor=red,method=rk4,plotpoints=15]{0}{3}{1}{} + \psplotDiffEqn[linecolor=Orange,method=rk4,plotpoints=4]{0}{3}{1}{} + \psset{linewidth=4\pslinewidth} + \rput*(0.35,19){\psline[linecolor=magenta](-.75cm,0)} + \rput*[l](0.35,19){\small Euler order 1 $h=0{,}2$} + \rput*(0.35,17){\psline[linecolor=blue](-.75cm,0)} + \rput*[l](0.35,17){\small Euler order 1 $h=0{,}02$} + \rput*(0.35,15){\psline[linecolor=Orange](-.75cm,0)} + \rput*[l](0.35,15){\small RK ordre 4 $h=1$} + \rput*(0.35,13){\psline[linecolor=red](-.75cm,0)} + \rput*[l](0.35,13){\small RK ordre 4 $h=0{,}2$} + \rput*(0.35,11){\psline[linecolor=green](-.75cm,0)} + \rput*[l](0.35,11){\small solution exacte} +\end{pspicture} +\end{lstlisting} %-------------------------------------------------------------------------------------- -\subsection{\nxLkeyword{decimalSeparator} and \nxLkeyword{comma}} +\clearpage +\subsubsection{$y'=\displaystyle\frac{2-ty}{4-t^2}$}% $ %-------------------------------------------------------------------------------------- -Syntax: + +For the initial value $y(0)=1$ the exact solution is +$y(x)=\displaystyle\frac{t+\sqrt{4-t^2}}{2}$. The function $f$ +described in PostScript code is like (y is still on the stack): \begin{lstlisting}[style=syntax] -comma=false|true -decimalSeparator= +x %% y x +mul %% x*y +2 exch sub %% 2-x*y +4 x dup mul %% 2-x*y 4 x^2 +sub %% 2-x*y 4-x^2 +div %% (2-x*y)/(4-x^2) \end{lstlisting} -Setting the option \Lkeyword{comma} to true gives labels with a comma as a decimal separator instead -of the dot. \Lkeyword{comma} and \verb|comma=true| is the same. The optional argument -\Lkeyword{decimalSeparator} allows an individual setting for languages with a different -character than a dot or a comma. The character has to set into braces, if it is an -active, e.\,g. \Lkeyword{decimalSeparator}=\Largb{,}. - -\resetOptions -\medskip -\begin{LTXexample}[width=5.5cm] -\begin{pspicture}(-0.5,-0.5)(5,5.5) -\psaxes[Dx=1.5,comma,Dy=0.75,dy=0.75]{->}(5,5) -\psplot[linecolor=red,linewidth=3pt]{0}{4.5}% - {x RadtoDeg cos 2 mul 2.5 add} -\psline[linestyle=dashed](0,2.5)(4.5,2.5) -\end{pspicture} -\end{LTXexample} +\noindent +The following example uses $y_0=1$. -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xyDecimals}, \texttt{xDecimals} and \texttt{yDecimals}} -%-------------------------------------------------------------------------------------- -Syntax: \begin{lstlisting}[style=syntax] -xyDecimals= -xDecimals= -yDecimals= +\newcommand{\InitCond}{1} +\newcommand{\Func}{x mul 2 exch sub 4 x dup mul sub div} +\newcommand{\FuncAlg}{(2-x*y[0])/(4-x^2)} \end{lstlisting} -By default the labels of the axes get numbers with or without -decimals, depending on the numbers. With these options -\verb|??Decimals| it is possible to determine the decimals, where -the option \Lkeyword{xyDecimals} sets this identical for both axes. -The default setting \verb|{}| means, that you'll get the standard -behaviour. - -\begin{LTXexample}[width=6cm] -\begin{pspicture}(-1.5,-0.5)(5,3.75) - \psaxes[xyDecimals=2]{->}(0,0)(4.5,3.5) +\begin{center} +\bgroup +\psset{xunit=6.4, yunit=9.6, showpoints=false} +\begin{pspicture}(0,1)(2,1.5) \psgrid[griddots=10](0,1)(2,1.5) + { \psset{linewidth=4\pslinewidth,linecolor=lightgray} + \psplot{0}{1.8}{x dup dup mul 4 exch sub sqrt add 2 div} + \psplot{1.8}{2}{x dup dup mul 4 exch sub sqrt add 2 div} } + \def\InitCond{1} + \def\Func{x mul 2 exch sub 4 x dup mul sub div} + \psplotDiffEqn[linecolor=magenta, plotpoints=20]{0}{1.9}{\InitCond}{\Func} + \psplotDiffEqn[linecolor=blue, plotpoints=191]{0}{1.9}{\InitCond}{\Func} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11,% + algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} + \psplotDiffEqn[linecolor=Orange, method=rk4, plotpoints=21,% + algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} + \psset{linewidth=4\pslinewidth}\small + \rput*(0,1.4){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](0,1.4){Euler order 1 $h=0{,}1$} + \rput*(0,1.35){\psline[linecolor=blue](-.75cm,0)}\rput*[l](0,1.35){Euler order 1 $h=0{,}01$} + \rput*(0,1.3){\psline[linecolor=Orange](-.75cm,0)}\rput*[l](0,1.3){RK order 4 $h=0{,}19$} + \rput*(0,1.25){\psline[linecolor=red](-.75cm,0)}\rput*[l](0,1.25){RK order 4 $h=0{,}095$} + \rput*(0,1.2){\psline[linecolor=lightgray](-.75cm,0)}\rput*[l](0,1.2){exactly} \end{pspicture} -\end{LTXexample} - +\egroup +\end{center} -\begin{LTXexample}[pos=t] -\psset{xunit=10cm,yunit=0.01cm,labelFontSize=\scriptstyle} -\begin{pspicture}(-0.1,-150)(1.5,550.0) - \psaxes[Dx=0.25,Dy=100,ticksize=-4pt 0,comma=true,xDecimals=3,yDecimals=1]{->}% - (0,0)(0,-100)(1.4,520)[\textbf{Amp\`ere},-90][\textbf{Voltage},0] +\begin{lstlisting}[xrightmargin=-1cm,xleftmargin=-1cm] +\psset{xunit=6.4, yunit=9.6, showpoints=false} +\begin{pspicture}(0,1)(2,1.7) \psgrid[subgriddiv=5] + { \psset{linewidth=4\pslinewidth,linecolor=lightgray} + \psplot{0}{1.8}{x dup dup mul 4 exch sub sqrt add 2 div} + \psplot{1.8}{2}{x dup dup mul 4 exch sub sqrt add 2 div} } + \def\InitCond{1} + \def\Func{x mul 2 exch sub 4 x dup mul sub div} + \psplotDiffEqn[linecolor=magenta, plotpoints=20]{0}{1.9}{\InitCond}{\Func} + \psplotDiffEqn[linecolor=blue, plotpoints=191]{0}{1.9}{\InitCond}{\Func} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11,% + algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} + \psplotDiffEqn[linecolor=Orange, method=rk4, plotpoints=21,% + algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} + \psset{linewidth=4\pslinewidth} + \rput*(0.3,1.6){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](0.3,1.6){\small Euler order 1 $h=0{,}1$} + \rput*(0.3,1.55){\psline[linecolor=blue](-.75cm,0)}\rput*[l](0.3,1.55){\small Euler order 1 $h=0{,}01$} + \rput*(0.3,1.5){\psline[linecolor=Orange](-.75cm,0)}\rput*[l](0.3,1.5){\small RK order 4 $h=0{,}19$} + \rput*(0.3,1.45){\psline[linecolor=red](-.75cm,0)}\rput*[l](0.3,1.45){\small RK order 4 $h=0{,}095$} + \rput*(0.3,1.4){\psline[linecolor=lightgray](-.75cm,0)}\rput*[l](0.3,1.4){\small exactly} \end{pspicture} -\end{LTXexample} +\end{lstlisting} -\resetOptions -\clearpage %-------------------------------------------------------------------------------------- -\subsection{\texttt{trigLabels} and \texttt{trigLabelBase} -- axis with trigonmetrical units} +\clearpage +\subsubsection{$y'=-2xy$} %-------------------------------------------------------------------------------------- -With the option \Lkeyword{trigLabels}=\true\ the labels on the x axis -are trigonometrical ones. The option \Lkeyword{trigLabelBase} set the -denominator of fraction. The default value of 0 is the same as no -fraction. The following constants are defined in the package: -\begin{lstlisting}[style=syntax] -\def§\ON§\psPiFour§\OFF§{12.566371} -\def§\ON§\psPiTwo§\OFF§{6.283185} -\def§\ON§\psPi§\OFF§{3.14159265} -\def§\ON§\psPiH§\OFF§{1.570796327} -\newdimen\pstRadUnit -\newdimen\pstRadUnitInv -§\ON§\pstRadUnit§\OFF§=1.047198cm % this is pi/3 -§\ON§\pstRadUnitInv§\OFF§=0.95493cm % this is 3/pi -\end{lstlisting} - - - -Because it is a bit complicated to set the right values, we show -some more examples here. - -For \textbf{all} following examples in this section we did a -global - -\lstinline[frame=single]|\psset{trigLabels=true,labelFontSize=\scriptstyle}|. +For $y(-1)=\frac{1}{e}$ we get $y(x)=e^{-x^2}$. -\psset{trigLabels,labelFontSize=\scriptstyle} Translating the -decimal ticks to trigonometrical ones makes no real sense, because -every 1 xunit (1cm) is a tick and the last one is at 6cm. - -\clearpage -\begin{minipage}{0.45\fullWidth} -\begin{pspicture}[trigLabels=true](-0.5,-1.25)(6.5,1.25)% - \pnode(5,0){A}% - \psaxes{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25)% -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% - \pnode(5,0){A}% - \psaxes{->}(0,0)(-.5,-1.25)(\psPiTwo,1.25) -\end{pspicture} -\end{lstlisting} -\end{minipage} - -\begin{minipage}{0.45\fullWidth} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)% - \psaxes[§\ON§trigLabelBase=3§\OFF§]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) +\begin{center} +\bgroup +\psset{unit=4} +\begin{pspicture}(-1,0)(3,1.1)\psgrid + \psplot[linewidth=4\pslinewidth,linecolor=gray]{-1}{3}{Euler x dup mul neg exp} + \psset{plotpoints=9} + \psplotDiffEqn[linecolor=cyan]{-1}{3}{1 Euler div}{x -2 mul mul} + \psplotDiffEqn[linecolor=yellow, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} + \psset{plotpoints=21} + \psplotDiffEqn[linecolor=blue]{-1}{3}{1 Euler div}{x -2 mul mul} + \psplotDiffEqn[linecolor=Orange, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} + \psset{linewidth=2\pslinewidth} + \rput*(2,1){\psline[linecolor=Orange](-0.25,0)} + \rput*[l](2,1){RK} + \rput*(2,.9){\psline[linecolor=blue](-0.25,0)} + \rput*[l](2,.9){\textsc{Euler}-1} + \rput*(2,.8){\psline[linecolor=gray](-0.25,0)} + \rput*[l](2,.8){solution} \end{pspicture} -\end{lstlisting} -\end{minipage} - -Modifying the ticks to have the last one exactly at the end is -possible with a different dx value ($\frac{\pi}{3}\approx 1.047$): +\egroup +\end{center} -\begin{minipage}{0.45\fullWidth} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}% - \psaxes[dx=\pstRadUnit]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.55\fullWidth} \begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(\psPiTwo,0){C}% - \psaxes[§\ON§dx=\pstRadUnit§\OFF§]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% +\psset{unit=4} +\begin{pspicture}(-1,0)(3,1.1)\psgrid + \psplot[linewidth=4\pslinewidth,linecolor=gray]{-1}{3}{Euler x dup mul neg exp} + \psset{plotpoints=9} + \psplotDiffEqn[linecolor=cyan]{-1}{3}{1 Euler div}{x -2 mul mul} + \psplotDiffEqn[linecolor=yellow, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} + \psset{plotpoints=21} + \psplotDiffEqn[linecolor=blue]{-1}{3}{1 Euler div}{x -2 mul mul} + \psplotDiffEqn[linecolor=Orange, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} + \psset{linewidth=2\pslinewidth} + \rput*(2,1){\psline[linecolor=Orange](-0.25,0)} + \rput*[l](2,1){RK} + \rput*(2,.9){\psline[linecolor=blue](-0.25,0)} + \rput*[l](2,.9){\textsc{Euler}-1} + \rput*(2,.8){\psline[linecolor=gray](-0.25,0)} + \rput*[l](2,.8){solution} +\end{pspicture} \end{lstlisting} -\end{minipage} -\begin{minipage}{0.45\fullWidth} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}% - \psaxes[dx=\pstRadUnit,trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(5,0){B}% - \psaxes[dx=\pstRadUnit,§\ON§trigLabelBase=3§\OFF§] {->}(0,0)(-0.5,-1.25)(\psPiTwo,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} - -\ncline[linestyle=dashed,linewidth=0.4pt]{A}{B} +%-------------------------------------------------------------------------------------- +\clearpage +\subsubsection{Spiral of Cornu} +%-------------------------------------------------------------------------------------- -Set everything globally in radian units. Now 6 units on the -$x$-axis are $6\pi$. Using \Lkeyword{trigLabelBase}=3 reduces this -value to $2\pi$, a.s.o. +The integrals of \Index{Fresnel}: +\begin{align} x & =\int^t_0\cos\frac{\pi t^2}{2}\mathrm{d}t \\ + y & =\int^t_0\sin\frac{\pi t^2}{2}\mathrm{d}t \\ +\intertext{with} + \dot{x} &= \cos\frac{\pi t^2}{2} \\ + \dot{y} & =\sin\frac{\pi t^2}{2} + \end{align} -\bigskip -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}% - \psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)% -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.55\fullWidth} \begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25)\pnode(6,0){D}% - \psaxes{->}(0,0)(-0.5,-1.25)(6.5,1.25)% -\end{pspicture}% +\psset{unit=8} +\begin{pspicture}(1,1)\psgrid[subgriddiv=5] + \psplotDiffEqn[whichabs=0,whichord=1,linecolor=red,method=rk4,algebraic=true,% + plotpoints=500,showpoints=true]{0}{10}{0 0}{cos(Pi*x^2/2)|sin(Pi*x^2/2)} +\end{pspicture} \end{lstlisting} -\end{minipage} -\ncline[linestyle=dashed,linewidth=0.4pt]{C}{D} -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§trigLabelBase=3§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} +\begin{center} +\bgroup +\psset{unit=8} +\begin{pspicture}(1,1)\psgrid[subgriddiv=5] + \psplotDiffEqn[whichabs=0,whichord=1,linecolor=red,method=rk4,algebraic=true,% + plotpoints=500,showpoints=true]{0}{10}{0 0}{cos(Pi*x^2/2)|sin(Pi*x^2/2)} +\end{pspicture} +\egroup +\end{center} -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=4]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§trigLabelBase=4§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} +%-------------------------------------------------------------------------------------- +\clearpage +\subsubsection{Lotka-Volterra} +%-------------------------------------------------------------------------------------- -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=6]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{§\ON§xunit=\pstRadUnit§\OFF§}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§trigLabelBase=6§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) -\end{pspicture}% -\end{lstlisting} -\end{minipage} +The Lotka-Volterra model describes interactions between two species in an ecosystem, a +predator and a prey. This represents our first multi-species model. Since we are considering +two species, the model will involve two equations, one which describes how the prey +population changes and the second which describes how the predator population changes. +For concreteness let us assume that the prey in our model are rabbits, and that the +predators are foxes. If we let $R(t)$ and $F(t)$ represent the number of rabbits and +foxes, respectively, that are alive at time t, then the Lotka-Volterra model is: +% +\begin{align} +\dot R &= a\cdot R - b\cdot R\cdot F\\ +\dot F &= e\cdot b\cdot R\cdot F - c\cdot F +\end{align} +% +where the parameters are defined by: +\begin{description} +\item[a] is the natural growth rate of rabbits in the absence of predation, +\item[c] is the natural death rate of foxes in the absence of food (rabbits), +\item[b] is the death rate per encounter of rabbits due to predation, +\item[e] is the efficiency of turning predated rabbits into foxes. +\end{description} +The Stella model representing the \Index{Lotka-Volterra} model will be slightly more complex than the +single species models we've dealt with before. The main difference is that our model will have +two stocks (reservoirs), one for each species. Each species will have its own birth and death +rates. In addition, the Lotka-Volterra model involves four parameters rather than two. All told, +the Stella representation of the Lotka-Volterra model will use two stocks, four flows, four +converters and many connectors. -The best way seems to be to set the $x$-unit to -\Lcs{pstRadUnit}. Plotting a function doesn't consider the value -for \Lkeyword{trigLabelBase}, it has to be done by the user. The first -example sets the unit locally for the \Lcs{psplot} back to 1cm, -which is needed, because we use this unit on the PostScript side. - -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.4,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[xunit=1cm,linecolor=red,linewidth=1.5pt]{0}{\psPiTwo}{x RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[§\ON§xunit=1cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{§\ON§\psPiTwo§\OFF§}{x RadtoDeg sin} +\bgroup +\begin{center} +\def\InitCond{ 0 10 10}%% xa ya xl +\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vlapin} +\def\Vlapin{1} \def\Vaigle{1.6} +\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic=true,% + plotpoints=20,showpoints=true} +\begin{pspicture}[showgrid=true](-3,-3)(10,10) + \psplotDiffEqn[plotfuncy=pop 0,whichabs=2,linecolor=red]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[whichabs=0,whichord=1,linecolor=black,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[whichabs=0,whichord=1,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} \end{pspicture} -\end{lstlisting} -\end{minipage} - +\end{center} -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.4,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x Pi 3 div mul RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[trigLabelBase=3]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{6}{x §\ON§Pi 3 div mul §\OFF§RadtoDeg sin} +\begin{lstlisting}[label={fig:aiglelapin},xrightmargin=-1.5cm] +\def\InitCond{ 0 10 10}%% xa ya xl +\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vlapin} +\def\Vlapin{1} \def\Vaigle{1.6} +\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic=true,% + plotpoints=20,showpoints=true} +\begin{pspicture}[showgrid=true](-3,-3)(10,10) + \psplotDiffEqn[plotfuncy=pop 0,whichabs=2,linecolor=red]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[whichabs=0,whichord=1,linecolor=black,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[whichabs=0,whichord=1,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} \end{pspicture} \end{lstlisting} -\end{minipage} -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.4,-1.25)(6.5,1.25) - \psaxes[dx=1.5]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§dx=1.5§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[§\ON§xunit=0.5cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{§\ON§\psPiFour§\OFF§}{x RadtoDeg sin} +\begin{center} +\def\InitCond{ 0 10 10}%% xa ya xl +\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vlapin} +\def\Vlapin{1} \def\Vaigle{1.6} +\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic=true,% + plotpoints=20,showpoints=true} +\begin{pspicture}[showgrid=true](0,-0.25)(10,14) + \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup + mul add sqrt,linecolor=red,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup + mul add sqrt,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[plotfuncy=pop Func aload pop pop dup mul exch dup mul add sqrt, + linecolor=yellow]{0}{10}{\InitCond}{\Faiglelapin} \end{pspicture} -\end{lstlisting} -\end{minipage} - +\end{center} +\egroup -\begin{minipage}{0.45\fullWidth} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.4,-1.25)(6.5,1.25) - \psaxes[dx=0.75,trigLabelBase=2]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[xunit=.5cm,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} -\end{pspicture} -\end{minipage}% -\begin{minipage}{0.55\fullWidth} -\begin{lstlisting} -\psset{xunit=\pstRadUnit}% -\begin{pspicture}(-0.5,-1.25)(6.5,1.25) - \psaxes[§\ON§dx=0.75§\OFF§,§\ON§trigLabelBase=2§\OFF§]{->}(0,0)(-0.5,-1.25)(6.5,1.25) - \psplot[§\ON§xunit=0.5cm§\OFF§,linecolor=red,linewidth=1.5pt]{0}{\psPiFour}{x RadtoDeg sin} +\begin{lstlisting}[label={fig:aiglelapin},xrightmargin=-1.5cm] +\def\InitCond{ 0 10 10}%% xa ya xl +\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% + -\Vlapin} +\def\Vlapin{1} \def\Vaigle{1.6} +\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic=true,% + plotpoints=20,showpoints=true} +\begin{pspicture}[showgrid=true](10,12) + \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup + mul add sqrt,linecolor=red,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup + mul add sqrt,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} + \psplotDiffEqn[plotfuncy=pop Func aload pop pop dup mul exch dup mul add sqrt, + linecolor=yellow]{0}{10}{\InitCond}{\Faiglelapin} \end{pspicture} \end{lstlisting} -\end{minipage} - - -It is also possible to set the $x$ unit and $dx$ value to get the -labels right. But this needs some more understanding as to how it -really works. A \Lkeyword{xunit}=1.570796327 sets the unit to $\pi/2$ -and a \Lkeyword{dx}=0.666667 then puts at every $2/3$ of the unit a -tick mark and a label. The length of the $x$-axis is 6.4 units -which is $6.4\cdot 1.570796327cm\approx 10cm$. The function then -is plotted from $0$ to $3\pi=9.424777961$. +%-------------------------------------------------------------------------------------- +\subsubsection{$y''=y$} +%-------------------------------------------------------------------------------------- +Beginning with the initial equation $\displaystyle y(x)=Ae^x+Be^{-x}$ we get the hyperbolic +trigonometrical functions. \begin{center} -\psset{unit=1cm} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psaxes[xunit=\psPiH,showorigin=false,trigLabelBase=3,dx=0.666667]{->}(0,0)(-0.5,-1.25)(6.4,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{9.424777961}{% - x RadtoDeg dup sin exch 1.1 mul cos add} +\bgroup +\def\Funct{exch} \psset{xunit=5cm, yunit=0.75cm} +\begin{pspicture}(0,-0.25)(2,7)\psgrid[subgriddiv=1,griddots=10] + \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler x exp} %%e^x + \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 1}{\Funct} + \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 1}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 1}{\Funct} + \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp %%ch(x) + exch x neg exp add 2 div} + \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 0}{\Funct} + \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 0}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 0}{\Funct} + \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp + exch x neg exp sub 2 div} %%sh(x) + \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{0 1}{\Funct} + \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{0 1}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{0 1}{\Funct} + \rput*(1.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](1.3,.9){\small\textsc{Euler} order 1 $h=1$} + \rput*(1.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](1.3,.8){\small\textsc{Euler} order 1 $h=0{,}1$} + \rput*(1.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](1.3,.7){\small RK order 4 $h=1$} + \rput*(1.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](1.3,.6){\small exact solution} \end{pspicture} +\egroup \end{center} -\begin{lstlisting} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psaxes[§\ON§xunit=\psPiH§\OFF§,§\ON§trigLabelBase=3§\OFF§,§\ON§dx=0.666667§\OFF§]{->}(0,0)(-0.5,-1.25)(6.4,1.25) - \psplot[linecolor=red,linewidth=1.5pt]{0}{§\ON§9.424777961§\OFF§}{% - x RadtoDeg dup sin exch 1.1 mul cos add} + +\begin{lstlisting}[label={fig:minusexp},xrightmargin=-1.5cm] +\def\Funct{exch} \psset{xunit=5cm, yunit=0.75cm} +\begin{pspicture}(0,-0.25)(2,7)\psgrid[subgriddiv=1,griddots=10] + \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler x exp} %%e^x + \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 1}{\Funct} + \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 1}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 1}{\Funct} + \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp %%ch(x) + exch x neg exp add 2 div} + \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 0}{\Funct} + \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 0}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 0}{\Funct} + \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp + exch x neg exp sub 2 div} %%sh(x) + \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{0 1}{\Funct} + \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{0 1}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{0 1}{\Funct} + \rput*(1.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](1.3,.9){\small\textsc{Euler} order 1 $h=1$} + \rput*(1.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](1.3,.8){\small\textsc{Euler} order 1 $h=0{,}1$} + \rput*(1.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](1.3,.7){\small RK order 4 $h=1$} + \rput*(1.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](1.3,.6){\small exact solution} \end{pspicture} \end{lstlisting} +%-------------------------------------------------------------------------------------- +\clearpage +\subsubsection{$y''=-y$} +%-------------------------------------------------------------------------------------- \begin{center} -\psset{unit=1cm} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psaxes[xunit=\psPi,dx=0.25]{->}(0,0)(-0.25,-1.25)(3.2,1.25) - \psplot[xunit=0.25,plotpoints=500,linecolor=red,linewidth=1.5pt]{0}{37.70}{% - x RadtoDeg dup sin exch 1.1 mul cos add} +\bgroup +\def\Funct{exch neg} +\psset{xunit=1, yunit=4} +\def\quatrepi{12.5663706144}%%4pi=12.5663706144 +\begin{pspicture}(0,-1.25)(\quatrepi,1.25)\psgrid[subgriddiv=1,griddots=10] + \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg cos}%%cos(x) + \psplotDiffEqn[linecolor=blue, plotpoints=201]{0}{3.1415926}{1 0}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=31]{0}{\quatrepi}{1 0}{\Funct} + \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg sin} %%sin(x) + \psplotDiffEqn[linecolor=blue,plotpoints=201]{0}{3.1415926}{0 1}{\Funct} + \psplotDiffEqn[linecolor=red,method=rk4, plotpoints=31]{0}{\quatrepi}{0 1}{\Funct} + \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](3.3,.9){\small Euler order 1 $h=1$} + \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](3.3,.8){\small Euler order 1 $h=0{,}1$} + \rput*(3.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](3.3,.7){\small RK order 4 $h=1$} + \rput*(3.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](3.3,.6){\small exact solution} \end{pspicture} +\egroup \end{center} -\begin{lstlisting} -\psset{§\ON§unit=1cm§\OFF§} - \psplot[§\ON§xunit=0.25§\OFF§,§\ON§plotpoints=500§\OFF§,linecolor=red,linewidth=1.5pt]{0}{37.70}{% - x RadtoDeg dup sin exch 1.1 mul cos add} + +\begin{lstlisting}[label={fig:minusexp2}] +\def\Funct{exch neg} +\psset{xunit=1, yunit=4} +\def\quatrepi{12.5663706144}%%4pi=12.5663706144 +\begin{pspicture}(0,-1.25)(\quatrepi,1.25)\psgrid[subgriddiv=1,griddots=10] + \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg cos}%%cos(x) + \psplotDiffEqn[linecolor=blue, plotpoints=201]{0}{3.1415926}{1 0}{\Funct} + \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=31]{0}{\quatrepi}{1 0}{\Funct} + \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg sin} %%sin(x) + \psplotDiffEqn[linecolor=blue,plotpoints=201]{0}{3.1415926}{0 1}{\Funct} + \psplotDiffEqn[linecolor=red,method=rk4, plotpoints=31]{0}{\quatrepi}{0 1}{\Funct} + \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](3.3,.9){\small Euler order 1 $h=1$} + \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](3.3,.8){\small Euler order 1 $h=0{,}1$} + \rput*(3.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](3.3,.7){\small RK order 4 $h=1$} + \rput*(3.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](3.3,.6){\small exact solution} \end{pspicture} \end{lstlisting} +%-------------------------------------------------------------------------------------- +\clearpage +\subsubsection{The mechanical pendulum: $y''=-\frac{g}{l}\sin(y)$}% $ +%-------------------------------------------------------------------------------------- + +For small \Index{oscillation}s $\sin(y)\simeq y$: + +\[ y(x)=y_0\cos\left(\sqrt{\frac{g}{l}}x\right) \] + +The function $f$ is written in PostScript code: + +\begin{lstlisting}[style=syntax] +exch RadtoDeg sin -9.8 mul %% y' -gsin(y) +\end{lstlisting} \begin{center} -\psset{unit=1cm} -\begin{pspicture}(-0.5,-2)(10,2) - \psplot[xunit=0.0625,linecolor=red,linewidth=1.5pt,plotpoints=5000]{0}{150.80}{% - x RadtoDeg dup sin exch 1.1 mul cos add} - \psaxes[xunit=\psPi,dx=0.5,Dx=8,subticks=2]{->}(0,0)(-0.1,-2)(3.2,2) +\bgroup +\def\Func{y[1]|-9.8*sin(y[0])} +\psset{yunit=2,xunit=4,algebraic=true,linewidth=1.5pt} +\begin{pspicture}(0,-2.25)(3,2.25) + \psaxes{->}(0,0)(0,-2)(3,2) + \psplot[linewidth=3\pslinewidth, linecolor=Orange]{0}{3}{.1*cos(sqrt(9.8)*x)} + \psset{method=rk4,plotpoints=50,linecolor=blue} + \psplotDiffEqn{0}{3}{.1 0}{\Func} + \psplot[linewidth=3\pslinewidth,linecolor=Orange]{0}{3}{.25*cos(sqrt(9.8)*x)} + \psplotDiffEqn{0}{3}{.25 0}{\Func} + \psplotDiffEqn{0}{3}{.5 0}{\Func} + \psplotDiffEqn{0}{3}{1 0}{\Func} + \psplotDiffEqn[plotpoints=100]{0}{3}{Pi 2 div 0}{\Func} \end{pspicture} +\egroup \end{center} -\begin{lstlisting} -\psset{§\ON§unit=1cm§\OFF§} -\begin{pspicture}(-0.5,-1.25)(10,1.25) - \psplot[§\ON§xunit=0.0625§\OFF§,linecolor=red,linewidth=1.5pt,% - §\ON§plotpoints=5000§\OFF§]{0}{150.80}% - {x RadtoDeg dup sin exch 1.1 mul cos add} - \psaxes[§\ON§xunit=\psPi§\OFF§,§\ON§dx=0.5§\OFF§,§\ON§Dx=8§\OFF§]{->}(0,0)(-0.25,-1.25)(3.2,1.25) + +\begin{lstlisting}[label=fig:second] +\def\Func{y[1]|-9.8*sin(y[0])} +\psset{yunit=2,xunit=4,algebraic=true,linewidth=1.5pt} +\begin{pspicture}(0,-2.25)(3,2.25) + \psaxes{->}(0,0)(0,-2)(3,2) + \psplot[linewidth=3\pslinewidth, linecolor=Orange]{0}{3}{.1*cos(sqrt(9.8)*x)} + \psset{method=rk4,plotpoints=50,linecolor=blue} + \psplotDiffEqn{0}{3}{.1 0}{\Func} + \psplot[linewidth=3\pslinewidth,linecolor=Orange]{0}{3}{.25*cos(sqrt(9.8)*x)} + \psplotDiffEqn{0}{3}{.25 0}{\Func} + \psplotDiffEqn{0}{3}{.5 0}{\Func} + \psplotDiffEqn{0}{3}{1 0}{\Func} + \psplotDiffEqn[plotpoints=100]{0}{3}{Pi 2 div 0}{\Func} \end{pspicture} \end{lstlisting} +%-------------------------------------------------------------------------------------- +\clearpage +\subsubsection{$y''=-\frac{y'}{4}-2y$}% $ +%-------------------------------------------------------------------------------------- + +For $y_0=5$ and $y'_0=0$ the solution is: + +\[ +5e^{-\frac{x}{8}}\left(\cos\left(\omega x\right)+\frac{\sin(\omega x)}{8\omega}\right) +\mbox{ avec } \omega=\frac{\sqrt{127}}{8} +\] \begin{center} -\psset{unit=1cm} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} +\bgroup +\psset{xunit=.6,yunit=0.8,plotpoints=500} +\begin{pspicture}(0,-4.25)(26,5.25) + \psaxes{->}(0,0)(0,-4)(26,5) + \psplot[plotpoints=200,linewidth=4\pslinewidth,linecolor=gray]{0}{26}{% + Euler x -8 div exp x 127 sqrt 8 div mul RadtoDeg dup cos 5 mul exch sin 127 sqrt div 5 mul add mul} + \psplotDiffEqn[linecolor=red,linewidth=5\pslinewidth]{0}{26}{5 0} + {dup 3 1 roll -4 div exch 2 mul sub} + \psplotDiffEqn[linecolor=black,algebraic=true]{0}{26}{5 0} {y[1]|-y[1]/4-2*y[0]} + \psset{method=rk4, plotpoints=50} + \psplotDiffEqn[linecolor=blue,linewidth=5\pslinewidth]{0}{26}{5 0}{% + dup 3 1 roll -4 div exch 2 mul sub} + \psplotDiffEqn[linecolor=black,algebraic=true]{0}{26}{5 0}{y[1]|-y[1]/4-2*y[0]} \end{pspicture} +\egroup \end{center} + \begin{lstlisting} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true,§\ON§xunit=\psPi§\OFF§]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} +\psset{xunit=.6,yunit=0.8,plotpoints=500} +\begin{pspicture}(0,-4.25)(26,5.25) + \psaxes{->}(0,0)(0,-4)(26,5) + \psplot[plotpoints=200,linewidth=4\pslinewidth,linecolor=gray]{0}{26}{% + Euler x -8 div exp x 127 sqrt 8 div mul RadtoDeg dup cos 5 mul exch sin 127 sqrt div 5 mul add mul} + \psplotDiffEqn[linecolor=red,linewidth=5\pslinewidth]{0}{26}{5 0} + {dup 3 1 roll -4 div exch 2 mul sub} + \psplotDiffEqn[linecolor=black,algebraic=true]{0}{26}{5 0} {y[1]|-y[1]/4-2*y[0]} + \psset{method=rk4, plotpoints=50} + \psplotDiffEqn[linecolor=blue,linewidth=5\pslinewidth]{0}{26}{5 0}{% + dup 3 1 roll -4 div exch 2 mul sub} + \psplotDiffEqn[linecolor=black,algebraic=true]{0}{26}{5 0}{y[1]|-y[1]/4-2*y[0]} \end{pspicture} \end{lstlisting} -\begin{center} -\psset{unit=1cm} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true, - trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} -\end{pspicture} -\end{center} +\clearpage +\subsection{Save final state of a equation} +With the macros \Lcs{BeginSaveFinalState} and \Lcs{EndSaveFinalState} the +end values of a differential equation +can be saved and then used with the optional argument \Lkeyword{GetFinalState} +as starting values for another equation. + \begin{lstlisting} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psaxes[trigLabels=true, - trigLabelBase=2,dx=\psPiH,xunit=\psPi]{->}(0,0)(-2.2,-1.5)(2.2,1.5) - \psplot[linecolor=red,linewidth=1.5pt]{-7}{7}{x RadtoDeg sin} +\psset{unit=10cm,linewidth=2pt} +\begin{pspicture}(1,1)\psgrid[subgridcolor=black!20,subgriddiv=20] +\BeginSaveFinalState + \psplotDiffEqn[ + whichabs=0,whichord=1,linecolor=red,method=rk4, + plotpoints=10,showpoints=true]{0}{1}{0 0}{ + pop pop + x dup mul 2 div 180 mul cos %% dx/dt + x dup mul 2 div 180 mul sin %% dy/dt + } + \psplotDiffEqn[GetFinalState, + whichabs=0,whichord=1,linecolor=blue,method=rk4,%SaveFinalState, + plotpoints=10,showpoints=true]{1}{2}{0 0}{ + pop pop + x dup mul 2 div 180 mul cos %% dx/dt + x dup mul 2 div 180 mul sin %% dy/dt + } + \psplotDiffEqn[GetFinalState, + whichabs=0,whichord=1,linecolor=cyan,method=rk4,%SaveFinalState, + plotpoints=19,showpoints=true]{2}{3}{0 0 }{ + pop pop + x dup mul 2 div 180 mul cos %% dx/dt + x dup mul 2 div 180 mul sin %% dy/dt + } +\EndSaveFinalState \end{pspicture} \end{lstlisting} -\psset{trigLabels=false} +\bigskip +\begin{center} +\psset{unit=6cm,linewidth=2pt} +\begin{pspicture}(1,1)\psgrid[subgridcolor=black!20,subgriddiv=20] +\BeginSaveFinalState + \psplotDiffEqn[ + whichabs=0,whichord=1,linecolor=red,method=rk4, + plotpoints=10,showpoints=true]{0}{1}{0 0}{ + pop pop + x dup mul 2 div 180 mul cos %% dx/dt + x dup mul 2 div 180 mul sin %% dy/dt + } + \psplotDiffEqn[GetFinalState, + whichabs=0,whichord=1,linecolor=blue,method=rk4,%SaveFinalState, + plotpoints=10,showpoints=true]{1}{2}{0 0}{ + pop pop + x dup mul 2 div 180 mul cos %% dx/dt + x dup mul 2 div 180 mul sin %% dy/dt + } + \psplotDiffEqn[GetFinalState, + whichabs=0,whichord=1,linecolor=cyan,method=rk4,%SaveFinalState, + plotpoints=19,showpoints=true]{2}{3}{0 0 }{ + pop pop + x dup mul 2 div 180 mul cos %% dx/dt + x dup mul 2 div 180 mul sin %% dy/dt + } +\EndSaveFinalState +\end{pspicture} +\end{center} +\psset{unit=1cm,linewidth=0.75pt} %-------------------------------------------------------------------------------------- -\subsection{\texttt{ticks}} +\clearpage +\section{\nxLcs{psMatrixPlot}} %-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -ticks=all|x|y|none -\end{lstlisting} - -This option is also already in the \verb+pst-plot+ package and -only mentioned here for some completeness. - -\begin{LTXexample}[width=3.5cm] -\psset{ticksize=6pt} -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=all,subticks=5]{->}(0,0)(-1,-1)(2,2) -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=y,subticks=5]{->}(0,0)(-1,-1)(2,2) -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=x,subticks=5]{->}(0,0)(2,2)(-1,-1) -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=none,subticks=5]{->}(0,0)(2,2)(-1,-1) -\end{pspicture} -\end{LTXexample} - -Single ticks with labels can be set with the two macros \Lcs{psxTick} and \Lcs{psyTick}: -% -\begin{lstlisting}[style=syntax] -\psxTick[options](x value){label} -\psyTick[options](y value){label} -\end{lstlisting} - - -\begin{LTXexample}[width=.5\linewidth] -\begin{psgraph}[Dx=2,Dy=2](0,0)(-4,-2.2)(4,2.2){.5\textwidth}{!} - \psxTick[linecolor=red](1.5){x_0} - \psyTick[linecolor=blue](1.7){y_0} -\end{psgraph} -\end{LTXexample} +\begin{filecontents}{matrix.data} +/dotmatrix [ % +0 1 1 0 0 0 0 1 1 1 +0 1 1 0 1 1 1 0 1 0 +1 0 1 1 0 0 0 1 1 0 +0 0 1 0 0 0 0 0 1 1 +1 1 1 1 1 0 1 0 0 1 +0 0 1 1 0 1 0 1 1 1 +1 0 0 0 1 1 0 0 0 1 +0 0 0 1 1 1 0 1 1 0 +1 1 0 0 0 0 1 0 0 1 +1 0 1 0 0 1 1 1 0 0 +] def +\end{filecontents} -% full= 0, top=1, bottom=-1, inner=2 => -1 0 1 2 -%-------------------------------------------------------------------------------------- -\subsection{\texttt{tickstyle}} -%-------------------------------------------------------------------------------------- -Syntax: +This macro allows you to visualize a matrix. The datafile must be +defined as a PostScript matrix named \Lps{dotmatrix}: \begin{lstlisting}[style=syntax] -tickstyle=full|top|bottom|inner +/dotmatrix [ % <------------ important line +0 1 1 0 0 0 0 1 1 1 +0 1 1 0 1 1 1 0 1 0 +1 0 1 1 0 0 0 1 1 0 +0 0 1 0 0 0 0 0 1 1 +1 1 1 1 1 0 1 0 0 1 +0 0 1 1 0 1 0 1 1 1 +1 0 0 0 1 1 0 0 0 1 +0 0 0 1 1 1 0 1 1 0 +1 1 0 0 0 0 1 0 0 1 +1 0 1 0 0 1 1 1 0 0 +] def % <------------ important line \end{lstlisting} -The value \Lkeyval{inner} (not available with the basic \LPack{pstricks} package) is -only valid for the axes style \Lkeyval{frame}. - -\medskip -\begin{LTXexample}[pos=t] -\psset{subticks=10} -\begin{pspicture}(-1,-1)(3,3) \psaxes[tickstyle=full]{->}(3,3) \end{pspicture} -\begin{pspicture}(-1,-1)(3,3) \psaxes[tickstyle=top]{->}(3,3) \end{pspicture} -\begin{pspicture}(-1,-1)(3,3) \psaxes[tickstyle=bottom]{->}(3,3)\end{pspicture} -\begin{pspicture}(-1,-1)(3,3) - \psaxes[axesstyle=frame, tickstyle=inner, ticksize=0 4pt]{->}(3,3) -\end{pspicture} -\end{LTXexample} - - -%-------------------------------------------------------------------------------------- -\subsection{\texttt{ticksize}, \texttt{xticksize}, \texttt{yticksize}} -%-------------------------------------------------------------------------------------- - -With this new option the recent \Lkeyword{tickstyle} option of -\LPack{pst-plot} is obsolete and no longer supported by \LPack{pstricks-add}. +Only the value 0 is important, in which case nothing happens, and +for all other cases a dot is printed. The syntax of the macro is: -Syntax: -\begin{lstlisting}[style=syntax] -ticksize=value[unit] -ticksize=value[unit] value[unit] -xticksize=value[unit] -xticksize=value[unit] value[unit] -yticksize=value[unit] -yticksize=value[unit] value[unit] -\end{lstlisting} +\begin{BDef} +\Lcs{psMatrixPlot}\OptArgs\Largb{rows}\Largb{columns}\Largb{data file} +\end{BDef} -\Lkeyword{ticksize} sets both values. The first one is left/below and the optional second -one is right/above of the coordinate axis. The old setting \Lkeyset{tickstyle=bottom} is -now easy to realize, e.g.: \Lkeyword{ticksize}=-6pt 0, or vice versa, if the coordinates -are set from positive to negative values. +The \Index{matrix} is scanned line by line from the the first one to the +last. In general it appears as a bottom-to-top version of the +above listed matrix, the first row $0\,1\,1\,0\,0\,0\,0\,1\,1\,1$ +is the first plotted line ($y=1$). With the option +\Lkeyword{ChangeOrder}=\true\ it looks exactly like the above view. -\medskip -\begin{LTXexample}[width=6cm] -\psset{arrowscale=2} -\begin{pspicture}(-1.5,-1.5)(4,3.5) - \psaxes[ticksize=0.5cm]{->}(0,0)(-1.5,-1.5)(4,3.5) +\bgroup +\begin{center} +%\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(-0.5,-0.75)(11,11) + \psaxes{->}(11,11) + \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=magenta]% + {10}{10}{matrix.data} + \psMatrixPlot[dotsize=.5cm,dotstyle=o,ChangeOrder]{10}{10}{matrix.data} \end{pspicture} -\end{LTXexample} +%\end{LTXexample} +\end{center} -\begin{LTXexample}[width=6cm] -\psset{arrowscale=2} -\begin{pspicture}(-1.5,-1.5)(4,3.5) - \psaxes[xticksize=-10pt 0,yticksize=0 10pt]% - {->}(0,0)(-1.5,-1.5)(4,3.5) +\begin{lstlisting} +\begin{pspicture}(-0.5,-0.75)(11,11) + \psaxes{->}(11,11) + \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=magenta]% + {10}{10}{matrix.data} + \psMatrixPlot[dotsize=.5cm,dotstyle=o,ChangeOrder]{10}{10}{matrix.data} \end{pspicture} -\end{LTXexample} - -A grid is also possible by setting the values to the max/min coordinates. +\end{lstlisting} -\begin{LTXexample}[width=6cm] -\psset{arrowscale=2} -\begin{pspicture}(-.5,-.5)(5,4.5) - \psaxes[ticklinestyle=dashed, - ticksize=0 4cm]{->}(0,0)(-.5,-.5)(5,4.5) +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(-0.5,-0.75)(11,11) + \psaxes{->}(11,11) + \psMatrixPlot[dotscale=3,dotstyle=*,linecolor=blue]{10}{8}{matrix.data} \end{pspicture} \end{LTXexample} \clearpage -%-------------------------------------------------------------------------------------- -\subsection{\texttt{subticks}} -%-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -subticks= -\end{lstlisting} - -By default \Lkeyword{subticks} cannot have labels. +With the \Lkeyword{colorType}=1 the data is printed as continous color +in the range of the wavelength. The smallest value of the data array +is set to red and the biggest value is set to violett. All other values +are substituted by the corresponding color of the wavlength. +\Lkeyword{colorType}=2 ist the same, but vice versa +with the color, from violet to red. \Lkeyword{colorType}=3 is the grayscale +image and \Lkeyword{colorType}=4 the same invers. -\begin{LTXexample}[width=3.5cm] -\psset{ticksize=6pt} -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=all,subticks=5]{->}(0,0)(-1,-1)(2,2) -\end{pspicture} -\end{LTXexample} +The following examples use a 200$\times$200 +matrix data, which is saved as /dotmatrix [...] in the file \LFile{pstricks-add-doc.dat}. -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=y,subticks=5]{->}(0,0)(-1,-1)(2,2) +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(10,10) + \psMatrixPlot[colorType=1,xStep=0.05,yStep=0.05]{200}{200}{dotmatrix.data} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=x,subticks=5]{->}(0,0)(2,2)(-1,-1) +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(10,10) + \psMatrixPlot[colorType=2,xStep=0.05,yStep=0.05]{200}{200}{dotmatrix.data} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}(-1,-1)(2,2) -\psaxes[ticks=none,subticks=5]{->}(0,0)(2,2)(-1,-1) +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(10,10) + \psMatrixPlot[colorType=3,xStep=0.05,yStep=0.05]{200}{200}{dotmatrix.data} \end{pspicture} \end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\texttt{subticksize}, \texttt{xsubticksize}, \texttt{ysubticksize}} -%-------------------------------------------------------------------------------------- - -Syntax: -\begin{lstlisting}[style=syntax] -subticksize=value -xsubticksize=value -ysubticksize=value -\end{lstlisting} - -\Lkeyword{subticksize} sets both values, which are relative to the ticksize length and -can have any number. 1 sets it to the same length as the main ticks. - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{yunit=1.5cm,xunit=3cm} -\begin{pspicture}(-1.25,-4.75)(3.25,.75) - \psaxes[xticksize=-4.5 0.5,ticklinestyle=dashed,subticks=5,xsubticksize=1,% - ysubticksize=0.75,xsubticklinestyle=dotted,xsubtickwidth=1pt, - subtickcolor=gray]{->}(0,0)(-1,-4)(3.25,0.5) +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(10,10) + \psMatrixPlot[colorType=4,xStep=0.05,yStep=0.05]{200}{200}{dotmatrix.data} \end{pspicture} \end{LTXexample} +\egroup %-------------------------------------------------------------------------------------- -\subsection{\texttt{tickcolor}, \texttt{subtickcolor}} +\section{Dashed Lines} %-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -tickcolor= -xtickcolor= -ytickcolor= -subtickcolor= -xsubtickcolor= -ysubtickcolor= -\end{lstlisting} +Tobias Nähring has implemented an enhanced feature for dashed +lines. The number of arguments is no longer limited. -\Lkeyword{tickcolor} and \Lkeyword{subtickcolor} set both for the $x$- and the $y$-Axis. +\begin{BDef} +\Lkeyword{dash}=value1\OptArg*{unit} value2\OptArg*{unit} \ldots +\end{BDef} -\begin{LTXexample}[preset=\centering,pos=t] -\begin{pspicture}(0,-0.75)(10,1) -\psaxes[yAxis=false,labelFontSize=\scriptstyle,ticksize=0 10mm,subticks=10,subticksize=0.75, - tickcolor=red,subtickcolor=blue,tickwidth=1pt,subtickwidth=0.5pt](10.01,0) +\begin{LTXexample}[width=0.4\linewidth] +\psset{linewidth=2.5pt,unit=0.6} +\begin{pspicture}(-5,-4)(5,4) + \psgrid[subgriddiv=0,griddots=10,gridlabels=0pt] + \psset{linestyle=dashed} + \pscurve[dash=5mm 1mm 1mm 1mm,linewidth=0.1](-5,4)(-4,3)(-3,4)(-2,3) + \psline[dash=5mm 1mm 1mm 1mm 1mm 1mm 1mm 1mm 1mm 1mm](-5,0.9)(5,0.9) + \psccurve[linestyle=solid](0,0)(1,0)(1,1)(0,1) + \psccurve[linestyle=dashed,dash=5mm 2mm 0.1 0.2,linetype=0](0,0)(-2.5,0)(-2.5,-2.5)(0,-2.5) + \pscurve[dash=3mm 3mm 1mm 1mm,linecolor=red,linewidth=2pt](5,-4)(5,2)(4.5,3.5)(3,4)(-5,4) \end{pspicture} \end{LTXexample} -\begin{LTXexample}[width=5cm] -\begin{pspicture}(5,-0.75)(10,1) -\psaxes[yAxis=false,labelFontSize=\scriptstyle,ticksize=0 -10mm,subticks=10,subticksize=0.75, - tickcolor=red,subtickcolor=blue,tickwidth=1pt,subtickwidth=0.5pt,Ox=5](5,0)(5,0)(10.01,0) -\end{pspicture} -\end{LTXexample} +\clearpage %-------------------------------------------------------------------------------------- -\subsection{\texttt{ticklinestyle} and \texttt{subticklinestyle}} +\section{Arrows} %-------------------------------------------------------------------------------------- -Syntax: -\begin{lstlisting}[style=syntax] -ticklinestyle=solid|dashed|dotted|none -xticklinestyle=solid|dashed|dotted|none -yticklinestyle=solid|dashed|dotted|none -subticklinestyle=solid|dashed|dotted|none -xsubticklinestyle=solid|dashed|dotted|none -ysubticklinestyle=solid|dashed|dotted|none -\end{lstlisting} +\subsection{Definition} +%-------------------------------------------------------------------------------------- +\LPack{pstricks-add} defines the following "`arrows"': -\Lkeyword{ticklinestyle} and \Lkeyword{subticklinestyle} set both values -for the x and y axis. The value \Lkeyval{none} doesn't really makes -sense, because it is the same as \verb+[sub]ticklines=0+ - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{unit=4cm} -\pspicture(-0.15,-0.15)(2.5,1) - \psaxes[axesstyle=frame,logLines=y,xticksize=0 1,xsubticksize=1,ylogBase=10, - tickcolor=red,subtickcolor=blue,tickwidth=1pt,subticks=20,xsubticks=10, - xticklinestyle=dashed,xsubticklinestyle=dashed](2.5,1) -\endpspicture -\end{LTXexample} +\begin{center} + \bgroup + \def\myline#1{\psline[linecolor=red,linewidth=0.5pt,arrowscale=1.5]{#1}(0,1ex)(1.3,1ex)}% + \psset{arrowscale=1.5} + \begin{tabular}{@{} c @{\qquad} p{3cm} l @{}}% + Value & Example & Name \\[2pt]\hline + \Lnotation{-} & \myline{-} & None\\ + \Lnotation{<->} & \myline{<->} & Arrowheads.\\ + \Lnotation{>-<} & \myline{>-<} & Reverse arrowheads.\\ + \Lnotation{<{<}-{>}>} & \myline{<<->>} & Double arrowheads.\\ + \Lnotation{{>}>-{<}<} & \myline{>>-<<} & Double reverse arrowheads.\\ + \Lnotation{{|}-{|}} & \myline{|-|} & T-bars, flush to endpoints.\\ + \Lnotation{{|}*-{|}*} & \myline{|*-|*} & T-bars, centered on endpoints.\\ + \Lnotation{[-]} & \myline{[-]} & Square brackets.\\ + \Lnotation{]-[} & \myline{]-[} & Reversed square brackets.\\ + \Lnotation{(-)} & \myline{(-)} & Rounded brackets.\\ + \Lnotation{)-(} & \myline{)-(} & Reversed rounded brackets.\\ + \Lnotation{o-o} & \myline{o-o} & Circles, centered on endpoints.\\ + \Lnotation{*-*} & \myline{*-*} & Disks, centered on endpoints.\\ + \Lnotation{oo-oo} & \myline{oo-oo} & Circles, flush to endpoints.\\ + \Lnotation{**-**} & \myline{**-**} & Disks, flush to endpoints.\\ + \Lnotation{{|}<->{|}} & \myline{|<->|} & T-bars and arrows.\\ + \Lnotation{{|}>-<{|}} & \myline{|>-<|} & T-bars and reverse arrows.\\ + \Lnotation{h-h{|}} & \myline{h-h} & left/right hook arrows.\\ + \Lnotation{H-H{|}} & \myline{H-H} & left/right hook arrows.\\ + \Lnotation{v-v|} & \myline{v-v} & left/right inside vee arrows.\\ + \Lnotation{V-V|} & \myline{V-V} & left/right outside vee arrows.\\ + \Lnotation{f-f|} & \myline{f-f} & left/right inside filled arrows.\\ + \Lnotation{F-F|} & \myline{F-F} & left/right outside filled arrows.\\ + \Lnotation{t-t|} & \myline{t-t} & left/right inside slash arrows.\\[5pt] + \Lnotation{T-T|} & \myline{T-T} & left/right outside slash arrows.\\ + \end{tabular} + \egroup +\end{center} -%-------------------------------------------------------------------------------------- -\subsection{\texttt{logLines}} -%-------------------------------------------------------------------------------------- -Syntax: +You can also mix and match, e.g., \Lnotation{->}, \Lnotation{*-)} and \Lnotation{[->} are all valid values +of the \Lkeyword{arrows} parameter. The parameter can be set with + \begin{BDef} -logLines=all|x|y +\Lcs{psset}\Largb{arrows=} \end{BDef} -By default the option \Lkeyword{logLines} sets the ticksize to the maximal length for x, y, or both. -It can be changed, when \emph{after} the option \Lkeyword{logLines} the ticksize is set. - -\begin{LTXexample}[pos=t] -\pspicture(-1,-1)(5,5) - \psaxes[subticks=5,xylogBase=10,logLines=all](5,5) -\endpspicture\hspace{1cm} -\pspicture(-1,-1)(5,5) - \psaxes[subticks=10,axesstyle=frame,xylogBase=10,logLines=all,ticksize=0 5pt,tickstyle=inner](5,5) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{unit=4cm} -\pspicture(-0.15,-0.15)(2.5,2) - \psaxes[axesstyle=frame,logLines=y,xticksize=max,xsubticksize=1,ylogBase=10, - tickcolor=red,subtickcolor=blue,tickwidth=1pt,subticks=20,xsubticks=10](2.5,2) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{unit=4} -\pspicture(-0.5,-0.3)(3,1.2) - \psaxes[axesstyle=frame,tickstyle=inner,logLines=x,xlogBase=10,Dy=0.5,tickcolor=red, - subtickcolor=blue,tickwidth=1pt,ysubticks=5,xsubticks=10](3,1) -\endpspicture -\end{LTXexample} - -%-------------------------------------------------------------------------------------- -\subsection{\texttt{xylogBase}, \texttt{xlogBase} and \texttt{ylogBase}} -%-------------------------------------------------------------------------------------- -There are additional options \Lkeyword{xylogBase}, \Lkeyword{xlogBase}, -\Lkeyword{ylogBase} to get one or both axes with \Index{logarithmic label}s. For an -interval of [$10^{-3} ... 10^2$] choose a \verb|pstricks| interval -of [-3,2]. \verb|pstricks| takes $0$ as the origin of this axes, -which is wrong if we want to have a logarithmic axes. With the -options \Lkeyword{Oy} and \Lkeyword{Ox} we can set the origin to $-3$, so -that the first label gets $10^{-3}$. If this is not done by the -user then \verb|pstricks-add| does it by default. An alternative -is to set these parameters to empty values \verb|Ox={},Oy={}|, in -this case \verb|pstricks-add| does nothing. - - -%------------------------------------------------------------------------------------ -\subsubsection{\texttt{xylogBase}} -%------------------------------------------------------------------------------------ -This mode in math is also called double logarithmic. It is a -combination of the two foregoing modes and the function is now -$y=\log x$ and is shown in the following example. +\noindent or for some macros with a special option, like\\[5pt] +\noindent\verb|\psline[]{}(A)(B)|\\ +\noindent\verb/\psline[linecolor=red,linewidth=2pt]{|->}(0,0)(0,2)/ \ \psline[linecolor=red,linewidth=2pt]{|->}(0,0)(0,2) -\medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-3.5,-3.5)(3.5,3.5) - \psplot[linewidth=2pt,linecolor=red]{0.001}{3}{x log} - \psaxes[xylogBase=10,Oy=-3,Ox=-3]{->}(-3,-3)(3.5,3.5) - \uput[-90](3.5,-3){x} - \uput[180](-3,3.5){y} - \rput(2.5,1){$y=\log x$} -\end{pspicture} -\end{LTXexample} +\subsection{Multiple arrows} +There are two new options which are only valid for the arrow type \verb+<<+ or \verb+>>+. +\verb+nArrow+ sets both, the \verb+nArrowA+ and the \verb+nArrowB+ parameter. The meaning +is declared in the following tables. Without setting one of these parameters the behaviour +is like the one described in the old PSTricks manual. +\begin{center} +\begin{tabular}{@{}lc@{}}% + Value & Meaning \\[2pt]\hline + \Lnotation{-{>}>} & \ -A \\ + \Lnotation{{<}<-{>}>} & A-A\\ + \Lnotation{{<}<-} & A-\ \\ + \Lnotation{{>}>-} & B-\ \\ + \Lnotation{-{<}<} & \ -B\\ + \Lnotation{{>}>-{<}<} & B-B\\ + \Lnotation{{>}>-{>}>} & B-A\\ + \Lnotation{{<}<-{<}<} & A-B + \end{tabular} +\end{center} -%-------------------------------------------------------------------------------------------- -\subsubsection{\texttt{ylogBase}} -%-------------------------------------------------------------------------------------------- -The values for the \Lcs{psaxes} y-coordinate are now the -exponents to the base $10$ and for the right function to the base -$e$: $10^{-3} \ldots 10^1$ which corresponds to the given -y-interval $-3\ldots 1.5$, where only integers as exponents are -possible. These logarithmic labels have no effect on the -internally used units. To draw the logarithm function we have to -use the math function -\[y=\log\{\log x\}\] -\[y=\ln\{\ln x\}\] -with an drawing interval of $1.001\ldots 6$. -\medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-0.5,-3.5)(6.5,1.5) - \psaxes[ylogBase=10,Oy=-3]{->}(0,-3)(6.5,1.5) - \uput[-90](6.5,-3){x} - \uput[0](0,1.4){y} - \rput(5,1){$y=\log x$} - \psplot[linewidth=2pt,% - plotpoints=100,linecolor=red]{1.001}{6}{x log log} % log(log(x)) -\end{pspicture} -\end{LTXexample} - -\medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-0.5,-3.5)(6.5,1.5) - \psplot[linewidth=2pt,plotpoints=100,linecolor=red]% - {1.04}{6}[ /ln {log 0.4343 div} def ]{x ln ln} % log(x) - \psaxes[ylogBase=e,Oy=-3]{->}(0,-3)(6.5,1.5) - \uput[-90](6.5,-3){x} - \uput[0](0,1.5){y} - \rput(5,1){$y=\ln x$} -\end{pspicture} -\end{LTXexample} +\begin{center} + \bgroup + \psset{linecolor=red,linewidth=1pt,arrowscale=2}% + \begin{tabular}{lp{2.8cm}}% + Value & Example \\[2pt]\hline + \verb+\psline{->>}(0,1ex)(2.3,1ex)+ & \psline{->>}(0,1ex)(2.3,1ex) \\ + \verb+\psline[nArrowsA=3]{->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{->>}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=5]{->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{->>}(0,1ex)(2.3,1ex)\\ + \verb+\psline{<<-}(0,1ex)(2.3,1ex)+ & \psline{<<-}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=3]{<<-}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{<<-}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=5]{<<-}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{<<-}(0,1ex)(2.3,1ex)\\ + \verb+\psline{<<->>}(0,1ex)(2.3,1ex)+ & \psline{<<->>}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=3]{<<->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{<<->>}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=5]{<<->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{<<->>}(0,1ex)(2.3,1ex)\\ + \verb+\psline{<<-|}(0,1ex)(2.3,1ex)+ & \psline{<<-|}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=3]{<<-<<}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3]{<<-<<}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=5]{<<-o}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=5]{<<-o}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=3,nArrowsB=4]{<<-<<}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3,nArrowsB=4]{<<-<<}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=3,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=3,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)\\ + \verb+\psline[nArrowsA=1,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)+ & \psline[nArrowsA=1,nArrowsB=4]{>>->>}(0,1ex)(2.3,1ex)\\ + \end{tabular} + \egroup +\end{center} -\medskip -\begin{LTXexample}[width=7cm] - \begin{pspicture}(-0.5,1.75)(6.5,4.5) - \psaxes[ylogBase=10,Oy=2]{->}(0,2)(0,2)(6.5,4.5) - \end{pspicture} -\end{LTXexample} +\subsection{\texttt{hookarrow}} +%\begin{LTXexample} +\bgroup +\psset{arrowsize=8pt,arrowlength=1,linewidth=1pt,nodesep=2pt,shortput=tablr} +\large +\begin{psmatrix}[colsep=12mm,rowsep=10mm] + & & $R_2$ \\ + & & 0 & & $R_3$\\ +$e_b:S$ & 1 & & 1 & 0 \\ + & & 0 \\ + & & $R_1$ \\ +\end{psmatrix} +\ncline{h-}{1,3}{2,3}<{$e_{r2}$}>{$f_{r2}$} +\ncline{-h}{2,3}{3,2}<{$e_1$} +\ncline{-h}{3,1}{3,2}^{$e_s$}_{$f_{s}$} +\ncline{-h}{3,2}{4,3}>{$e_3$}<{$f_3$} +\ncline{-h}{4,3}{3,4}>{$e_4$}<{$f_4$} +\ncline{-h}{3,4}{2,3}>{$e_2$}<{$f_2$} +\ncline{-h}{3,4}{3,5}^{$e_5$} +\ncline{-h}{3,5}{2,5}<{$e_{r3}$}>{$f_{r3}$} +\ncline{-h}{4,3}{5,3}<{$e_{r1}$}>{$f_{r1}$} +%\end{LTXexample} +\egroup +\begin{lstlisting} +\psset{arrowsize=8pt,arrowlength=1,linewidth=1pt,nodesep=2pt,shortput=tablr} +\large +\begin{psmatrix}[colsep=12mm,rowsep=10mm] + & & $R_2$ \\ + & & 0 & & $R_3$\\ +$e_b:S$ & 1 & & 1 & 0 \\ + & & 0 \\ + & & $R_1$ \\ +\end{psmatrix} +\ncline{h-}{1,3}{2,3}<{$e_{r2}$}>{$f_{r2}$}\ncline{-h}{2,3}{3,2}<{$e_1$} +\ncline{-h}{3,1}{3,2}^{$e_s$}_{$f_{s}$} \ncline{-h}{3,2}{4,3}>{$e_3$}<{$f_3$} +\ncline{-h}{4,3}{3,4}>{$e_4$}<{$f_4$} \ncline{-h}{3,4}{2,3}>{$e_2$}<{$f_2$} +\ncline{-h}{3,4}{3,5}^{$e_5$} +\ncline{-h}{3,5}{2,5}<{$e_{r3}$}>{$f_{r3}$} +\ncline{-h}{4,3}{5,3}<{$e_{r1}$}>{$f_{r1}$} +\end{lstlisting} -\medskip -\begin{LTXexample}[width=7cm] - \begin{pspicture}(-0.5,-0.25)(6.5,4.5) - \psplot{0}{6}{x x cos add log} % x + cox(x) - \psplot[linecolor=red]{0}{6}{x 3 exp x cos add log} % x^3 + cos(x) - \psplot[linecolor=cyan]{0}{6}{x 5 exp x cos add log} % x^5 + cos(x) - \psaxes[ylogBase=10]{->}(6.5,4.5) - \end{pspicture} -\end{LTXexample} +\subsection{\texttt{hookrightarrow} and \texttt{hookleftarrow}} +This is another type of arrow and is abbreviated with \Lnotation{H}. +The length and width of the hook is set by the new options +\Lkeyword{hooklength} and \Lkeyword{hookwidth}, which are by default set +to +% +\begin{BDef} +\Lcs{psset}\Largb{hooklength=3mm,hookwidth=1mm} +\end{BDef} +% +If the line begins with a right hook then the line ends with a left hook and vice versa: -\medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-0.5,-1.25)(6.5,4.5) - \psplot{0}{6}{x x cos add log} % x + cox(x) - \psplot[linecolor=red]{0}{6}{x 3 exp x cos add log} % x^3 + cos(x) - \psplot[linecolor=cyan]{0}{6}{x 5 exp x cos add log} % x^5 + cos(x) - \psaxes[ylogBase=10]{->}(0,-1)(0,-1)(6.5,4.5) +\begin{LTXexample}[width=3cm] +\begin{pspicture}(3,4) +\psline[linewidth=5pt,linecolor=blue,hooklength=5mm,hookwidth=-3mm]{H->}(0,3.5)(3,3.5) +\psline[linewidth=5pt,linecolor=red,hooklength=5mm,hookwidth=3mm]{H->}(0,2.5)(3,2.5) +\psline[linewidth=5pt,hooklength=5mm,hookwidth=3mm]{H-H}(0,1.5)(3,1.5) +\psline[linewidth=1pt]{H-H}(0,0.5)(3,0.5) \end{pspicture} \end{LTXexample} - -\medskip -\begin{LTXexample}[width=4cm] -\begin{pspicture}(2.5,1.75)(6.5,4.5) - \psplot[linecolor=cyan]{3}{6}{x 5 exp x cos add log} % x^5 + cos(x) - \psaxes[ylogBase=10,Ox=3,Oy=2]{->}(3,2)(3,2)(6.5,4.5) -\end{pspicture} +\begin{LTXexample}[width=7.25cm] +$\begin{psmatrix} +E&W_i(X)&&Y\\ +&&W_j(X) +\psset{arrows=->,nodesep=3pt,linewidth=2pt} +\everypsbox{\scriptstyle} +\ncline[linecolor=red,arrows=H->,% + hooklength=4mm,hookwidth=2mm]{1,1}{1,2} +\ncline{1,2}{1,4}^{\tilde{t}} +\ncline{1,2}{2,3}<{W_{ij}} +\ncline{2,3}{1,4}>{\tilde{s}} +\end{psmatrix}$ \end{LTXexample} - - - %-------------------------------------------------------------------------------------- -\subsubsection{\texttt{xlogBase}} +\subsection{\nxLkeyword{ArrowInside} Option} %-------------------------------------------------------------------------------------- -Now we have to use the easy math function $y=x$ because the x axis is still $\log x$. -\xLkeyword{xlogBase} - -\medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-3.5,-3.5)(3.5,3.5) - \psplot[linewidth=2pt,linecolor=red]{-3}{3}{x} % log(x) - \psplot[linewidth=2pt,linecolor=blue]{-1.3}{1.5}{x 0.4343 div} % ln(x) - \psaxes[xlogBase=10,Oy=-3,Ox=-3]{->}(-3,-3)(3.5,3.5) - \uput[-90](3.5,-3){x} - \uput[180](-3,3.5){y} - \rput(2.5,1){$y=\log x$} - \rput[lb](0,-1){$y=\ln x$} -\end{pspicture} -\end{LTXexample} - -\begin{center} -\psset{yunit=3cm,xunit=2cm} -\begin{pspicture}(-1.25,-1.25)(4.25,1.5) - \uput[-90](4.25,-1){x} - \uput[0](-1,1.25){y} - \rput(0,1){$y=\sin x$} - \psplot[linewidth=2pt,plotpoints=5000,linecolor=red]{-1}{3.5}{10 x exp sin } - \psaxes[xlogBase=10,Oy=-1,Ox=-1]{->}(-1,-1)(4.25,1.25) - \psline[linestyle=dashed](!0 1)(!90 log 1)(!90 log 0) -\end{pspicture} -\end{center} - -\begin{lstlisting} -\psset{yunit=3cm,xunit=2cm} -\begin{pspicture}(-1.25,-1.25)(4.25,1.5) - \uput[-90](4.25,-1){x} - \uput[0](-1,1.25){y} - \rput(0,1){$y=\sin x$} - \psplot[linewidth=2pt,plotpoints=5000,linecolor=red]{-1}{3.5}{10 x exp sin } - \psaxes[xlogBase=10,Ox=-1,Oy=-1]{->}(-1,-1)(4.25,1.25) - \psline[linestyle=dashed](-1,0)(4,0) - \psline[linestyle=dashed](!-1 1)(!90 log 1)(!90 log -1) - \psline[linestyle=dashed](!90 log 1)(!180 log 1)(!180 log -1) -\end{pspicture} -\end{lstlisting} - - -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-3.5,-2.5)(3.5,2.5) - \psaxes[xlogBase=10]{->}(0,0)(-3.5,-2.5)(3.5,2.5) - \psplot{-2.5}{2.5}{10 x exp log} -\end{pspicture} -\end{LTXexample} +It is now possible to have arrows inside lines and not only at the +beginning or the end. The new defined options +\psset{arrowscale=2,linecolor=red,unit=1cm,linewidth=1.5pt} +\begin{longtable}{l|>{\RaggedRight}p{8.5cm}|p{2.2cm}} +Name & Example & Output\\\hline +\endfirsthead +Name & Example & Output\\\hline +\endhead +\Lkeyword{ArrowInside} & + \texttt{\textbackslash psline[ArrowInside=->](0,0)(2,0)} & + \psline[ArrowInside=->](0,0.1)(2,0.1) \\ +\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsidePos=0.25](0,0)(2,0)} +& \psline[ArrowInside=->, ArrowInsidePos=0.25](0,0.1)(2,0.1) \\ +\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsidePos=10](0,0)(2,0)} +& \psline[ArrowInside=->, ArrowInsidePos=10](0,0.1)(2,0.1) \\ +\Lkeyword{ArrowInsideNo} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsideNo=2](0,0)(2,0)} +& \psline[ArrowInside=->, ArrowInsideNo=2](0,0.1)(2,0.1) \\ +\Lkeyword{ArrowInsideOffset} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsideNo=2,\%}\newline + \hspace*{20pt}\texttt{ArrowInsideOffset=0.1](0,0)(2,0)} +& \psline[ArrowInside=->, ArrowInsideNo=2,ArrowInsideOffset=0.1](0,0.1)(2,0.1) \\ +% +\Lkeyword{ArrowInside} & \texttt{\textbackslash psline[ArrowInside=->]\{->\}(0,0)(2,0)} & + \psline[ArrowInside=->]{->}(0,0)(2,0)\\ +\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsidePos=0.25]\{->\}(0,0)(2,0)} + & \psline[ArrowInside=->, ArrowInsidePos=0.25]{->}(0,0)(2,0) \\ +\Lkeyword{ArrowInsidePos} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsidePos=10]\{->\}(0,0)(2,0)} + & \psline[ArrowInside=->, ArrowInsidePos=10]{->}(0,0)(2,0) \\ +\Lkeyword{ArrowInsideNo} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsideNo=2]\{->\}(0,0)(2,0)} + & \psline[ArrowInside=->, ArrowInsideNo=2]{->}(0,0)(2,0) \\ +\Lkeyword{ArrowInsideOffset} & \texttt{\textbackslash psline[ArrowInside=->,\%} + \hspace*{20pt}\texttt{ArrowInsideNo=2,\%}\newline + \hspace*{20pt}\texttt{ArrowInsideOffset=0.1]\{->\}(0,0)(2,0)} + & \psline[ArrowInside=->, ArrowInsideNo=2,ArrowInsideOffset=0.1]{->}(0,0)(2,0) \\ +% +\Lkeyword{ArrowFill} & \texttt{\textbackslash psline[ArrowFill=false,\%} + \hspace*{20pt}\texttt{arrowinset=0]\{->\}(0,0)(2,0)} & + \psline[ArrowFill=false,arrowinset=0]{->}(0,0)(2,0)\\ +\Lkeyword{ArrowFill} & \texttt{\textbackslash psline[ArrowFill=false,\%} + \hspace*{20pt}\texttt{arrowinset=0]\{<<->>\}(0,0)(2,0)} & + \psline[ArrowFill=false,arrowinset=0]{<<->>}(0,0)(2,0)\\ +\Lkeyword{ArrowFill} & \texttt{\textbackslash psline[ArrowInside=->,\%}\newline + \hspace*{20pt}\texttt{arrowinset=0,\%}\newline + \hspace*{20pt}\texttt{ArrowFill=false,\%}\newline + \hspace*{20pt}\texttt{ArrowInsideNo=2,\%}\newline + \hspace*{20pt}\texttt{ArrowInsideOffset=0.1]\{->\}(0,0)(2,0)} + & \psline[ArrowInside=->, ArrowFill=false,ArrowInsideNo=2,ArrowInsideOffset=0.1]{->}(0,0)(2,0) \\ +\end{longtable} \medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-3.5,-2.5)(3.5,2.5) - \psaxes[xlogBase=10,Ox={},Oy={}]{->}(0,0)(-3.5,-2.5)(3.5,2.5) - \psplot{-2.5}{2.5}{10 x exp log} -\end{pspicture} -\end{LTXexample} - - -%------------------------------------------------------------------------------------ -\subsubsection{No logstyle (\texttt{xylogBase=\{\}})} -%------------------------------------------------------------------------------------ -This is only a demonstration that the default option \xLkeyword{xylogBase}=\{\} still works ... :-) +Without the default arrow definition there is only the one inside +the line, defined by the type and the position. The position is +relative to the length of the whole line. $0.25$ means at $25\%$ +of the line length. The peak of the arrow gets the coordinates +which are calculated by the macro. If you want arrows with an +absolute position difference, then choose a value greater than +\verb|1|, e.\,g. \verb|10| which places an arrow every 10~pt. The +default unit \verb|pt| cannot be changed. \medskip -\begin{LTXexample}[width=7cm] -\begin{pspicture}(-3.5,-0.5)(3.5,2.5) - \psplot[linewidth=2pt,linecolor=red,xylogBase={}]{0.5}{3}{x log} % log(x) - \psaxes{->}(0,0)(-3.5,0)(3.5,2.5) - \uput[-90](3.5,0){x} - \uput[180](0,2.5){y} - \rput(2.5,1){$y=\log x$} -\end{pspicture} -\end{LTXexample} - +\noindent +\begin{tabularx}{\linewidth}{@{\color{red}\vrule width 2pt}lX@{}} +& The \Lkeyword{ArrowInside} takes only arrow definitions like \Lnotation{->} into account. +Arrows from right to left (\Lnotation{<-}) are not possible and ignored. If you need +such arrows, change the order of the pairs of coordinates for the line or curve macro. +\end{tabularx} -\newpage -%-------------------------------------------------------------------------------------- -\subsection{\texttt{subticks}, \texttt{tickwidth} and \texttt{subtickwidth}} +%-------------------------------------------------------------------------------------- +\subsection{\nxLkeyword{ArrowFill} Option} %-------------------------------------------------------------------------------------- - -\begin{center} -{\psset{arrowscale=3,arrows=-D>,yAxis=false} - \psaxes[subticks=8](0,0)(-5,-1)(5,1)\\[1cm] - \psaxes[subticks=4,ticksize=-4pt 0,xlabelPos=top](0,0)(5,1)(-5,-1)\\ - \psaxes[subticks=4,ticksize=-10pt 0](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=10,ticksize=0 -10pt](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=4,ticksize=0 10pt,xlabelPos=bottom](0,0)(5,5)(-5,-5)\\[1cm] - \psaxes[subticks=4,ticksize=0 -10pt,xlabelPos=top](0,0)(5,5)(-5,-5)\\[0.25cm] - \psaxes[subticks=0](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=0,tickcolor=red,linecolor=blue,xlabelPos=top](0,0)(5,5)(-5,-5)\\ - \psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=0,tickcolor=red,xlabelPos=top](0,0)(5,5)(-5,-5)} -\end{center} -\begin{lstlisting}[xrightmargin=-1.75cm] -\psset{arrowscale=3,arrows=-D>,yAxis=false} - \psaxes[subticks=8](0,0)(-5,-1)(5,1)\\[1cm] - \psaxes[subticks=4,ticksize=-4pt 0,xlabelPos=top](0,0)(5,1)(-5,-1)\\ - \psaxes[subticks=4,ticksize=-10pt 0](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=10,ticksize=0 -10pt](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=4,ticksize=0 10pt,xlabelPos=bottom](0,0)(5,5)(-5,-5)\\[1cm] - \psaxes[subticks=4,ticksize=0 -10pt,xlabelPos=top](0,0)(5,5)(-5,-5)\\[0.25cm] - \psaxes[subticks=0](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=0,tickcolor=red,linecolor=blue,xlabelPos=top](0,0)(5,5)(-5,-5)\\ - \psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt](0,0)(-5,-5)(5,5)\\[1cm] - \psaxes[subticks=0,tickcolor=red,xlabelPos=top](0,0)(5,5)(-5,-5)} -\end{lstlisting} - -\clearpage -\vspace*{4cm} -\begin{center} -\psset{arrowscale=3,xAxis=false} -\psaxes[subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em} -\psaxes[subticks=4,ylabelPos=right,ylabelPos=left]{->}(0,0)(5,5)(-5,-5)\hspace{4em} -\psaxes[subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em} -\psaxes[subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[subticks=4,ticksize=0 4pt,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{3em} -\psaxes[subticks=4,ticksize=-4pt 0,linecolor=red,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} -\psaxes[subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[subticks=0,tickcolor=red,linecolor=blue,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} -\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[subticks=5,tickcolor=red,tickwidth=2pt,% - ticksize=10pt,subtickcolor=blue,subticksize=0.75,ylabelPos=right]{->}(0,0)(5,5)(-5,-5) -\end{center} - -\vspace*{5cm} -\begin{lstlisting}[xrightmargin=-1.75cm] -\psset{arrowscale=3,xAxis=false} -\psaxes[subticks=8]{->}(0,0)(-5,-5)(5,5)\hspace{2em} -\psaxes[subticks=4,ylabelPos=right,ylabelPos=left]{->}(0,0)(5,5)(-5,-5)\hspace{4em} -\psaxes[subticks=4,ticksize=0 4pt]{->}(0,0)(-5,-5)(5,5)\hspace{3em} -\psaxes[subticks=4,ticksize=-4pt 0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[subticks=4,ticksize=0 4pt,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{3em} -\psaxes[subticks=4,ticksize=-4pt 0,linecolor=red,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} -\psaxes[subticks=0]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[subticks=0,tickcolor=red,linecolor=blue,ylabelPos=right]{->}(0,0)(5,5)(-5,-5)\hspace{5em} -\psaxes[subticks=5,tickwidth=2pt,subtickwidth=1pt]{->}(0,0)(-5,-5)(5,5)\hspace{1em} -\psaxes[subticks=5,tickcolor=red,tickwidth=2pt,% - ticksize=10pt,subtickcolor=blue,subticksize=0.75,ylabelPos=right]{->}(0,0)(5,5)(-5,-5) -\end{lstlisting} - -\begin{LTXexample}[width=5.5cm] -\pspicture(5,5.5) -\psaxes[subticks=4,ticksize=6pt,subticksize=0.5,% - tickcolor=red,subtickcolor=blue]{->}(5.4,5) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=5.5cm] -\pspicture(5,5.5) - \psaxes[subticks=5,ticksize=0 6pt,subticksize=0.5]{->}(5.4,5) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=5.5cm] -\pspicture(5,5.5) - \psaxes[subticks=5,ticksize=-6pt 0,subticksize=0.5]{->}(5.4,5) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=6.5cm] -\pspicture(-3,-3)(3,3.5) - \psaxes[subticks=5,ticksize=0 6pt,subticksize=0.5]{->}(0,0)(3,3)(-3,-3) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=6.5cm] -\pspicture(0,0.5)(-3,-3) - \psaxes[subticks=5,ticksize=-6pt 0,subticksize=0.5,linecolor=red]{->}(-3,-3) -\endpspicture -\end{LTXexample} - - - -\begin{LTXexample}[width=5.5cm] -\psset{axesstyle=frame} -\pspicture(5,5.5) - \psaxes[subticks=4,tickcolor=red,subtickcolor=blue](5,5) -\endpspicture -\end{LTXexample} - -\vspace{1cm} -\begin{LTXexample}[width=5.5cm] -\pspicture(5,5.5) - \psaxes[subticks=5,subticksize=1,subtickcolor=lightgray](5,5) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=5.5cm] -\pspicture(5,5.5) - \psaxes[subticks=2,subticksize=1,subtickcolor=lightgray](5,5) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\pspicture(3,4.5) - \psaxes[subticks=5,ticksize=-7pt 0](3,4) -\endpspicture -\end{LTXexample} - - -\begin{LTXexample}[width=3.5cm] -\pspicture(0,1)(-3,-4) - \psaxes[subticks=5](-3,-4) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\pspicture(3,4.5) - \psaxes[axesstyle=axes,subticks=5](3,4) -\endpspicture -\end{LTXexample} - -\begin{LTXexample}[width=3.5cm] -\pspicture(0,1)(-3,-4) - \psaxes[axesstyle=axes,subticks=5,% - ticksize=0 10pt](-3,-4) -\endpspicture -\end{LTXexample} - -\clearpage - -%-------------------------------------------------------------------------------------- -\subsection[\texttt{algebraic}]{\texttt{algebraic}%\footnote{This part is adapted -% from the package \texttt{pst-eqdf}, written by Dominique Rodriguez.} -} -%-------------------------------------------------------------------------------------- -By default the function in \Lcs{psplot} has to be described in -Reversed Polish Notation. The option \Lkeyword{algebraic} allows you -to do this in the common algebraic notation. E.g.: - -\begin{tabular}{l|l} -RPN & algebraic\\\hline -\verb+x ln+ & \verb+ln(x)+\\ -\verb+x cos 2.71 x neg 10 div exp mul+ & \verb+cos(x)*2.71^(-x/10)+\\ -\verb+1 x div cos 4 mul+ & \verb+4*cos(1/x)+\\ -\verb+t cos t sin+ & \verb+cos(t)|sin(t)+ -\end{tabular} - -Setting the option \Lkeyword{algebraic} to \verb+true+, allow the user -to describe all expression to be written in the classical -algebraic notation (infix notation). The four arithmetic -operations are obviously defined \verb$+-*/$, and also the -exponential operator \verb$^$. The natural priorities are used : -$3+4\times 5^5=3+(4\times (5^5))$, and by default the computation -is done from left to right. The following functions are defined : - -\medskip -\begin{tabular}{ll} -\verb$sin$, \verb$cos$, \verb$tan$, \verb$acos$, \verb$asin$ & in radians\\ -\verb$log$, \verb$ln$\\ -\verb$ceiling$, \verb$floor$, \verb$truncate$, \verb$round$\\ -\verb$sqrt$ & square root\\ -\verb$abs$ & absolute value\\ -\verb$fact$ & for the factorial\\ -\verb$Sum$ & for building sums\\ -\verb$IfTE$ & for an easy case structure -\end{tabular} - -\medskip -These options can be used with \textbf{all} plot macros. - -{\bfseries Using the option \Lkeyword{algebraic} implies that all -angles have to be in radians! } - -For the \Lcs{parametricplot} the two parts must be divided by the \Lnotation{|} character: - -\begin{LTXexample}[width=2cm] -\begin{pspicture}(-0.5,-0.5)(0.5,0.5) -\parametricplot[algebraic,linecolor=red]{-3.14}{3.14}{cos(t)|sin(t)} -\end{pspicture} -\end{LTXexample} - -\resetOptions -\bigskip -%\begin{LTXexample}[pos=t] -\psset{lly=-0.5cm} -\psgraph[trigLabels,dx=\psPi,dy=0.5,Dy=0.5]{->}(0,0)(-10,-1)(10,1){\linewidth}{6cm} - \psset{algebraic,plotpoints=1000} - \psplot[linecolor=yellow,linewidth=2pt]{-10}{10}{0.75*sin(x)*cos(x/2)} - \psplot[linecolor=red,showpoints=true,plotpoints=101]{-10}{10}{0.75*sin(x)*cos(x/2)} -\endpsgraph -%\end{LTXexample} - -\bigskip -\begin{lstlisting} -\psset{lly=-0.5cm} -\psgraph[trigLabels,dx=\psPi,dy=0.5,Dy=0.5]{->}(0,0)(-10,-1)(10,1){\linewidth}{6cm} - \psset{algebraic,plotpoints=1000} - \psplot[linecolor=yellow,linewidth=2pt]{-10}{10}{0.75*sin(x)*cos(x/2)} - \psplot[linecolor=red,showpoints=true,plotpoints=101]{-10}{10}{0.75*sin(x)*cos(x/2)} -\endpsgraph -\end{lstlisting} - - -\bigskip -%\begin{LTXexample}[pos=t] -\bgroup -\psset{lly=-0.5cm} -\psgraph(0,-5)(18,3){15cm}{5cm} - \psset{algebraic,plotpoints=501} - \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)} - \psplot[linecolor=red]{0.01}{18}{ln(x)} - \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)} - \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)} -\endpsgraph -\egroup -%\end{LTXexample} - - -\bigskip -\begin{lstlisting} -\psset{lly=-0.5cm} -\psgraph(0,-5)(18,3){15cm}{5cm} - \psset{algebraic,plotpoints=501} - \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)} - \psplot[linecolor=red]{0.01}{18}{ln(x)} - \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)} - \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)} -\endpsgraph -\end{lstlisting} - - - -\clearpage -%-------------------------------------------------------------------------------------- -\subsubsection{Using the \texttt{Sum} function} -%-------------------------------------------------------------------------------------- - -\begin{BDef} -\Lcs{Sum}\Largr{,,,,} -\end{BDef} - -Let's plot the first development of cosine with polynomials: -$\displaystyle\sum_{n=0}^{+\infty}\frac{(-1)^nx^{2n}}{n!}$. - -\begin{center} -\bgroup -\psset{algebraic, plotpoints=501, yunit=3} -\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psclip{\psframe(-7,-1.5)(7,1.5)} - \psplot{-7}{7}{cos(x)} - \multido{\n=1+1}{10}{% - \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{% - Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}} - \endpsclip - \psaxes(0,0)(-7,-1.5)(7,1.5) -\end{pspicture} -\egroup -\end{center} -\begin{lstlisting} -\psset{algebraic, plotpoints=501, yunit=3} -\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi} -\begin{pspicture}(-7,-1.5)(7,1.5) - \psclip{\psframe(-7,-1.5)(7,1.5)} - \psplot{-7}{7}{cos(x)} - \multido{\n=1+1}{10}{% - \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{% - Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}} - \endpsclip - \psaxes(0,0)(-7,-1.5)(7,1.5) -\end{pspicture} -\end{lstlisting} - -\clearpage -%-------------------------------------------------------------------------------------- -\subsubsection{Using the \texttt{IfTE} function} -%-------------------------------------------------------------------------------------- -\begin{BDef} -\Lps{IfTE}\Largr{,,} -\end{BDef} - -Nesting of several \Lps{IfTE} is possible and seen in the -following examples. A classic example is a piece-wise linear -function. - -\begin{center} -\begin{pspicture}(-7.5,-2.5)(7.5,6) - \psaxes{->}(0,0)(-7,-2)(7.5,6)[x,-90][y,0] - \psset{algebraic=true, plotpoints=21,linewidth=2pt} - \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))} - \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{% - IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}% -\end{pspicture} -\end{center} - - -\begin{lstlisting} -\begin{pspicture}(-7.5,-2.5)(7.5,6) - \psaxes{->}(0,0)(-7,-2)(7.5,6)[x,-90][y,0] - \psset{algebraic=true, plotpoints=21,linewidth=2pt} - \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))} - \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{% - IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}% -\end{pspicture} -\end{lstlisting} - -When you program a piece-wise defined function you must take care -that a plotting point must be put at each point where the -description changes. Use \Lkeyword{showpoints}=true to see what's -going on when there is a problem. You are on the safe side when -you choose a big number for \Lkeyword{plotpoints}. - -\clearpage - - -\begin{center} -\psset{unit=0.75} -\begin{pspicture}(-8,-8)(8,8) - \psaxes{->}(0,0)(-8,-8)(8,8)[x,-90][y,0] - \psset{plotpoints=1000,linewidth=1pt} - \psplot[algebraic]{-8}{8}{ceiling(x)} - \psplot[algebraic, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x} - \psplot[algebraic, linecolor=red]{-8}{8}{floor(x)} - \psplot[algebraic, linecolor=blue]{-8}{8}{round(x)} - \psplot[algebraic, linecolor=green]{-8}{8}{truncate(x)} - \psplot[algebraic, linecolor=cyan]{-8}{8}{div(mul(4,x),7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)} - \psplot[algebraic, linecolor=magenta]{-8}{8}{floor(8*cos(x))} -\end{pspicture} -\end{center} - -\begin{lstlisting} -\psset{unit=0.75} -\begin{pspicture}(-8,-8)(8,8) - \psaxes{->}(0,0)(-8,-8)(8,8)[x,-90][y,0] - \psset{plotpoints=1000,linewidth=1pt} - \psplot[algebraic, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x} - \psplot[algebraic]{-8}{8}{ceiling(x)} - \psplot[algebraic, linecolor=red]{-8}{8}{floor(x)} - \psplot[algebraic, linecolor=blue]{-8}{8}{round(x)} - \psplot[algebraic, linecolor=green]{-8}{8}{truncate(x)} - \psplot[algebraic, linecolor=cyan]{-8}{8}{div(mul(4,x),7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)} - \psplot[algebraic, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)} - \psplot[algebraic, linecolor=magenta]{-8}{8}{floor(8*cos(x))} -\end{pspicture} -\end{lstlisting} - - -%-------------------------------------------------------------------------------------- -\subsection{Plot style \texttt{bar} and option \texttt{barwidth}} -%-------------------------------------------------------------------------------------- -This option allows you to draw bars for the data records. The -width of the bars is controlled by the option \Lkeyword{barwidth}, -which is set by default to value of \verb+0.25cm+, which is the -total width. - -\def\barData{ -0 0.03 -1 0.11 -2 0.28 -3 0.84 -4 6.70 -5 8.55 -6 8.77 -7 11.09 -8 7.18 -9 6.20 -10 5.78 -11 4.19 -12 2.37 -13 2.26 -14 1.68 -15 1.03 -16 1.37 -17 1.34 -18 0.92 -19 0.67 -20 0.87 -21 1.20 -22 1.98 -23 3.99 -24 5.08 -25 5.17 -26 5.78 -27 4.44 -28 0.11 -} - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{xunit=.44cm,yunit=.3cm} -\begin{pspicture}(-2,-3)(29,13) - \psaxes[axesstyle=axes,Ox=1466,Oy=0,Dx=4,Dy=2,xticksize=-6pt 0, - ylabelFactor={\,\%}]{-}(29,12) - \listplot[shadow=true,linecolor=blue,plotstyle=bar,barwidth=0.3cm, - fillcolor=red,fillstyle=solid]{\barData} - \rput{90}(-3,6.25){Amount} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{xunit=.44cm,yunit=.3cm} -\begin{pspicture}(-2,-3)(29,13) - \psaxes[axesstyle=axes,Ox=1466,Oy=0,Dx=4,Dy=2,ticksize=-4pt 0, - ylabelFactor={\,\%}]{-}(29,12) - \listplot[linecolor=blue,plotstyle=bar,barwidth=0.3cm, - fillcolor=red,fillstyle=crosshatch]{\barData} - \rput{90}(-3,6.25){Amount} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[preset=\centering,pos=t] -\psset{xunit=.44cm,yunit=.3cm} -\begin{pspicture}(-2,-3)(29,13) - \psaxes[axesstyle=axes,Ox=1466,Oy=0,Dx=4,Dy=2,ticksize=-4pt 0, - ylabelFactor={\,\%}]{-}(29,12) - \listplot[linecolor=blue,plotstyle=bar,barwidth=0.3cm, - fillcolor=red,fillstyle=vlines]{\barData} - \listplot[showpoints=true]{\barData} - \rput{90}(-3,6.25){Amount} -\end{pspicture} -\end{LTXexample} - - - -%------------------------------------------------------------------------------------ -\subsection{New options \nxLkeyword{yMaxValue}} -%------------------------------------------------------------------------------------ -With the new optional argument \Lkeyword{yMaxValue} one can control the behaviour -of discontinued functions, like the tangent function. If \Lkeyword{yMaxValue} is set -to a negative value, then the internal if clause is disabled, the function is plotted -in the usual way as known from \LPack{pst-plot}. - - -\psset{unit=1cm} - -\begin{LTXexample}[preset=\centering,pos=t] -\begin{pspicture}(-6.5,-7)(6.5,7.5) -\multido{\rA=-4.71239+\psPiH}{7}{% - \psline[linecolor=black!20,linestyle=dashed](\rA,-6.5)(\rA,6.5)} -\psaxes[trigLabelBase=2,dx=\psPiH, - xunit=\psPi,trigLabels]{->}(0,0)(-1.7,-6.5)(1.77,6.5)[$x$,0][$y$,-90] -\psset{algebraic,plotpoints=200,plotstyle=line} -\psclip{\psframe[linestyle=none](-4.55,-6.5)(5.55,6.5)} - \psplot[yMaxValue=10,linewidth=1.6pt,linecolor=red]{-4.55}{4.55}{(x)/(sin(2*x))} -\endpsclip -\psplot[linestyle=dashed,linecolor=blue!30]{-4.8}{4.8}{x} -\psplot[linestyle=dashed,linecolor=blue!30]{-4.8}{4.8}{-x} -\rput(0,0.5){$\times$} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[preset=\centering,pos=t] -\begin{pspicture}(-6.5,-7)(6.5,7.5) -\psaxes[trigLabelBase=2,dx=\psPiH, - xunit=\psPi,trigLabels]{->}(0,0)(-1.7,-6.5)(1.77,6.5)[$x$,0][$y$,90] -\psset{algebraic} -\psplot[yMaxValue=6,linewidth=1.6pt,plotpoints=2000, - linecolor=red]{-4.55}{4.55}{tan(x)} -\end{pspicture} -\end{LTXexample} - -\psset{unit=1cm} - - -\clearpage - -%------------------------------------------------------------------------------------ -\subsection{New options for \nxLcs{readdata}} -%------------------------------------------------------------------------------------ - - -By default the macro \verb|\readdata| reads every data record, -which could be annoying when you have some text lines at top of -your data files or when there are more than 10000 records to read. - - -\verb|pstricks-add| defines two additional keys \Lkeyword{ignoreLines} -and \Lkeyword{nStep}, which allows you to ignore preceding lines, e.g. -\Lkeyword{ignoreLines}=2, or to read only a selected part of the data -records, e.g. \verb|nStep=10|, only every 10\textsuperscript{th} -record is saved. - -\begin{lstlisting} -\readdata[ignoreLines=2]{\dataA}{stressrawdata.data} -\readdata[nStep=10]{\dataA}{stressrawdata.data} -\end{lstlisting} - -The default value for \Lkeyword{ignoreLines} is $0$ and for \Lkeyword{nStep} is $1$. -the following data file has two text lines which shall be ignored by the \Lcs{readdata} macro: - -\begin{LTXexample}[width=4cm] -\begin{filecontents*}{pstricks-add-data9.data} -some nonsense in this line ---time forcex forcey -0 0.2 -1 1 -2 4 -\end{filecontents*} -\readdata[ignoreLines=2]{\data}{pstricks-add-data9.data} -\pspicture(2,4) - \listplot[showpoints=true]{\data} - \psaxes{->}(2,4) -\endpspicture -\end{LTXexample} - - -%-------------------------------------------------------------------------------------- -\subsection{New options for \texttt{\textbackslash listplot}} -%-------------------------------------------------------------------------------------- -By default the plot macros \Lcs{dataplot}, \Lcs{fileplot} and \Lcs{listplot} plot every -data record. The package \verb|pst-plot-add| defines additional keys -\Lkeyword{nStep}, \Lkeyword{nStart}, \Lkeyword{nEnd}, and \Lkeyword{xStep}, \Lkeyword{xStart}, -\Lkeyword{xEnd}, which allows -to plot only a selected part of the data records, e.g. \verb|nStep=10|. These "`n"' -options mark the number of the record to be plot ($0,1,2,...$) and the "`x"' ones the x-values of the data records. - - -\begin{center} -\begin{tabular}{l|l} -Name & Default setting\\\hline -\Lkeyword{nStart} & \verb|1|\\ -\Lkeyword{nEnd} & \verb|{}|\\ -\Lkeyword{nStep} & \verb|1|\\ -\Lkeyword{xStart} & \verb|{}|\\ -\Lkeyword{xEnd} & \verb|{}|\\ -\Lkeyword{yStart} & \verb|{}|\\ -\Lkeyword{yEnd} & \verb|{}|\\ -\Lkeyword{xStep} & \verb|0|\\ -\Lkeyword{plotNo} & \verb|1|\\ -\Lkeyword{plotNoMax} & \verb|1|\\ -\Lkeyword{ChangeOrder} & \false\\ -(\Lkeyword{plotstyle})& \Lkeyval{line} -\end{tabular} -\end{center} - -These new options are only available -for the \Lcs{listplot} macro, which is not a real limitation, because all data records can be read -from a file with the \Lcs{readdata} macro (see example files or \cite{dtk02.2:jackson.voss:plot-funktionen}): -\begin{lstlisting}[style=syntax] -\readdata[nStep=10]{\data}{/home/voss/data/data1.data} -\end{lstlisting} - -The use \Lkeyword{nStep} and \Lkeyword{xStep} options only make real sense -when also using the option \Lkeyset{plotstyle=dots}. Otherwise the -coordinates are connected by a line as usual. Also the -\Lkeyword{xStep} option needs increasing x values. Note that -\Lkeyword{nStep} can be used for \Lcs{readdata} and for -\Lcs{listplot}. If used in both macros then the effect is -multiplied, e.g. \Lcs{readdata} with \Lkeyword{nStep}=5 and -\Lcs{listplot} with \Lkeyword{nStep}=10 means, that only every -50\textsuperscript{th} data record is read and plotted. - -When both, \verb|x/yStart/End| are defined then the values are also compared with -both values. - -\clearpage - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{nStep/xStep}} -%-------------------------------------------------------------------------------------- - -The datafile \verb|data.data| contains $1000$ data records. The thin blue line is the plot -of all records with the plotstyle option \Lkeyval{curve}. - -\resetOptions -\begin{LTXexample}[preset=\centering,pos=t] -\readdata{\data}{data.data} -\psset{xunit=12.5cm,yunit=0.2mm} -\begin{pspicture}(-0.080,-30)(1,270) -\pstScalePoints(1,1){1000 div}{1000 div} -\psaxes[Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner, - subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) -\listplot[nStep=50,linewidth=3pt,linecolor=red,plotstyle=dots]{\data} -\listplot[linewidth=1pt,linecolor=blue]{\data} -\end{pspicture} -\end{LTXexample} - - -\clearpage - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{nStart/xStart}} -%-------------------------------------------------------------------------------------- - -\begin{LTXexample}[preset=\centering,pos=t] -\readdata{\data}{data.data} -\psset{xunit=12.5cm,yunit=0.2mm} -\begin{pspicture}(-0.080,-30)(1,270) -\pstScalePoints(1,1){1000 div}{1000 div} -\psaxes[Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner, - subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) -\listplot[nStart=200,linewidth=3pt, - linecolor=blue,plotstyle=dots]{\data} -\listplot[linewidth=1pt,linecolor=blue]{\data} -\end{pspicture} -\end{LTXexample} - -\clearpage - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{nEnd/xEnd}} -%-------------------------------------------------------------------------------------- - -\begin{LTXexample}[preset=\centering,pos=t] -\readdata{\data}{data.data} -\psset{xunit=12.5cm,yunit=0.2mm} -\begin{pspicture}(-0.080,-30)(1,270) -\pstScalePoints(1,1){1000 div}{1000 div} -\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner, - subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) -\listplot[nStart=200,linewidth=3pt, - linecolor=blue]{\data} -\listplot[linewidth=1pt,linecolor=blue]{\data} -\end{pspicture} -\end{LTXexample} - - -\clearpage - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for all new options} -%-------------------------------------------------------------------------------------- - -\begin{LTXexample}[preset=\centering,pos=t] -\readdata{\data}{data.data} -\psset{xunit=12.5cm,yunit=0.2mm} -\begin{pspicture}(-0.080,-30)(1,270) -\pstScalePoints(1,1){1000 div}{1000 div} -\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100,,ticksize=0 5pt,tickstyle=inner, - ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) -\listplot[nStart=200, nEnd=800, nStep=50, - linewidth=3pt,linecolor=blue,plotstyle=dots]{\data} -\end{pspicture} -\end{LTXexample} - -\clearpage - - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{xStart}} -%-------------------------------------------------------------------------------------- - -This example shows the use of the same plot with different units -and different \Lkeyword{xStart} value. The blue curve is the original -plot of the data records. To show the important part of the curve -there is another one plotted with a greater \Lkeyword{yunit} and a -start value of \Lkeyword{xStart}=0.35. This makes it possible to have -a kind of zoom to the original graphic. - -\begin{center} -\psset{xunit=10cm, yunit=0.01cm} -\readdata{\data}{data3.data} -\begin{pspicture}(-0.1,-100)(1.5,700.0) - \psaxes[Dx=0.25,Dy=100,dy=100\psyunit,ticksize=-4pt 0,% - labelFontSize={\scriptstyle}]{->}(0,0)(0,-100)(1.4,520) - \uput[0](1.4,0){\textsf{t [s]}} - \rput(-0.125,200){\psrotateleft{\small flow [ml/s]}} - \listplot[linewidth=2pt, linecolor=blue]{\data} - \rput(0.4,300){ - \pscustom[yunit=0.04cm, linewidth=1pt]{% - \listplot[xStart=0.355]{\data} - \psline(1,-2.57)(1,0)(0.355,0) - \fill[fillstyle=hlines,fillcolor=gray,hatchwidth=0.4pt,hatchsep=1.5pt,hatchcolor=red]% - \psline[linewidth=0.5pt]{->}(0.7,0)(1.05,0) - }% - } - \psline[linewidth=.01]{->}(0.75,300)(0.4,20) - \psline[linewidth=.01]{->}(1,290)(1.1,440) - \rput(1.1,470){\footnotesize leak volume} - \psline[linewidth=.01]{->}(0.78,200)(1,100) - \rput[l](1.02,100){\footnotesize closing volume} -\end{pspicture} -\end{center} - - -\begin{lstlisting} -\psset{xunit=10cm, yunit=0.01cm} -\readdata{\data}{data3.data} -\begin{pspicture}(-0.1,-100)(1.5,700.0) - \psaxes[Dx=0.25,Dy=100,dy=100\psyunit,ticksize=-4pt 0,% - labelFontSize={\scriptstyle}]{->}(0,0)(0,-100)(1.4,520) - \uput[0](1.4,0){\textsf{t [s]}} - \rput(-0.125,200){\psrotateleft{\small flow [ml/s]}} - \listplot[linewidth=2pt, linecolor=blue]{\data} - \rput(0.4,300){ - \pscustom[yunit=0.04cm, linewidth=1pt]{% - \listplot[xStart=0.355]{\data} - \psline(1,-2.57)(1,0)(0.355,0) - \fill[fillstyle=hlines,fillcolor=gray,hatchwidth=0.4pt,hatchsep=1.5pt,hatchcolor=red]% - \psline[linewidth=0.5pt]{->}(0.7,0)(1.05,0) - }% - } - \psline[linewidth=.01]{->}(0.75,300)(0.4,20) - \psline[linewidth=.01]{->}(1,290)(1.1,440) - \rput(1.1,470){\footnotesize leak volume} - \psline[linewidth=.01]{->}(0.78,200)(1,100) - \rput[l](1.02,100){\footnotesize closing volume} -\end{pspicture} -\end{lstlisting} - - - -\resetOptions -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{yStart}/\texttt{yEnd}} -%-------------------------------------------------------------------------------------- - -\begin{LTXexample}[preset=\centering,pos=t] -\readdata{\data}{data.data} -\psset{xunit=12.5cm,yunit=0.2mm} -\begin{pspicture}(-0.080,-30)(1,270) -\pstScalePoints(1,1){1000 div}{1000 div} -\psaxes[axesstyle=frame,Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner, - ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250) - \psset{linewidth=0.1pt, linestyle=dashed,linecolor=red} - \psline(0,40)(1,40) - \psline(0,175)(1,175) - \listplot[yStart=40000, yEnd=175000,linewidth=3pt,linecolor=blue,plotstyle=dots]{\data} -\end{pspicture} -\end{LTXexample} - - - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{plotNo/plotNoMax}} -%-------------------------------------------------------------------------------------- -By default the plot macros expect \verb+x|y+ data records, but -when having data files with multiple values for y, like: -\begin{lstlisting}[style=syntax] -x y1 y2 y3 y4 ... yMax -x y1 y2 y3 y4 ... yMax -... -\end{lstlisting} - -you can select the y value which should be plotted. The option \Lkeyword{plotNo} marks the plotted -value (default $1$) and the option \Lkeyword{plotNoMax} tells \LPack{pst-plot} how many $y$ values are -present. There are no real restrictions in the maximum number for \Lkeyword{plotNoMax}. - -We have the following data file: -\begin{lstlisting}[style=syntax] -[% file data.data -0 0 3.375 0.0625 -10 5.375 7.1875 4.5 -20 7.1875 8.375 6.25 -30 5.75 7.75 6.6875 -40 2.1875 5.75 5.9375 -50 -1.9375 2.1875 4.3125 -60 -5.125 -1.8125 0.875 -70 -6.4375 -5.3125 -2.6875 -80 -4.875 -7.1875 -4.875 -90 0 -7.625 -5.625 -100 5.5 -6.3125 -5.8125 -110 6.8125 -2.75 -4.75 -120 5.25 2.875 -0.75 -]% -\end{lstlisting} - -\noindent which holds data records for multiple plots (\verb+x y1 y2 y3+). This can be plotted -without any modification to the data file: - -\begin{LTXexample}[preset=\centering,pos=t] -\readdata\Data{dataMul.data} -\psset{xunit=0.1cm, yunit=0.5cm,lly=-0.5cm} -\begin{pspicture}(0,-7.5)(150,10) -\psaxes[Dx=10,Dy=2.5]{->}(0,0)(0,-7.5)(150,7.5)[$\mathbf{x}$,-90][$\mathbf{y}$,0] -\psset{linewidth=2pt,plotstyle=curve} -\listplot[linecolor=green,plotNo=1,plotNoMax=3]{\Data} -\listplot[linecolor=red,plotNo=2,plotNoMax=3]{\Data} -\listplot[linecolor=blue,plotNo=3,plotNoMax=3]{\Data} -\end{pspicture} -\end{LTXexample} - -\clearpage - - -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{changeOrder}} -%-------------------------------------------------------------------------------------- -It is only possible to fill the region between two listplots with -\Lcs{pscustom} if one of them has the values in reverse order. -Otherwise we do not get a closed path. With the option -\Lkeyword{ChangeOrder} the values are used in reverse order: - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{filecontents*}{test.data} - 0 3 8 - 2 4 7 - 5 5 5.5 - 7 3.5 5 - 10 2 9 -\end{filecontents*} -\psset{lly=-.5cm} -\begin{psgraph}[axesstyle=frame,ticklinestyle=dotted,ticksize=0 10](0,0)(10,10){4in}{2in}% - \readdata{\data}{test.data}% - \pscustom[fillstyle=solid,fillcolor=blue!40]{% - \listplot[plotNo=2,plotNoMax=2]{\data}% - \listplot[plotNo=1,plotNoMax=2,ChangeOrder]{\data}} -\end{psgraph} -\end{LTXexample} - - -\clearpage -%-------------------------------------------------------------------------------------- -\subsubsection{Example for \texttt{plotstyle}} -%-------------------------------------------------------------------------------------- -The \Lkeyword{plotstyle} option is defined in the package \LPack{pst-plot}, but its value -\Lkeyval{LSM} (\textbf{L}east \textbf{S}quare \textbf{Method}) is only valid for the -\LPack{pstricks-add} package. Instead of plotting the data records as dots or a line, -the \Lcs{listplot} macro calculates the values for a line $y=v\cdot x+u$ which fits -best all data records. - -\bgroup -\centering -\begin{filecontents*}{LSM.data} -0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7 -\end{filecontents*} -\psset{lly=-.5cm} -\readdata{\data}{LSM.data} -\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!} - \listplot[plotstyle=dots]{\data} - \listplot[plotstyle=LSM,linecolor=red]{\data} -\end{psgraph} -\egroup - - -\begin{lstlisting} -\begin{filecontents*}{LSM.data} -0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7 -\end{filecontents*} -\psset{lly=-.5cm} -\readdata{\data}{LSM.data} -\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!} - \listplot[plotstyle=dots]{\data} - \listplot[§\ON§plotstyle§\OFF§=§\ON§LSM§\OFF§,linecolor=red]{\data} -\end{psgraph} -\end{lstlisting} - - -The macro looks for the lowest and biggest x-value and draws the -line for this interval. It is possible to pass other values to the -macro by setting the \Lkeyword{xStart} and/or \Lkeyword{xEnd} options. -They are preset with an empty value \verb+{}+. - -\bgroup -\centering -\begin{filecontents*}{LSM.data} -0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7 -\end{filecontents*} -\readdata{\data}{LSM.data} -\psset{lly=-1.75cm} -\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!} - \listplot[plotstyle=dots]{\data} - \listplot[PstDebug=1,plotstyle=LSM,xStart=-0.5,xEnd=8.5,linecolor=red]{\data} -\end{psgraph} -\egroup - -\begin{lstlisting} -\begin{filecontents*}{LSM.data} -0 1 1 3 2.8 4 3 2.9 2 5 4 4 5 5.5 6 8.2 8 7 -\end{filecontents*} -\readdata{\data}{LSM.data} -\psset{lly=-1.75cm} -\begin{psgraph}[arrows=->](0,0)(0,0)(8,8){.5\textwidth}{!} - \listplot[plotstyle=dots]{\data} - \listplot[§\ON§PstDebug§\OFF§=1,plotstyle=§\ON§LSM§\OFF§,§\ON§xStart§\OFF§=-0.5,§\ON§xEnd§\OFF§=8.5,linecolor=red]{\data} -\end{psgraph} -\end{lstlisting} - - -With \Lkeyword{PstDebug}=1 one gets the equation $y=v\cdot x+u$ -printed, beginning at the position (0|-50pt). This cannot be -changed, because it is only for some kind of debugging. Pay -attention for the correct \Lkeyword{xStart} and \Lkeyword{xEnd} values, -when you use the \Lcs{pstScalePoints} Macro. In the following -example we use an x-interval from 0 to 3 to plot the values; first -we subtract 0.003 from all x-values and then scale them with -10000. This is not taken into account for the \Lkeyword{xStart} and -\Lkeyword{xEnd} values. - - -\bgroup -\centering -\begin{filecontents*}{LSM.data} -0.003298697 1.397785583 -0.003193358 1.615489564 -0.003094538 2.044019006 -0.003001651 2.259240127 -\end{filecontents*} -\readdata{\data}{LSM.data} -\pstScalePoints(10000,1){ 0.003 sub }{} -\psset{lly=-1.75cm} -\psgraph[arrows=->,Ox=0.0030,Dx=0.0001,dx=\psxunit](0,0)(3.2,3){10cm}{5cm} - \listplot[showpoints=true,linewidth=1pt,linecolor=blue]{\data} - \listplot[PstDebug=1,plotstyle=LSM,linewidth=0.1pt,linestyle=dashed,% - xStart=-0.25,xEnd=3.3]{\data} -\endpsgraph -\egroup - -\begin{lstlisting} -\begin{filecontents*}{LSM.data} -0.003298697 1.397785583 -0.003193358 1.615489564 -0.003094538 2.044019006 -0.003001651 2.259240127 -\end{filecontents*} -\readdata{\data}{LSM.data} -§\ON§\pstScalePoints§\OFF§(10000,1){ 0.003 sub }{} -\psset{lly=-1.75cm} -\psgraph[arrows=->,Ox=0.0030,Dx=0.0001,dx=\psxunit](0,0)(3.2,3){10cm}{5cm} - \listplot[showpoints=true,linewidth=1pt,linecolor=blue]{\data} - \listplot[PstDebug=1,plotstyle=§\ON§LSM§\OFF§,linewidth=0.1pt,linestyle=dashed,% - xStart=-0.25,xEnd=3.3]{\data} -\endpsgraph -\end{lstlisting} - - -\clearpage -%-------------------------------------------------------------------------------------- -\section{Polar plots} -%-------------------------------------------------------------------------------------- - -With the option \Lkeyword{polarplot}=\false|\true\ it is possible to use \Lcs{psplot} -in polar mode: -\begin{BDef} -\Lcs{psplot}\OptArg{polarplot=true,...}\Largb{}\Largb{}\%\\ - \OptArg{PS command}\Largb{} -\end{BDef} - -The equation in PostScript code is interpreted as a function $r=f(\alpha)$, e.g. for the -circle with radius 1 as $r=\sqrt{\sin^2x+\cos^2x}$, or $r=a*\dfrac{sin(x)*cos(x)}{(sin(x)^3+cos(x)^3)}$ -for the following examples: - -\begin{lstlisting}[style=syntax] -x sin dup mul x cos dup mul add sqrt -\end{lstlisting} - - -\medskip -\resetOptions -\begin{LTXexample}[pos=t] -\psset{plotpoints=200,unit=0.75} -\begin{pspicture*}(-5,-5)(5.1,5.1) - \psaxes[arrowlength=1.75,ticksize=2pt,labelFontSize=\scriptstyle, - linewidth=0.2mm]{->}(0,0)(-4.99,-4.99)(5,5)[x,-90][y,180] - \rput[Br](-.15,-.35){$0$} \psset{linewidth=.35mm,polarplot} - \psplot[linecolor=red]{140}{310}{3 neg x sin mul x cos mul x sin 3 exp x cos 3 exp add div} - \psplot[linecolor=cyan]{140}{310}{6 x sin mul x cos mul x sin 3 exp x cos 3 exp add div} - \psplot[linecolor=blue,algebraic]{2.44}{5.41}{-8*sin(x)*cos(x)/(sin(x)^3+cos(x)^3)} -\end{pspicture*} -\end{LTXexample} - - - -\medskip -\resetOptions -\begin{LTXexample}[pos=t] -\psset{unit=0.5cm} -\begin{pspicture}(-6,-6)(6,6) -\psaxes[axesstyle=polar,labelFontSize=\scriptstyle,linewidth=0.2mm]{->}(6,6) -\psset{linewidth=3pt,polarplot,plotpoints=500,plotstyle=curve} -\psclip{\pscircle[linestyle=none]{6}} - \psplot[linecolor=red]{140}{310}{3 neg x sin mul x cos mul x sin 3 exp x cos 3 exp add div} - \psplot[linecolor=cyan]{140}{310}{6 x sin mul x cos mul x sin 3 exp x cos 3 exp add div} - \psplot[linecolor=blue,algebraic]{2.44}{5.41}{-8*sin(x)*cos(x)/(sin(x)^3+cos(x)^3)} -\endpsclip -\end{pspicture} -\end{LTXexample} - - -\medskip -\resetOptions -\begin{LTXexample}[width=5cm] -\psset{plotpoints=200,unit=1} -\begin{pspicture}(-2.5,-2.5)(2.5,2.5)% Ulrich Dirr - \psaxes[arrowlength=1.75,% - ticksize=2pt,linewidth=0.17mm]{->}% - (0,0)(-2.5,-2.5)(2.5,2.5)[$x$,-90][$y$,180] - \rput[Br](-.15,-.35){$0$} - \psset{linewidth=.35mm,plotstyle=curve,polarplot=true} - \psplot[linecolor=red]{0}{360}{x cos 2 mul x sin mul} - \psplot[linecolor=green]{0}{360}{x cos 3 mul x sin mul} - \psplot[linecolor=blue]{0}{360}{x cos 4 mul x sin mul} -\end{pspicture} -\end{LTXexample} - - - -\medskip -\begin{LTXexample}[width=8cm] -\psset{plotpoints=200,unit=0.5} -\begin{pspicture}(-8.5,-8.5)(9,9)% Ulrich Dirr -\psaxes[Dx=2,dx=2,Dy=2,dy=2,arrowlength=1.75, - ticksize=2pt,linewidth=0.17mm]{->}(0,0)(-8.5,-8.5)(9,9) -\rput[Br](9,-.7){$x$} -\rput[tr](-.3,9){$y$} -\rput[Br](-.3,-.7){$0$} -% -\psset{linewidth=.35mm,plotstyle=curve,polarplot=true} -\psplot[linecolor=blue]{0}{720}{8 2.5 x mul sin mul} -\end{pspicture} -\end{LTXexample} - - -\resetOptions - -\clearpage -%-------------------------------------------------------------------------------------- -\section{\nxLcs{pstScalePoints}} -%-------------------------------------------------------------------------------------- -The syntax is -\begin{BDef} -\Lcs{pstScalePoints}\Largr{xScale,xScale}\Largb{xPS}\Largb{yPS} -\end{BDef} - -\verb+xScale,yScale+ are decimal values used as scaling factors, -the \verb+xPs+ and \verb+yPS+ are additional PostScript code -applied to the x- and y-values of the data records. This macro is -only valid for the \Lcs{listplot} macro! - -\resetOptions -\begin{LTXexample}[width=6cm] -\def\data{% - 0 0 1 3 2 4 3 1 - 4 2 5 3 6 6 } -\begin{pspicture}(-0.5,-1)(6,6) - \psaxes{->}(0,0)(6,6) - \listplot[showpoints=true,% - linecolor=red]{\data} - \pstScalePoints(1,0.5){}{3 add} - \listplot[showpoints=true,% - linecolor=blue]{\data} -\end{pspicture} -\end{LTXexample} - -\bigskip -\Lcs{pstScalePoints}\Largr{1,0.5}\Largb{}\Largb{3 add} means that \textbf{first} the value $3$ is added -to the $y$ values and \textbf{second} this value is scaled with the factor $0.5$. -As seen for the blue line for $x=0$ we get $y(0)=(0+3)\cdot 0.5=1.5$. - -Changes with \Lcs{pstScalePoints} are always global to all following \Lcs{listplot} -macros. This is the reason why it is a good idea to reset the values at the end of the -\Lenv{pspicture} environment. - - -\clearpage -%-------------------------------------------------------------------------------------- -\part{New commands and environments} -%-------------------------------------------------------------------------------------- - -%-------------------------------------------------------------------------------------- -\section[\texttt{psCancel} environment]{\texttt{psCancel} environment\footnotemark} -%-------------------------------------------------------------------------------------- -\footnotetext{Thanks to by Stefano Baroni} This macro works like -the \Lcs{cancel} macro from the package of the same name but it -allows as argument any contents, not only letters but also a -complex graphic. - -\begin{BDef} -\LcsStar{psCancel}\OptArgs\Largb{contents}% -\end{BDef} - -All optional arguments for lines and boxes are valid and can be -used in the usual way. The star option fills the underlying box -rectangle with the linecolor. This can be transparent if -\Lkeyword{opacity} is set to a value less than 1. This can be used -in presentation to strike out words, equations, and graphic -objects. Lines can also be transparent when the option -\Lkeyword{strokeopacity} is used. - -\begingroup -\psCancel{A} \psCancel[linecolor=red]{Tikz :-)} \quad -\psCancel[linecolor=blue,doubleline=true]{% - \readdata{\data}{demo1.data} - \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-13mm,lly=-7mm, - xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} - \pstScalePoints(1,0.00000001){}{} - \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, - ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} - \end{psgraph}} \qquad% end of Cancel -\psCancel[linewidth=3pt,linecolor=red, - strokeopacity=0.5]{\tabular[b]{c}first line\\second line\endtabular}\quad -\psCancel*[linecolor=red!50,opacity=0.5]{\tabular[b]{c}first line\\second line\endtabular} -\quad -\psCancel*[linecolor=blue!30,opacity=0.5]{% - \readdata{\data}{demo1.data} - \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-15mm,lly=-7mm,urx=1mm, - xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} - \pstScalePoints(1,0.00000001){}{} - \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, - ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} - \end{psgraph}} \quad% end of Cancel -\psCancel[linewidth=4pt,strokeopacity=0.5]{\parbox{8cm}{\[ - \binom{x_R}{y_R} = \underbrace{r\vphantom{\binom{A}{B}}}_{\text{Scaling}}\cdot - \underbrace{\begin{pmatrix} - \sin\gamma & -\cos\gamma \\ - \cos \gamma & \sin \gamma \\ - \end{pmatrix}}_{\text{Rotation}} \binom{x_K}{y_K} + - \underbrace{\binom{t_x}{t_y}}_{\text{Translation}} \]} }% end of psCancel -\endgroup - -\bigskip -\begin{lstlisting} -\psCancel{A} \psCancel[linecolor=red]{Tikz :-)} \quad -\psCancel[linecolor=blue,doubleline=true]{% - \readdata{\data}{demo1.data} - \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-13mm,lly=-7mm, - xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} - \pstScalePoints(1,0.00000001){}{} - \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, - ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} - \end{psgraph}} \qquad% end of Cancel -\psCancel[linewidth=3pt,linecolor=red, - strokeopacity=0.5]{\tabular[b]{c}first line\\second line\endtabular}\quad -\psCancel*[linecolor=red!50,opacity=0.5]{\tabular[b]{c}first line\\second line\endtabular} -\quad -\psCancel*[linecolor=blue!30,opacity=0.5]{% - \readdata{\data}{demo1.data} - \psset{shift=*,xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-15mm,lly=-7mm,urx=1mm, - xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} - \pstScalePoints(1,0.00000001){}{} - \begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, - ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} - \end{psgraph}} \quad% end of Cancel -\psCancel[linewidth=4pt,strokeopacity=0.5]{\parbox{8cm}{\[ - \binom{x_R}{y_R} = \underbrace{r\vphantom{\binom{A}{B}}}_{\text{Scaling}}\cdot - \underbrace{\begin{pmatrix} - \sin\gamma & -\cos\gamma \\ - \cos \gamma & \sin \gamma \\ - \end{pmatrix}}_{\text{Rotation}} \binom{x_K}{y_K} + - \underbrace{\binom{t_x}{t_y}}_{\text{Translation}} \]} }% end of psCancel -\end{lstlisting} - - -\clearpage -%-------------------------------------------------------------------------------------- -\section{\texttt{psgraph} environment} -%-------------------------------------------------------------------------------------- -This new environment \Lenv{psgraph} does the scaling, it expects as parameter the values (without units!) for the -coordinate system and the values of the physical width and height (with units!). The syntax is: - -\begin{BDef} -\Lcs{psgraph}\OptArgs\Largb{}\%\\ -\qquad\Largr{xOrig,yOrig}\Largr{xMin,yMin}\Largr{xMax,yMax}\Largb{xLength}\Largb{yLength}\\ -\ldots\\ -\Lcs{endpsgraph}\\[10pt] -\LBEG{psgraph}\OptArgs\Largb{}\%\\ -\qquad\Largr{xOrig,yOrig}\Largr{xMin,yMin}\Largr{xMax,yMax}\Largb{xLength}\Largb{yLength}\\ -\ldots\\ -\LEND{psgraph} -\end{BDef} - -where the options are valid \textbf{only} for the the \verb+\psaxes+ macro. The first -two arguments have the usual \verb+PSTricks+ behaviour. -\begin{itemize} - \item if \verb+(xOrig,yOrig)+ is missing, it is substituted to \verb+(xMin,xMax)+; - \item if \verb+(xOrig,yOrig)+ \textbf{and} \verb+(xMin,yMin)+ are missing, they are both - substituted to \verb+(0,0)+. -\end{itemize} - -The y-length maybe given as !, when the macro uses the same unit -as for the x-axis. - -%----------------------------------------------------------------------------- - -\begin{center} -\readdata{\data}{demo1.data} -\pstScalePoints(1,0.000001){}{}% (x,y){additional x operator}{y op} -\psset{llx=-1cm,lly=-1cm} -\begin{psgraph}[axesstyle=frame,xticksize=0 759,yticksize=0 25,% - subticks=0,ylabelFactor=\cdot 10^6, - Dx=5,dy=100\psyunit,Dy=100](0,0)(25,750){10cm}{6cm} % parameters - \listplot[linecolor=red,linewidth=2pt,showpoints=true]{\data} -\end{psgraph} -\end{center} - -\resetOptions -\begin{lstlisting} -\readdata{\data}{demo1.data} -\pstScalePoints(1,0.000001){}{}% (x,y){additional x operator}{y op} -\psset{llx=-1cm,lly=-1cm} -§\ON§\begin{psgraph}§\OFF§[axesstyle=frame,xticksize=0 759,yticksize=0 25,% - subticks=0,ylabelFactor=\cdot 10^6, - Dx=5,dy=100\psyunit,Dy=100](0,0)(25,750){10cm}{6cm} % parameters - \listplot[linecolor=red,linewidth=2pt,showpoints=true]{\data} -§\ON§\end{psgraph}§\OFF§ -\end{lstlisting} - -%----------------------------------------------------------------------------- - -In the following example, the y unit gets the same value as the one for the x-axis. -\begin{center} -\psset{llx=-1cm,lly=-0.5cm,ury=0.5cm} -\begin{psgraph}(0,0)(5,3){6cm}{!} % x-y-axis with same unit - \psplot[linecolor=red,linewidth=1pt]{0}{5}{x dup mul 10 div} -\end{psgraph} -\end{center} - -\begin{lstlisting} -\psset{llx=-1cm,lly=-0.5cm,ury=0.5cm} -\begin{psgraph}(0,0)(5,3){6cm}§\ON§{!}§\OFF§ % x-y-axis with same unit - \psplot[linecolor=red,linewidth=1pt]{0}{5}{x dup mul 10 div} -\end{psgraph} -\end{lstlisting} - -%----------------------------------------------------------------------------- - -\begin{center} -\readdata{\data}{demo1.data} -\psset{xAxisLabel=x-Axis,yAxisLabel=y-Axis,llx=-.5cm,lly=-1cm,lly=-1cm,ury=0.5cm, - xAxisLabelPos={c,-1},yAxisLabelPos={-7,c}} -\pstScalePoints(1,0.00000001){}{} -\begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, - ylabelFactor=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} -\end{psgraph} -\end{center} -\resetOptions - -\begin{lstlisting} -\readdata{\data}{demo1.data} -\psset{§\ON§xAxisLabel§\OFF§=x-Axis,§\ON§yAxisLabel§\OFF§=y-Axis,llx=-.5cm,lly=-1cm,ury=0.5cm, - §\ON§xAxisLabelPos§\OFF§={c,-1},§\ON§yAxisLabelPos§\OFF§={-7,c}} -\pstScalePoints(1,0.00000001){}{} -\begin{psgraph}[axesstyle=frame,xticksize=0 7.5,yticksize=0 25,subticksize=1, - §\ON§ylabelFactor§\OFF§=\cdot 10^8,Dx=5,Dy=1,xsubticks=2](0,0)(25,7.5){5.5cm}{5cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} -\end{psgraph} -\end{lstlisting} - -%----------------------------------------------------------------------------- - -\begin{LTXexample}[pos=t,preset=\centering] -\readdata{\data}{demo1.data} -\psset{llx=-0.5cm,lly=-1cm} -\pstScalePoints(1,0.000001){}{} -\psgraph[arrows=->,Dx=5,dy=200\psyunit,Dy=200,subticks=5,ticksize=-10pt 0, - tickwidth=0.5pt,subtickwidth=0.1pt](0,0)(25,750){5.5cm}{5cm} -\listplot[linecolor=red,linewidth=2pt,showpoints=true,plotstyle=LineToYAxis]{\data} -\endpsgraph -\end{LTXexample} - -%----------------------------------------------------------------------------- - -\resetOptions -\begin{center} -\readdata{\data}{demo1.data} -\pstScalePoints(1,0.2){}{log} -\psset{lly=-0.75cm} -\psgraph[ylogBase=10,Dx=5,Dy=1,subticks=5](0,0)(25,2){12cm}{4cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} -\endpsgraph -\end{center} - - - - -\begin{lstlisting} -\readdata{\data}{demo1.data} -\pstScalePoints(1,0.2){}{log} -\psset{lly=-0.75cm} -\psgraph[§\ON§ylogBase§\OFF§=10,Dx=5,Dy=1,subticks=5](0,0)(25,2){12cm}{4cm} - \listplot[linecolor=red, linewidth=2pt, showpoints=true]{\data} -\endpsgraph -\end{lstlisting} - -%----------------------------------------------------------------------------- - -\resetOptions -\begin{LTXexample}[pos=t,preset=\centering] -\readdata{\data}{demo0.data} -\psset{lly=-0.75cm,ury=0.5cm} -\pstScalePoints(1,1){}{log} -\begin{psgraph}[arrows=->,Dx=0.5,ylogBase=10,Oy=-1,xsubticks=10,% - ysubticks=2](0,-3)(3,1){12cm}{4cm} - \psset{Oy=-2}% must be global - \listplot[linecolor=red,linewidth=2pt,showpoints=true, - plotstyle=LineToXAxis]{\data} -\end{psgraph} -\end{LTXexample} - - -\resetOptions -\begin{LTXexample}[pos=t,preset=\centering] -\psset{lly=-0.75cm,ury=0.5cm} -\readdata{\data}{demo0.data} -\pstScalePoints(1,1){}{log} -\psgraph[arrows=->,Dx=0.5,ylogBase=10,Oy=-1,subticks=4](0,-3)(3,1){6cm}{3cm} - \listplot[linecolor=red,linewidth=2pt,showpoints=true,plotstyle=LineToXAxis]{\data} -\endpsgraph -\end{LTXexample} - - - -%----------------------------------------------------------------------------- -\resetOptions -\begin{center} -\readdata{\data}{demo2.data}% -\readdata{\dataII}{demo3.data}% -\pstScalePoints(1,1){1989 sub}{} -\psset{llx=-0.5cm,lly=-1cm, xAxisLabel=Year,yAxisLabel=Whatever,% - xAxisLabelPos={c,-0.4in},yAxisLabelPos={-0.4in,c}} -\psgraph[axesstyle=frame,Dx=2,Ox=1989,subticks=2](0,0)(12,6){4in}{2in}% - \listplot[linecolor=red,linewidth=2pt]{\data} - \listplot[linecolor=blue,linewidth=2pt]{\dataII} - \listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII} -\endpsgraph -\end{center} - -\begin{lstlisting} -\readdata{\data}{demo2.data}% -\readdata{\dataII}{demo3.data}% -\pstScalePoints(1,1){1989 sub}{} -\psset{llx=-0.5cm,lly=-1cm, §\ON§xAxisLabel§\OFF§=Year,§\ON§yAxisLabel§\OFF§=Whatever,% - §\ON§xAxisLabelPos§\OFF§={c,-0.4in},§\ON§yAxisLabelPos§\OFF§={-0.4in,c}} -\psgraph[axesstyle=frame,Dx=2,Ox=1989,subticks=2](0,0)(12,6){4in}{2in}% - \listplot[linecolor=red,linewidth=2pt]{\data} - \listplot[linecolor=blue,linewidth=2pt]{\dataII} - \listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII} -\endpsgraph -\end{lstlisting} -%----------------------------------------------------------------------------- - -\resetOptions -%\begin{LTXexample}[pos=t,preset=\centering] -\begin{center} -\readdata{\data}{demo2.data}% -\readdata{\dataII}{demo3.data}% -\psset{llx=-0.5cm,lly=-0.75cm,plotstyle=LineToXAxis} -\pstScalePoints(1,1){1989 sub}{2 sub} -\begin{psgraph}[axesstyle=frame,Dx=2,Ox=1989,Oy=2,subticks=2](0,0)(12,4){6in}{3in} - \listplot[linecolor=red,linewidth=12pt]{\data} - \listplot[linecolor=blue,linewidth=12pt]{\dataII} - \listplot[linecolor=cyan,linewidth=12pt,yunit=0.5]{\dataII} -\end{psgraph} -\end{center} -%\end{LTXexample} - -\begin{lstlisting} -\readdata{\data}{demo2.data}% -\readdata{\dataII}{demo3.data}% -\psset{llx=-0.5cm,lly=-0.75cm,plotstyle=LineToXAxis} -\pstScalePoints(1,1){1989 sub}{2 sub} -\begin{psgraph}[axesstyle=frame,Dx=2,Ox=1989,Oy=2,subticks=2](0,0)(12,4){6in}{3in} - \listplot[linecolor=red,linewidth=12pt]{\data} - \listplot[linecolor=blue,linewidth=12pt]{\dataII} - \listplot[linecolor=cyan,linewidth=12pt,yunit=0.5]{\dataII} -\end{psgraph} -\end{lstlisting} - -%\newpage -An example with ticks on every side of the frame and filled areas: - -\resetOptions -\begin{center} -\def\data{0 0 1 4 1.5 1.75 2.25 4 2.75 7 3 9} -\psset{lly=-0.5cm} -\begin{psgraph}[axesstyle=none,ticks=none](0,0)(3.0,9.0){12cm}{5cm} - \pscustom[fillstyle=solid,fillcolor=red!40,linestyle=none]{% - \listplot{\data} - \psline(3,9)(3,0)} - \pscustom[fillstyle=solid,fillcolor=blue!40,linestyle=none]{% - \listplot{\data} - \psline(3,9)(0,9)} - \listplot[linewidth=2pt]{\data} - \psaxes[axesstyle=frame,ticksize=0 5pt,xsubticks=20,ysubticks=4, - tickstyle=inner,dy=2,Dy=2,tickwidth=1.5pt,subtickcolor=black](0,0)(3,9) - \rput*(2.5,3){level 1}\rput*(1,7){level 2} -\end{psgraph} -\end{center} - -\begin{lstlisting} -\def\data{0 0 1 4 1.5 1.75 2.25 4 2.75 7 3 9} -\psset{lly=-0.5cm} -\begin{psgraph}[axesstyle=none,ticks=none](0,0)(3.0,9.0){12cm}{5cm} - \pscustom[fillstyle=solid,fillcolor=red!40,linestyle=none]{% - \listplot{\data} - \psline(3,9)(3,0)} - \pscustom[fillstyle=solid,fillcolor=blue!40,linestyle=none]{% - \listplot{\data} - \psline(3,9)(0,9)} - \listplot[linewidth=2pt]{\data} - \psaxes[axesstyle=frame,ticksize=0 5pt,xsubticks=20,ysubticks=4, - tickstyle=inner,dy=2,Dy=2,tickwidth=1.5pt,subtickcolor=black](0,0)(3,9) - \rput*(2.5,3){level 1}\rput*(1,7){level 2} -\end{psgraph} -\end{lstlisting} - - -%------------------------------------------------------------------------------------------- -\subsection{The new options} -%------------------------------------------------------------------------------------------- - -\begin{center} -\begin{tabular}{@{} l>{\tt}ll @{}} -\textrm{name} & \textrm{default} & meaning\\\hline -\Lkeyword{xAxisLabel} & x & label for the x-axis\\ -\Lkeyword{yAxisLabel} & y & label for the y-axis\\ -\Lkeyword{xAxisLabelPos} & \{\} & where to put the x-label\\ -\Lkeyword{yAxisLabelPos} & \{\} & where to put the y-label\\ -\Lkeyword{llx} & 0pt & trim for the lower left x\\ -\Lkeyword{lly} & 0pt & trim for the lower left y\\ -\Lkeyword{urx} & 0pt & trim for the upper right x\\ -\Lkeyword{ury} & 0pt & trim for the upper right y -\end{tabular} -\end{center} - -There is one restriction in using the trim parameters, they must -been set \textbf{before} \Lcs{psgraph} is called. They are -redundant when used as parameters of \Lcs{psgraph} itself. The -\verb+?AxisLabelPos+ options can use the letter \Lnotation{c} for -centering an x-axis or y-axis label. The \Lnotation{c} is a replacement for -the x or y value. When using values with units, the position is -always measured from the origin of the coordinate system, which -can be outside the visible \Lenv{pspicture} environment - -\medskip -\resetOptions -\begin{center} -\readdata{\data}{demo2.data}% -\readdata{\dataII}{demo3.data}% -\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,% - yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},% - yAxisLabelPos={-0.4in,c}} -\pstScalePoints(1,1){1989 sub}{} -\psframebox[linestyle=dashed,boxsep=0pt]{% -\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}% - \listplot[linecolor=red,linewidth=2pt]{\data}% - \listplot[linecolor=blue,linewidth=2pt]{\dataII}% - \listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}% -\end{psgraph}% -} -\end{center} - - -\begin{lstlisting} -\readdata{\data}{demo2.data}% -\readdata{\dataII}{demo3.data}% -\psset{llx=-1cm,lly=-1.25cm,urx=0.5cm,ury=0.1in,xAxisLabel=Year,% - yAxisLabel=Whatever,xAxisLabelPos={c,-0.4in},% - yAxisLabelPos={-0.4in,c}} -\pstScalePoints(1,1){1989 sub}{} -\psframebox[linestyle=dashed,boxsep=0pt]{% -\begin{psgraph}[axesstyle=frame,Ox=1989,subticks=2](0,0)(12,6){0.8\linewidth}{2.5in}% - \listplot[linecolor=red,linewidth=2pt]{\data}% - \listplot[linecolor=blue,linewidth=2pt]{\dataII}% - \listplot[linecolor=cyan,linewidth=2pt,yunit=0.5]{\dataII}% -\end{psgraph}% -} -\end{lstlisting} - - -\pstScalePoints(1,1){}{}% reset - - -%-------------------------------------------------------------------------------------- -\subsection{Problems} -%-------------------------------------------------------------------------------------- -Floating point operations in \TeX\ are a real mess, which causes a -lot of problems when there are very small or very big units. With -the options of \LPack{pst-plot} it is possible to choose normal -units (whatever this may be ...), and plot the data as usual. - -\begin{LTXexample}[pos=t] -\begin{filecontents*}{test.data} -3.2345 34.5 -3.2364 65.4 -3.2438 50.2 -\end{filecontents*} - -\psset{lly=-0.5cm,llx=-1cm} -\readdata{\data}{test.data} -\pstScalePoints(1,1){3.23 sub 100 mul}{} -\begin{psgraph}[Ox=3.23,Dx=0.01,dx=\psxunit,Dy=10](0,0)(3,70){0.8\linewidth}{5cm}% - \listplot[showpoints=true,plotstyle=curve]{\data} -\end{psgraph} -\end{LTXexample} - -This example shows some important facts: -\begin{itemize} -\item \verb+3.23 sub 100 mul+: the x values are now $0.45; 0.64; 1.38$ -\item \verb+Ox=3.23+: the origin of the x axis is set to $3.23$ -\item \verb+Dx=0.01+: the increment of the labels -\item \verb+dx=\psxunit+: uses the calculated unit value to get every unit a label -\item \verb+Dy=10+: increase the y labels by 10 -\end{itemize} - -Using the internal \Lcs{psxunit} one can have dynamical x-units, -depending on the linewidth of the document. - -\resetOptions - -\clearpage -%-------------------------------------------------------------------------------------- -\section{\nxLcs{psStep}} -%-------------------------------------------------------------------------------------- -\Lcs{psStep} calculates a step function for the upper or lower -sum or the max/min of the \Index{Riemann} integral definition of a given -function. The available option is - -\Lkeyset{StepType=lower}|\Lkeyval{upper}|\Lkeyval{Riemann}|\Lkeyval{infimum}|\Lkeyval{supremum} or alternative -\Lkeyset{StepType=l}|\Lkeyval{u}|\Lkeyval{R}|\Lkeyval{i}|\Lkeyval{s} - -with \Lkeyword{lower} as the default setting. The syntax of the function is - -\begin{BDef} -\Lcs{psStep}\OptArgs\Largr(x1,x2)\Largb{n}\Largb{function} -\end{BDef} - - -(x1,x2) is the given interval for the step wise calculated -function, n is the number of the rectangles and \Larg{function} is -the mathematical function in postfix or algebraic notation (with -\Lkeyset{algebraic=true}). - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(-0.5,-0.5)(10,3) - \psaxes[labelFontSize=\scriptstyle]{->}(10,3) - \psplot[plotpoints=100,linewidth=1.5pt,algebraic]{0}{10}{sqrt(x)} - \psStep[linecolor=magenta,StepType=upper,fillstyle=hlines](0,9){9}{x sqrt} - \psStep[linecolor=blue,fillstyle=vlines](0,9){9}{x sqrt } -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\psset{plotpoints=200} -\begin{pspicture}(-0.5,-2.25)(10,3) - \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-2.25)(10,3) - \psplot[linewidth=1.5pt,algebraic]{0}{10}{sqrt(x)*sin(x)} - \psStep[algebraic,linecolor=magenta,StepType=upper](0,9){20}{sqrt(x)*sin(x)} - \psStep[linecolor=blue,linestyle=dashed](0,9){20}{x sqrt x RadtoDeg sin mul} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\psset{yunit=1.25cm,plotpoints=200} -\begin{pspicture}(-0.5,-1.5)(10,1.5) - \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-1.5)(10,1.5) - \psStep[algebraic,StepType=Riemann,fillstyle=solid,fillcolor=black!10](0,10){50}% - {sqrt(x)*cos(x)*sin(x)} - \psplot[linewidth=1.5pt,algebraic]{0}{10}{sqrt(x)*cos(x)*sin(x)} -\end{pspicture} -\end{LTXexample} - - -\begin{LTXexample}[pos=t,preset=\centering] -\psset{yunit=1.25cm,plotpoints=200} -\begin{pspicture}(-0.5,-1.5)(10,1.5) - \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-1.5)(10,1.5) - \psStep[algebraic,StepType=infimum,fillstyle=solid,fillcolor=black!10](0,10){50}% - {sqrt(x)*cos(x)*sin(x)} - \psplot[linewidth=1.5pt,algebraic]{0}{10}{sqrt(x)*cos(x)*sin(x)} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\psset{yunit=1.25cm,plotpoints=200} -\begin{pspicture}(-0.5,-1.5)(10,1.5) - \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-1.5)(10,1.5) - \psStep[algebraic,StepType=supremum,fillstyle=solid,fillcolor=black!10](0,10){50}% - {sqrt(x)*cos(x)*sin(x)} - \psplot[linewidth=1.5pt,algebraic]{0}{10}{sqrt(x)*cos(x)*sin(x)} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\psset{unit=1.5cm,plotpoints=200} -\begin{pspicture}[plotpoints=200](-0.5,-3)(10,2.5) - \psStep[algebraic,fillstyle=solid,fillcolor=yellow](0.001,9.5){40}{2*sqrt(x)*cos(ln(x))*sin(x)} - \psStep[algebraic,StepType=Riemann,fillstyle=solid,fillcolor=blue](0.001,9.5){40}{2*sqrt(x)*cos(ln(x))*sin(x)} - \psaxes[labelFontSize=\scriptstyle]{->}(0,0)(0,-2.75)(10,2.5) - \psplot[algebraic,linecolor=white]{0.001}{9.75}{2*sqrt(x)*cos(ln(x))*sin(x)} - \uput[90](6,1.2){$f(x)=2\cdot\sqrt{x}\cdot\cos{(\ln{x})}\cdot\sin{x}$} -\end{pspicture} -\end{LTXexample} - -\clearpage -%-------------------------------------------------------------------------------------- - -\section{Plotting tangent lines} -There are two macros for plotting a tangent line or the tangent normal line. -The first one is \Lcs{psTangentLine} which expects three pairs of coordinates, -a $x$ and a $dx$ value. The second one is \Lcs{psplotTangent} which expects -a function for the curve. - -\subsection{\nxLcs{psTangentLine} and option \nxLkeyword{Tnormal}} - -\begin{BDef} -\Lcs{psTangentLine}\OptArgs\Largr{\coord1}\Largr{\coord2}\Largr{\coord3}\Largb{x}\Largb{dx} -\end{BDef} - -\begin{LTXexample}[width=0.45\linewidth,wide] -\psset{unit=2} -\begin{pspicture}[showgrid=true](1,-1)(4,1) - \pscurve[showpoints=true] - (2.1,-0.2)(2.5,0.2)(3.2,0.235)(3.8,-0.2) - \psTangentLine[Tnormal,arrows=->, - linecolor=red](2.5,0.2)(3.2,0.235)% - (3.8,-0.2){3}{0.1} - \psTangentLine[arrows=<->, - linecolor=blue](2.5,0.2)(3.2,0.235)% - (3.8,-0.2){3}{0.5} -\end{pspicture} -\end{LTXexample} - -In special cases one has to use \Lkeyword{curvature}\verb+=1 1 1+ for the macro \Lcs{pscurve} -to get the same equation for the curve as \Lcs{psplotTangentLine} does. - -\begin{LTXexample}[pos=t,preset=\centering,wide] -\psset{unit=2} -\begin{pspicture}[showgrid=true](2,-1)(6,2) -\pscurve[showpoints=true, - curvature=1 1 1](2.1,-0.2)(2.5,0.2)(3.2,0.235)(5.8,2) -\pscurve[showpoints=true,linecolor=green, - curvature=1 1 1](2.5,0.2)(3.2,0.235)(5.8,2) -\psTangentLine[Tnormal,arrows=->,linecolor=red](2.5,0.2)(3.2,0.235)(5.8,2){4.6}{0.6} -\psTangentLine[arrows=<->,linecolor=blue](2.5,0.2)(3.2,0.235)(5.8,2){4.5}{0.6} -\end{pspicture} -\end{LTXexample} - - -\subsection{\nxLcs{psplotTangent} and option \nxLkeyword{Tnormal}} -%-------------------------------------------------------------------------------------- -There is an additional option, named \Lkeyword{Derive} for an -alternative function (see following example) to calculate the -slope of the tangent. This will be in general the first -derivative, but can also be any other function. If this option is -different to to the default value \Lkeyset{Derive=default}, then this -function is taken to calculate the slope. For the other cases, -\LPack{pstricks-add} builds a secant with -0.00005}(0,0)(-7.5,-2)(7.5,3.5) - \psplot[linewidth=3\pslinewidth]{-7}{7}{\F} - \psset{linecolor=red, arrows=<->, arrowscale=2} - \multido{\n=-7+1}{8}{\psplotTangent{\n}{1}{\F}} - \psset{linecolor=magenta, arrows=<->, arrowscale=2}% - \multido{\n=0+1}{8}{\psplotTangent[linecolor=blue, Derive=\Fp]{\n}{1}{\F}} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\def\F{x RadtoDeg dup dup cos exch 2 mul cos add exch 3 mul cos add} -\def\Fp{x RadtoDeg dup dup sin exch 2 mul sin 2 mul add exch 3 mul sin 3 mul add neg} -\psset{plotpoints=1001} -\begin{pspicture}(-7.5,-2.5)(7.5,4)%X\psgrid - \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) - \psplot[linewidth=3\pslinewidth]{-7}{7}{\F} - \psset{linecolor=red, arrows=<->, arrowscale=2} - \multido{\n=-7+1}{8}{\psplotTangent{\n}{1}{\F}} - \psset{linecolor=magenta, arrows=<->, arrowscale=2}% - \multido{\n=0+1}{8}{\psplotTangent[linecolor=blue, §\ON§Derive=\Fp§\OFF§]{\n}{1}{\F}} -\end{pspicture} -\end{lstlisting} - -The star version plots only the tangent line in the positive $x$-direction: - -\begin{center} -\bgroup -\def\Falg{cos(x)+cos(2*x)+cos(3*x)} \def\Fpalg{-sin(x)-2*sin(2*x)-3*sin(3*x)} -\begin{pspicture}(-7.5,-2.5)(7.5,4)%\psgrid - \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) - \psplot[linewidth=1.5pt,algebraic,plotpoints=500]{-7.5}{7.5}{\Falg} - \multido{\n=-7+1}{8}{\psplotTangent*[linecolor=red,arrows=->,arrowscale=2,algebraic]{\n}{1}{\Falg}} - \multido{\n=0+1}{8}{\psplotTangent*[linecolor=magenta,% - arrows=->,arrowscale=2,algebraic,Derive={\Fpalg}]{\n}{1}{\Falg}} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\def\Falg{cos(x)+cos(2*x)+cos(3*x)} \def\Fpalg{-sin(x)-2*sin(2*x)-3*sin(3*x)} -\begin{pspicture}(-7.5,-2.5)(7.5,4)%\psgrid - \psaxes{->}(0,0)(-7.5,-2)(7.5,3.5) - \psplot[linewidth=1.5pt,algebraic,plotpoints=500]{-7.5}{7.5}{\Falg} - \multido{\n=-7+1}{8}{\psplotTangent*[linecolor=red,arrows=->,arrowscale=2,algebraic]{\n}{1}{\Falg}} - \multido{\n=0+1}{8}{\psplotTangent*[linecolor=magenta,% - arrows=->,arrowscale=2,algebraic,Derive={\Fpalg}]{\n}{1}{\Falg}} -\end{pspicture} -\end{lstlisting} - -The next example shows the use of the \Lkeyword{Derive} option to draw -the perpendicular line to the tangent. - -\begin{LTXexample}[width=8cm,wide] -\begin{pspicture}(-0.5,-0.5)(7.25,7.25) - \def\Func{10 x div} - \psaxes[arrowscale=1.5]{->}(7,7) - \psplot[linewidth=2pt,algebraic]{1.5}{5}{10/x} - \psplotTangent[linewidth=.5\pslinewidth,linecolor=red,algebraic]{3}{2}{10/x} - \psplotTangent[linewidth=.5\pslinewidth,linecolor=blue,algebraic,Derive=(x*x)/10]{3}{2}{10/x} - \psline[linestyle=dashed](!0 /x 3 def \Func)(!3 /x 3 def \Func)(3,0) -\end{pspicture} -\end{LTXexample} - -By setting the optional argument \Lkeyword{Tnormal} one can plot the -normal of the tangent line. It always starts at the given point. - -%\resetOptions -\begin{LTXexample}[width=8cm,wide] -\begin{pspicture}(-0.5,-0.5)(7.25,7.25) - \def\Func{10 x div} - \psaxes[arrowscale=1.5]{->}(7,7) - \psplot[linewidth=2pt]{1.5}{5}{\Func} - \psplotTangent[linewidth=1.5\pslinewidth,linecolor=red]{3}{2}{\Func} - \psplotTangent[linewidth=1.5\pslinewidth,linecolor=blue,Tnormal]{3}{2}{\Func} - \psline[linestyle=dashed](!0 /x 3 def \Func)(!3 /x 3 def \Func)(3,0) -\end{pspicture} -\end{LTXexample} - - -%-------------------------------------------------------------------------------------- -\subsection{A \nxLkeyword{polarplot} example} -%-------------------------------------------------------------------------------------- - -Let's work with the classical \Index{cardioid}: $r=2(1+\cos(\theta))$ and -$\displaystyle \frac{d r}{d\theta}=-2\sin(\theta)$. The \Lkeyword{Derive} -option always expects the $\frac{d r}{d\theta}$ value and uses -internally the equation for the derivative of implicitly defined -functions: - -\[ -\frac{dy}{dx}=\frac{r^\prime\cdot\sin\theta + x}{r^\prime\cdot\cos\theta - y} -\] -where $x=r\cdot\cos\theta$ and $y=r\cdot\sin\theta$ - - -\begin{LTXexample}[width=6cm,wide] -\begin{pspicture}(-1,-3)(5,3)%\psgrid[subgridcolor=lightgray] - \psaxes{->}(0,0)(-1,-3)(5,3) - \psplot[polarplot,linewidth=3\pslinewidth,linecolor=blue,% - plotpoints=500]{0}{360}{1 x cos add 2 mul} -\end{pspicture} -\end{LTXexample} - -\psset{algebraic=false} -\begin{LTXexample}[width=6cm,wide] -\begin{pspicture}(-1,-3)(5,3)%\psgrid[subgridcolor=lightgray] - \psaxes{->}(0,0)(-1,-3)(5,3) - \psplot[polarplot,linewidth=3\pslinewidth,linecolor=blue,plotpoints=500]{0}{360}{1 x cos add 2 mul} - \multido{\n=0+36}{10}{% - \psplotTangent[polarplot,linecolor=red,arrows=<->]{\n}{1.5}{1 x cos add 2 mul} } -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=6cm,wide] -\begin{pspicture}(-1,-3)(5,3)%\psgrid[subgridcolor=lightgray] - \psaxes{->}(0,0)(-1,-3)(5,3) - \psplot[polarplot,linewidth=3\pslinewidth,linecolor=blue,algebraic,plotpoints=500]{0}{6.289}{2*(1+cos(x))} - \multido{\r=0.000+0.314}{21}{% - \psplotTangent[polarplot,Derive=-2*sin(x),algebraic,linecolor=red,arrows=<->]{\r}{1.5}{2*(1+cos(x))} } -\end{pspicture} -\end{LTXexample} - - - -%-------------------------------------------------------------------------------------- -\subsection{A \nxLcs{parametricplot} example} -%-------------------------------------------------------------------------------------- - -Let's work with a \Index{Lissajou curve}: - $\displaystyle\left\{\begin{array}{l}x=3.5\cos(2t)\\y=3.5\sin(6t)\end{array}\right.$ -whose derivative is : - $\displaystyle\left\{\begin{array}{l}x=-7\sin(2t)\\y=21\cos(6t)\end{array}\right.$ - -The parameter must be the letter $t$ instead of $x$ and when using -the \Lkeyword{algebraic} option you must separate the two equations by -a \Lnotation{|} (see example). - -\begin{LTXexample}[pos=t,wide] -\def\Lissa{t dup 2 RadtoDeg mul cos 3.5 mul exch 6 mul RadtoDeg sin 3.5 mul}% -\psset{yunit=0.6} -\begin{pspicture}(-4,-4)(4,6) - \parametricplot[plotpoints=500,linewidth=3\pslinewidth]{0}{3.141592}{\Lissa} - \multido{\r=0.000+0.314}{11}{% - \psplotTangent[linecolor=red,arrows=<->]{\r}{1.5}{\Lissa} } - \multido{\r=0.157+0.314}{11}{% - \psplotTangent[linecolor=blue,arrows=<->]{\r}{1.5}{\Lissa} } -\end{pspicture}\hfill% -\def\LissaAlg{3.5*cos(2*t)|3.5*sin(6*t)} \def\LissaAlgDer{-7*sin(2*t)|21*cos(6*t)}% -\begin{pspicture}(-4,-4)(4,6) - \parametricplot[algebraic,plotpoints=500,linewidth=3\pslinewidth]{0}{3.141592}{\LissaAlg} - \multido{\r=0.000+0.314}{11}{% - \psplotTangent[algebraic,linecolor=red,arrows=<->]{\r}{1.5}{\LissaAlg} } - \multido{\r=0.157+0.314}{11}{% - \psplotTangent[algebraic,linecolor=blue,arrows=<->,% - Derive=\LissaAlgDer]{\r}{1.5}{\LissaAlg} } -\end{pspicture} -\end{LTXexample} - - - -\resetOptions - -\clearpage -\section{Successive derivatives of a function} - -The new PostScript function \Lps{Derive} has been added for -plotting successive derivatives of a function. It must be used -with the \Lkeyword{algebraic} option. This function has two arguments: - -\begin{enumerate} -\item a positive integer which defines the order of the derivative; obviously $0$ means the - function itself! -\item a function of variable $x$ which can be any function using common operators, -\end{enumerate} - -Do not think that the derivative is approximated, the internal PostScript engine will -compute the real derivative using a formal derivative engine. - -The following diagram contains the plot of the polynomial: - -\[ f(x)=\sum_{i=0}^{14}\frac{(-1)^{i}x^{2i}}{i!}=1-\frac{x^2}{2}+\frac{x^4}{4!}-\frac{x^6}{6!}+\frac{x^8}{8!}- - \frac{x^{10}}{10!}+\frac{x^{12}}{12!}-\frac{x^{14}}{14!}\] - -and of its first 15 derivatives. It is the sequence definition of -the cosine. - - -\begin{LTXexample}[pos=t,wide,preset=\centering] -\psset{unit=2} -\def\getColor#1{\ifcase#1 Tan\or RedOrange\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or Mahogany\or - OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi} -\begin{pspicture}[showgrid=true](0,-1.2)(7,1.5) - \psclip{\psframe[linestyle=none](0,-1.1)(7,1.1)} - \multido{\in=0+1}{16}{% - \psplot[linewidth=1pt,algebraic,linecolor=\getColor{\in}]{0}{7} - {Derive(\in,1-x^2/2+x^4/24-x^6/720+x^8/40320-x^10/3628800+x^12/479001600-x^14/87178291200)}} - \endpsclip -\end{pspicture} -\end{LTXexample} - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \subsection{Other examples} - - -\begin{LTXexample}[width=3.5cm] -\begin{pspicture}[shift=-2.5,showgrid=true,linewidth=1pt](0,-2)(3,3) - \psplot[algebraic]{.001}{3}{x*ln(x)} % f(x) - \psplot[algebraic,linecolor=red]{.05}{3}{Derive(1,x*ln(x))} % f'(x)=1+ln(x) -\end{pspicture} -\end{LTXexample} - - -\clearpage -\section{Variable step for plotting a curve} -\subsection{Theory} - -As you know with the \Lcs{psplot} macro, the curve is plotted -using a piece-wise linear curve. The step is given by the -parameter \Lkeyword{plotpoints}. For each step between $x_i$ and -$x_{i+1}$, the area defined between the curve and its -approximation (a segment) is majored by this formula : - -\begin{minipage}[m]{.5\linewidth} -\[|\varepsilon|\le\frac{M_2(f)(x_{i+1}-x_i)^3}{12}\] - -$M_2(f)$ is a majorant of the second derivative of $f$ in the interval $[x_i;x_{i+1}]$. -\end{minipage} -{\psset{unit=1cm, showpoints=false} -\begin{pspicture}[shift=-2,showgrid=true](0,-1)(6,3) - \pscurve(0,0)(1,1)(3,2.2)(5,2)(6,1)\psline(1,1)(5,2) - \psline(.5,0)(5.5,0)\psline(1,0)(1,1)\psline(5,0)(5,2) - \rput[t](1,-.1){$x_n$}\rput[t](5,-.1){$x_{n+1}$} - \psclip{\pscustom{\psecurve(0,0)(1,1)(3,2.2)(5,2)(6,1)\psline(5,2)}} - \psframe[fillstyle=solid, fillcolor=gray](0,0)(5,5) - \endpsclip - \rput*(3,1.8){$\varepsilon$} -\end{pspicture}} - - - -The parameter \Lkeyword{VarStep} (\false\ by default) activates -the variable step algorithm. It is set to a tolerance defined by -the parameter \Lkeyword{VarStepEpsilon} (\Lkeyval{default} by default, -accept real value). If this parameter is not set by the user, then -it is automatically computed using the default first step given by -the parameter \Lkeyword{plotpoints}. Then, for each step, $f''(x_n)$ -and $f''(x_{n+1})$ are computed and the smaller is used as -$M_2(f)$, and then the step is approximated. This means that the -step is constant for second order polynomials. - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\subsection{The cosine} - -Different value for the tolerance from $0.01$ to $0.000\,1$, a factor $10$ between -each of them. In black, there is the classic \Lcs{psplot} behavior, and in -magenta the default variable step behavior. - -\begin{center} -\bgroup -\psset{algebraic, VarStep=true, unit=2, showpoints=true, linecolor=red} -\begin{pspicture}(-0,-1)(3.14,2)\psgrid - \psplot[VarStepEpsilon=.01]{0}{3.14}{cos(x)} - \psplot[VarStepEpsilon=.001]{0}{3.14}{cos(x)+.15} - \psplot[VarStepEpsilon=.0001]{0}{3.14}{cos(x)+.3} - \psplot[linecolor=magenta]{0}{3.14}{cos(x)+.45} - \psplot[VarStep=false, linewidth=2\pslinewidth, linecolor=black]{-0}{3.14}{cos(x)+.6} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{algebraic, VarStep=true, unit=2, showpoints=true, linecolor=red} -\begin{pspicture}[showgrid=true](-0,-1)(3.14,2) - \psplot[VarStepEpsilon=.01]{0}{3.14}{cos(x)} - \psplot[VarStepEpsilon=.001]{0}{3.14}{cos(x)+.15} - \psplot[VarStepEpsilon=.0001]{0}{3.14}{cos(x)+.3} - \psplot[linecolor=magenta]{0}{3.14}{cos(x)+.45} - \psplot[VarStep=false,linewidth=1pt,linecolor=black]{-0}{3.14}{cos(x)+.6} -\end{pspicture} -\end{lstlisting} - - -\clearpage -\subsection{The Napierian Logarithm} - -A really classic example which gives a bad beginning, the -tolerance is set to $0.001$. - -\begin{center} -\bgroup -\psset{algebraic, VarStep=true, linecolor=red, showpoints=true} -\begin{pspicture}[showgrid=true](0,-5)(16,4) - \psplot[VarStep=false, linecolor=black]{.01}{16}{ln(x)+1} - \psplot[linecolor=magenta]{.51}{16}{ln(x-1/2)+1/2} - \psplot[VarStepEpsilon=.001]{1.01}{16}{ln(x-1)} - \psplot[VarStepEpsilon=.01]{1.51}{16}{ln(x-1.5)-100/200} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{algebraic, VarStep=true, linecolor=red, showpoints=true} -\begin{pspicture}[showgrid=true](0,-5)(16,4) - \psplot[VarStep=false, linecolor=black]{.01}{16}{ln(x)+1} - \psplot[linecolor=magenta]{.51}{16}{ln(x-1/2)+1/2} - \psplot[VarStepEpsilon=.001]{1.01}{16}{ln(x-1)} - \psplot[VarStepEpsilon=.01]{1.51}{16}{ln(x-1.5)-100/200} -\end{pspicture} -\end{lstlisting} - - -\clearpage -\subsection{Sine of the inverse of $x$} -Impossible to draw, but let's try! - -\begin{center} -\bgroup -\psset{xunit=64,algebraic,VarStep,linecolor=red,showpoints=true,linewidth=1pt} -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStepEpsilon=.0001]{.01}{.25}{sin(1/x)} -\end{pspicture}\\ -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStepEpsilon=.00001]{.01}{.25}{sin(1/x)} -\end{pspicture}\\ -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStepEpsilon=.000001]{.01}{.25}{sin(1/x)} -\end{pspicture}\\ -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStep=false, linecolor=black]{.01}{.25}{sin(1/x)} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{xunit=64,algebraic,VarStep,linecolor=red,showpoints=true,linewidth=1pt} -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStepEpsilon=.0001]{.01}{.25}{sin(1/x)} -\end{pspicture}\\ -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStepEpsilon=.00001]{.01}{.25}{sin(1/x)} -\end{pspicture}\\ -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStepEpsilon=.000001]{.01}{.25}{sin(1/x)} -\end{pspicture}\\ -\begin{pspicture}[showgrid=true](0,-1)(.5,1) - \psplot[VarStep=false, linecolor=black]{.01}{.25}{sin(1/x)} -\end{pspicture} -\end{lstlisting} - - - - - -\clearpage -\subsection{A really complecated function} - -Just appreciate the difference between the normal behavior and the plotting with the -\Lkeyword{varStep} option. The function is: - -\[f(x)=x-\frac{x^2}{10}+\ln(x)+\cos(2x)+\sin(x^2)-1\] - -\begin{center} -\bgroup -\psset{xunit=3, algebraic, VarStep, showpoints=true} -\begin{pspicture}[showgrid=true](0,-2)(5,6) - \psplot[VarStepEpsilon=.0005, linecolor=red]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)} - \psplot[linecolor=magenta]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)+.5} - \psplot[VarStep=false]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)-1} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{xunit=3, algebraic, VarStep, showpoints=true} -\begin{pspicture}[showgrid=true](0,-2)(5,6) - \psplot[VarStepEpsilon=.0005, linecolor=red]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)} - \psplot[linecolor=magenta]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)+.5} - \psplot[VarStep=false]{.1}{5}{x-x^2/10+ln(x)+cos(2*x)+sin(x^2)-1} -\end{pspicture} -\end{lstlisting} - - -\clearpage -\subsection{A hyperbola} - -\begin{center} -\bgroup -\psset{algebraic, showpoints=true, unit=0.75} -\begin{pspicture}(-5,-4)(9,6) - \psplot[linecolor=black]{-5}{1.8}{(x-1)/(x-2)} - \psplot[VarStep=true, VarStepEpsilon=.001, linecolor=red]{2.2}{9}{(x-1)/(x-2)} - \psaxes{->}(0,0)(-5,-4)(9,6) -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{algebraic, showpoints=true, unit=0.75} -\begin{pspicture}(-5,-4)(9,6) - \psplot[linecolor=black]{-5}{1.8}{(x-1)/(x-2)} - \psplot[VarStep=true, VarStepEpsilon=.001, linecolor=red]{2.2}{9}{(x-1)/(x-2)} - \psaxes{->}(0,0)(-5,-4)(9,6) -\end{pspicture} -\end{lstlisting} - - - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\subsection{Successive derivatives of a polynomial} - -\begin{center} -\bgroup -\psset{unit=2, algebraic=true, VarStep=true, showpoints=true, VarStepEpsilon=.001} -\def\getColor#1{\ifcase#1 Tan\or RedOrange\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or Mahogany\or - OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi} -\begin{pspicture}[showgrid=true](0,-1.2)(7,1.5) - \psclip{\psframe[linestyle=none](0,-1.1)(7,1.1)} - \multido{\in=0+1}{16}{% - \psplot[algebraic=true, linecolor=\getColor{\in}]{0.1}{7} - {Derive(\in,Sum(i,0,1,7,(-1)^i*x^(2*i)/Fact(2*i)))}} - \endpsclip -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{unit=2, algebraic=true, VarStep=true, showpoints=true, VarStepEpsilon=.001} -\def\getColor#1{\ifcase#1 Tan\or RedOrange\or magenta\or yellow\or green\or Orange\or blue\or - DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or Mahogany\or - OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi} -\begin{pspicture}[showgrid=true](0,-1.2)(7,1.5) - \psclip{\psframe[linestyle=none](0,-1.1)(7,1.1)} - \multido{\in=0+1}{16}{% - \psplot[algebraic=true, linecolor=\getColor{\in}]{0.1}{7} - {Derive(\in,Sum(i,0,1,7,(-1)^i*x^(2*i)/Fact(2*i)))}} - \endpsclip -\end{pspicture} -\end{lstlisting} - - -\clearpage -\subsection{The variable step algorithm together with the \texttt{IfTE} primitive} - -\begin{center} -\bgroup -\psset{unit=1.5, algebraic, VarStep, showpoints=true, VarStepEpsilon=.001} -\begin{pspicture}[showgrid=true](-7,-2)(2,4) - \psplot{-7}{2}{IfTE(x<-5,-(x+5)^3/2,IfTE(x<0,0,x^2))} - \psplot{-7}{2}{5*x/9+26/9} - \psplot[linecolor=blue]{-7}{2}{(x+7)^30/9^30*4.5-1/2} - \psplot[linecolor=red]{-6.9}{2} - {IfTE(x<-6,ln(x+7),IfTE(x<-3,x+6,IfTE(x<0.1415926,sin(x+3)+3,3.1415926-x)))} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{unit=1.5, algebraic, VarStep, showpoints=true, VarStepEpsilon=.001} -\begin{pspicture}[showgrid=true](-7,-2)(2,4) - \psplot{-7}{2}{IfTE(x<-5,-(x+5)^3/2,IfTE(x<0,0,x^2))} - \psplot{-7}{2}{5*x/9+26/9} - \psplot[linecolor=blue]{-7}{2}{(x+7)^30/9^30*4.5-1/2} - \psplot[linecolor=red]{-6.9}{2} - {IfTE(x<-6,ln(x+7),IfTE(x<-3,x+6,IfTE(x<0.1415926,sin(x+3)+3,3.1415926-x)))} -\end{pspicture} -\end{lstlisting} - - - -\clearpage -\subsection{Using \nxLcs{parametricplot}} - -\begin{BDef} -\Lcs{parametricplot}\OptArgs\Largb{t0}\Largb{t1}\OptArg{PS commands}\Largb{x(t) y(t)} -\end{BDef} - -\begin{center} -\bgroup -\psset{unit=2.5} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, - VarStepEpsilon=.0001] - {-3.14}{3.14}{cos(3*t)|sin(2*t)} -\end{pspicture} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, - VarStepEpsilon=.0001] - {-3.14}{3.14}{cos(3*t)|sin(2*t)} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{unit=3} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, - VarStepEpsilon=.0001] - {-3.14}{3.14}{cos(3*t)|sin(2*t)} -\end{pspicture} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, - VarStepEpsilon=.0001] - {-3.14}{3.14}{cos(3*t)|sin(2*t)} -\end{pspicture} -\end{lstlisting} - - -\begin{center} -\bgroup -\psset{unit=2.5} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, - VarStepEpsilon=.0001] - {0}{47.115}{cos(5*t)|sin(3*t)} -\end{pspicture} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, - VarStepEpsilon=.0001] - {0}{47.115}{cos(5*t)|sin(3*t)} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{unit=2.5} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=red,VarStep=true, showpoints=true, - VarStepEpsilon=.0001] - {0}{47.115}{cos(5*t)|sin(3*t)} -\end{pspicture} -\begin{pspicture}[showgrid=true](-1,-1)(1,1) -\parametricplot[algebraic=true,linecolor=blue,VarStep=true, showpoints=false, - VarStepEpsilon=.0001] - {0}{47.115}{cos(5*t)|sin(3*t)} -\end{pspicture} -\end{lstlisting} - - -\begin{center} -\bgroup -\psset{xunit=.5} -\begin{pspicture}[showgrid=true](0,0)(12.566,2) -\parametricplot[algebraic,linecolor=red,VarStep, showpoints=true, - VarStepEpsilon=.01]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} -\end{pspicture} -% -\begin{pspicture}[showgrid=true](0,0)(12.566,2) -\parametricplot[algebraic,linecolor=blue,VarStep, showpoints=false, - VarStepEpsilon=.001]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{xunit=.5} -\begin{pspicture}[showgrid=true](0,0)(12.566,2) -\parametricplot[algebraic,linecolor=red,VarStep, showpoints=true, - VarStepEpsilon=.01]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} -\end{pspicture} -% -\begin{pspicture}[showgrid=true](0,0)(12.566,2) -\parametricplot[algebraic,linecolor=blue,VarStep, showpoints=false, - VarStepEpsilon=.001]{0}{12.566}{t+cos(-t-Pi/2)|1+sin(-t-Pi/2)} -\end{pspicture} -\end{lstlisting} - - -\resetOptions - - -\section{New math functions and their derivatives} - -\subsection{The inverse sine and its derivative} - -\begin{center} -\bgroup -\psset{unit=1.5} -\begin{pspicture}[showgrid=true](-1,-2)(1,2) - \psplot[linecolor=blue,algebraic]{-1}{1}{asin(x)} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,-2)(1,2) - \psplot[linecolor=blue]{-.999}{.999}{asin(x)} -\end{pspicture} -\hspace{1em} -\begin{pspicture}[showgrid=true](-1,0)(1,4) - \psplot[linecolor=blue]{-.97}{.97}{Derive(1,asin(x))} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.0001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,0)(1,4) - \psplot[linecolor=blue]{-.97}{.97}{Derive(1,asin(x))} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{unit=1.5} -\begin{pspicture}[showgrid=true](-1,-2)(1,2) - \psplot[linecolor=blue,algebraic]{-1}{1}{asin(x)} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,-2)(1,2) - \psplot[linecolor=blue]{-.999}{.999}{asin(x)} -\end{pspicture} -\hspace{1em} -\begin{pspicture}[showgrid=true](-1,0)(1,4) - \psplot[linecolor=red]{-.97}{.97}{Derive(1,asin(x))} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.0001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,0)(1,4) - \psplot[linecolor=red]{-.97}{.97}{Derive(1,asin(x))} -\end{pspicture} -\end{lstlisting} - - -\subsection{The inverse cosine and its derivative} - -\begin{center} -\bgroup -\psset{unit=1.5} -\begin{pspicture}[showgrid=true](-1,0)(1,3) - \psplot[linecolor=blue,algebraic]{-1}{1}{acos(x)} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,0)(1,3) - \psplot[linecolor=blue]{-.999}{.999}{acos(x)} -\end{pspicture} -\hspace{1em} -\begin{pspicture}[showgrid=true](-1,-4)(1,-1) - \psplot[linecolor=blue]{-.97}{.97}{Derive(1,acos(x))} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.0001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,-4)(1,-1) - \psplot[linecolor=blue]{-.97}{.97}{Derive(1,acos(x))} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\psset{unit=1.5} -\begin{pspicture}[showgrid=true](-1,0)(1,3) - \psplot[linecolor=blue,algebraic]{-1}{1}{acos(x)} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,0)(1,3) - \psplot[linecolor=blue]{-.999}{.999}{acos(x)} -\end{pspicture} -\hspace{1em} -\begin{pspicture}[showgrid=true](-1,-4)(1,-1) - \psplot[linecolor=red]{-.97}{.97}{Derive(1,acos(x))} -\end{pspicture} -\hspace{1em} -\psset{algebraic, VarStep, VarStepEpsilon=.0001, showpoints=true} -\begin{pspicture}[showgrid=true](-1,-4)(1,-1) - \psplot[linecolor=red]{-.97}{.97}{Derive(1,acos(x))} -\end{pspicture} -\end{lstlisting} - - - -\subsection{The inverse tangent and its derivative} - -\begin{center} -\bgroup -\begin{pspicture}[showgrid=true](-4,-2)(4,2) -\psset{algebraic=true} - \psplot[linecolor=blue,linewidth=1pt]{-4}{4}{atg(x)} - \psplot[linecolor=red,VarStep, VarStepEpsilon=.0001, showpoints=true]{-4}{4}{Derive(1,atg(x))} -\end{pspicture} -\hspace{1em} -\begin{pspicture}[showgrid=true](-4,-2)(4,2) -\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=blue]{-4}{4}{atg(x)} - \psplot[linecolor=red]{-4}{4}{Derive(1,atg(x))} -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\begin{pspicture}[showgrid=true](-4,-2)(4,2) -\psset{algebraic=true} - \psplot[linecolor=blue,linewidth=1pt]{-4}{4}{atg(x)} - \psplot[linecolor=red,VarStep, VarStepEpsilon=.0001, showpoints=true]{-4}{4}{Derive(1,atg(x))} -\end{pspicture} -\hspace{1em} -\begin{pspicture}[showgrid=true](-4,-2)(4,2) -\psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=blue]{-4}{4}{atg(x)} - \psplot[linecolor=red]{-4}{4}{Derive(1,atg(x))} -\end{pspicture} -\end{lstlisting} - -\subsection{Hyperbolic functions} - -\begin{center} -\bgroup -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\hspace{1em} -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\hspace{1em} -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{sh(x)} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{ch(x)} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{th(x)} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\end{lstlisting} - - - -\begin{center} -\bgroup -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\hspace{1em} -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true,linewidth=1pt} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\hspace{1em} -\begin{pspicture}(-3,-4)(3,4) -\psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-2}{2}{Derive(1,sh(x))} - \psplot[linecolor=blue,linewidth=1pt]{-2}{2}{Derive(1,ch(x))} - \psplot[linecolor=green,linewidth=1pt]{-3}{3}{Derive(1,th(x))} - \psaxes{->}(0,0)(-3,-4)(3,4) -\end{pspicture} -\end{lstlisting} - - - -\begin{center} -\bgroup -\begin{pspicture}(-7,-3)(7,3) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} - \psplot[linecolor=blue,linewidth=1pt]{1}{7}{Argch(x)} - \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} - \psaxes{->}(0,0)(-7,-3)(7,3) -\end{pspicture}\\[\baselineskip] -\begin{pspicture}(-7,-3)(7,3) - \psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} - \psplot[linecolor=blue,linewidth=1pt]{1.001}{7}{Argch(x)} - \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} - \psaxes{->}(0,0)(-7,-3)(7,3) -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\begin{pspicture}(-7,-3)(7,3) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} - \psplot[linecolor=blue,linewidth=1pt]{1}{7}{Argch(x)} - \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} - \psaxes{->}(0,0)(-7,-3)(7,3) -\end{pspicture}\\[\baselineskip] -\begin{pspicture}(-7,-3)(7,3) - \psset{algebraic, VarStep, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Argsh(x)} - \psplot[linecolor=blue,linewidth=1pt]{1.001}{7}{Argch(x)} - \psplot[linecolor=green,linewidth=1pt]{-.99}{.99}{Argth(x)} - \psaxes{->}(0,0)(-7,-3)(7,3) -\end{pspicture} -\end{lstlisting} - - - -\begin{center} -\bgroup -\begin{pspicture}(-7,-0.5)(7,6) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} - \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} - \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} - \psaxes{->}(0,0)(-7,0)(7,6) -\end{pspicture}\\[\baselineskip] -\begin{pspicture}(-7,-0.5)(7,6) -\psset{algebraic=true} - \psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} - \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} - \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} - \psaxes{->}(0,0)(-7,0)(7,6) -\end{pspicture} -\egroup -\end{center} - -\begin{lstlisting} -\begin{pspicture}(-7,-0.5)(7,6) -\psset{algebraic=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} - \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} - \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} - \psaxes{->}(0,0)(-7,0)(7,6) -\end{pspicture}\\[\baselineskip] -\begin{pspicture}(-7,-0.5)(7,6) -\psset{algebraic=true} - \psset{algebraic=true, VarStep=true, VarStepEpsilon=.001, showpoints=true} - \psplot[linecolor=red,linewidth=1pt]{-7}{7}{Derive(1,Argsh(x))} - \psplot[linecolor=blue,linewidth=1pt]{1.014}{7}{Derive(1,Argch(x))} - \psplot[linecolor=green,linewidth=1pt]{-.9}{.9}{Derive(1,Argth(x))} - \psaxes{->}(0,0)(-7,0)(7,6) -\end{pspicture} -\end{lstlisting} - -\clearpage -%-------------------------------------------------------------------------------------- -\section[\nxLcs{psplotDiffEqn} -- solving diffential equations]% - {\nxLcs{psplotDiffEqn} -- solving diffential equations} -%-------------------------------------------------------------------------------------- - - - A differential equation of first order is like - -\begin{align} y^\prime=f(x,y,y^\prime) \end{align} - - -where $y$ is a function of $x$. We define some vectors $Y=[y, y', -\cdots , y^{(n-1)}]$ and $Y^\prime=[y^\prime, y^{\prime\prime}, -\cdots , y^{n}]$, depending on the order $n$. The syntax of the -macro is - -\begin{BDef} -\Lcs{psplotDiffEqn}\OptArgs\Largb{x0}\Largb{x1}\Largb{y0}\Largb{f(x,y,y',...)} -\end{BDef} - -\begin{itemize}\setlength\itemsep{0pt}\setlength\parsep{0pt}\setlength\parskip{0pt} -\item \verb+options+: the \verb+\psplotDiffEqn+ specific options and all other of PSTricks, which -make sense; -\item $x_0$: the start value; -\item $x_1$: the end value of the definition interval; -\item $y_0$: the initial values for $y(x_0)\ y'(x_0)\ \ldots$; -\item $f(x,y,y',...)$: the differential equation, depending to the number of initial values, e.g.: - \verb+{0 1}+ for $y_0$ are two initial values, so that we have a differential equation of - second order $f(x,y,y')$ and the macro leaves $y\ y'$ on the stack. -\end{itemize} - -The new options are: - - -\begin{itemize}\setlength\itemsep{0pt}\setlength\parsep{0pt}\setlength\parskip{0pt} -\item \Lkeyword{method}: integration method (\verb+euler+ for order 1 euler method, \verb+rk4+ for - 4\textsuperscript{th} order Runge-Kutta method); -\item \Lkeyword{whichabs}: select the abscissa for plotting the graph, by default it is - $x$, but you can specify a number which represent a position in the vector $y$; -\item \Lkeyword{whichord}: same as precedent for the ordinate, by default $y(0)$; -\item \Lkeyword{plotfuncx}: describe a ps function for the abscissa, parameter - \Lkeyword{whichabs} becomes useless; -\item \Lkeyword{plotfuncy}: idem for the ordinate; -\item \Lkeyword{buildvector}: boolean parameter for specifying the input-output of the - $f$ description: - \begin{description} - \item[\texttt{true}] (default): $y$ is put on the stack element by element, $y'$ - must be given in the same way; - \item[\texttt{false}]: $y$ is put on the stack as a vector, $y'$ must be returned - in the same way; - \end{description} - -\item \Lkeyword{algebraic}: algebraic description for $f$, \Lkeyword{buildvector} - parameter is useless when activating this option. -\end{itemize} - - - -\clearpage -\subsection{Variable step for differential equations} - -A new algorithm has been added for adjusting the step according to the variations of -the curve. The parameter \Lkeyword{method} has a new possible value : \Lkeyword{varrkiv} to -activate the \Index{Runge-Kutta} method with variable step, then the parameter -\Lkeyword{varsteptol} (real value; \verb+.01+ by default) can control the tolerance of -the algortihm. - -\begin{center} -\bgroup -\def\Funct{neg}\def\FunctAlg{-y[0]} -\psset{xunit=1.5, yunit=8, showpoints=true} -\begin{pspicture}[showgrid=true](0,0)(10,1.2) - \psplot[linewidth=6\pslinewidth, linecolor=green, showpoints=false]{0}{10}{Euler x neg exp} - \psplotDiffEqn[linecolor=magenta, method=varrkiv, varsteptol=.1, plotpoints=2]{0}{10}{1}{\Funct} - \rput(0,.0){\psplotDiffEqn[linecolor=blue, method=varrkiv, varsteptol=.01, plotpoints=2]{0}{10}{1}{\Funct}} - \rput(0,.1){\psplotDiffEqn[linecolor=Orange, method=varrkiv, varsteptol=.001, plotpoints=2]{0}{10}{1}{\Funct}} - \rput(0,.2){\psplotDiffEqn[linecolor=red, method=varrkiv, varsteptol=.0001, plotpoints=2]{0}{10}{1}{\Funct}} - \psset{linewidth=4\pslinewidth,showpoints=false} - \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](3.3,.9){\small RK ordre 4 : $\varepsilon<10^{-1}$} - \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](3.3,.8){\small RK ordre 4 : $\varepsilon<10^{-2}$} - \rput*(3.3,.7){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](3.3,.7){\small RK ordre 4 : $\varepsilon<10^{-3}$} - \rput*(3.3,.6){\psline[linecolor=red](-.75cm,0)} - \rput*[l](3.3,.6){\small RK ordre 4 : $\varepsilon<10^{-4}$} - \rput*(3.3,.5){\psline[linecolor=green](-.75cm,0)} - \rput*[l](3.3,.5){\small solution exacte} -\end{pspicture} -{\captionof{figure}{Equation $y'=-y$ with $y_0=1$.}\label{fig:minusexpvarstep}} -\egroup -\end{center} - - -\begin{lstlisting}[wide=true] -\def\Funct{neg}\def\FunctAlg{-y[0]} -\psset{xunit=1.5, yunit=8, showpoints=true} -\begin{pspicture}[showgrid=true](0,0)(10,1.2) - \psplot[linewidth=6\pslinewidth, linecolor=green, showpoints=false]{0}{10}{Euler x neg exp} - \psplotDiffEqn[linecolor=magenta, method=varrkiv, varsteptol=.1, plotpoints=2]{0}{10}{1}{\Funct} - \rput(0,.0){\psplotDiffEqn[linecolor=blue, method=varrkiv, varsteptol=.01, plotpoints=2]{0}{10}{1}{\Funct}} - \rput(0,.1){\psplotDiffEqn[linecolor=Orange, method=varrkiv, varsteptol=.001, plotpoints=2]{0}{10}{1}{\Funct}} - \rput(0,.2){\psplotDiffEqn[linecolor=red, method=varrkiv, varsteptol=.0001, plotpoints=2]{0}{10}{1}{\Funct}} - \psset{linewidth=4\pslinewidth,showpoints=false} - \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](3.3,.9){\small RK ordre 4 : $\varepsilon<10^{-1}$} - \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](3.3,.8){\small RK ordre 4 : $\varepsilon<10^{-2}$} - \rput*(3.3,.7){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](3.3,.7){\small RK ordre 4 : $\varepsilon<10^{-3}$} - \rput*(3.3,.6){\psline[linecolor=red](-.75cm,0)} - \rput*[l](3.3,.6){\small RK ordre 4 : $\varepsilon<10^{-4}$} - \rput*(3.3,.5){\psline[linecolor=green](-.75cm,0)} - \rput*[l](3.3,.5){\small solution exacte} -\end{pspicture} -\end{lstlisting} - - - -\begin{center} -\bgroup -\def\Funct{exch neg} -\psset{xunit=1.5, yunit=5, method=varrkiv, showpoints=true}%% -\def\quatrepi{12.5663706144} -\begin{pspicture}(0,-1)(10,1.3) - \psaxes{->}(0,0)(0,-1)(10,1.3) - \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{10}{cos(x)} - \rput(0,.0){\psplotDiffEqn[linecolor=magenta, plotpoints=7, varsteptol=.1]{0}{10}{1 0}{\Funct}} - \rput(0,.0){\psplotDiffEqn[linecolor=blue, plotpoints=201, varsteptol=.01]{0}{10}{1 0}{\Funct}} - \rput(0,.1){\psplotDiffEqn[linewidth=2\pslinewidth, linecolor=red, varsteptol=.001]{0}{10}{1 0}{\Funct}} - \rput(0,.2){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{10}{1 0}{\Funct}} - \rput(0,.3){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{10}{1 0}{\Funct}} - \psset{linewidth=4\pslinewidth,showpoints=false} - \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} - \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} - \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} - \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} - \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} - \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} - \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} - \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} - \rput*[l](2.3,.4){\small solution exacte} -\end{pspicture} -{\captionof{figure}{Equation $y''=-y$}\label{fig:trigfunc}} -\egroup -\end{center} - -\begin{lstlisting}[wide=true] -\def\Funct{exch neg} -\psset{xunit=1.5, yunit=5, method=varrkiv, showpoints=true}%% -\def\quatrepi{12.5663706144} -\begin{pspicture}(0,-1)(10,1.3) - \psaxes{->}(0,0)(0,-1)(10,1.3) - \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{10}{cos(x)} - \rput(0,.0){\psplotDiffEqn[linecolor=magenta, plotpoints=7, varsteptol=.1]{0}{10}{1 0}{\Funct}} - \rput(0,.0){\psplotDiffEqn[linecolor=blue, plotpoints=201, varsteptol=.01]{0}{10}{1 0}{\Funct}} - \rput(0,.1){\psplotDiffEqn[linewidth=2\pslinewidth, linecolor=red, varsteptol=.001]{0}{10}{1 0}{\Funct}} - \rput(0,.2){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{10}{1 0}{\Funct}} - \rput(0,.3){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{10}{1 0}{\Funct}} - \psset{linewidth=4\pslinewidth,showpoints=false} - \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} - \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} - \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} - \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} - \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} - \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} - \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} - \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} - \rput*[l](2.3,.4){\small solution exacte} -\end{pspicture} -\end{lstlisting} - - - - -\begin{center} -\bgroup -\def\Funct{exch} -\psset{xunit=4, yunit=1, method=varrkiv, showpoints=true}%% -\def\quatrepi{12.5663706144} -\begin{pspicture}(0,-0.5)(3,11) - \psaxes{->}(0,0)(3,11) - \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{3}{ch(x)} - \rput(0,.0){\psplotDiffEqn[linecolor=magenta, varsteptol=.1]{0}{3}{1 0}{\Funct}} - \rput(0,.3){\psplotDiffEqn[linecolor=blue, varsteptol=.01]{0}{3}{1 0}{\Funct}} - \rput(0,.6){\psplotDiffEqn[linecolor=red, varsteptol=.001]{0}{3}{1 0}{\Funct}} - \rput(0,.9){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{3}{1 0}{\Funct}} - \rput(0,1.2){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{3}{1 0}{\Funct}} - \psset{linewidth=4\pslinewidth,showpoints=false} - \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} - \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} - \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} - \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} - \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} - \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} - \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} - \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} - \rput*[l](2.3,.4){\small solution exacte} -\end{pspicture} -\captionof{figure}{Equation $y''=y$} -\egroup -\end{center} - -\begin{lstlisting}[wide=true] -\def\Funct{exch} -\psset{xunit=4, yunit=1, method=varrkiv, showpoints=true}%% -\def\quatrepi{12.5663706144} -\begin{pspicture}(0,-0.5)(3,11) - \psaxes{->}(0,0)(3,11) - \psplot[linewidth=4\pslinewidth, linecolor=green, algebraic=true]{0}{3}{ch(x)} - \rput(0,.0){\psplotDiffEqn[linecolor=magenta, varsteptol=.1]{0}{3}{1 0}{\Funct}} - \rput(0,.3){\psplotDiffEqn[linecolor=blue, varsteptol=.01]{0}{3}{1 0}{\Funct}} - \rput(0,.6){\psplotDiffEqn[linecolor=red, varsteptol=.001]{0}{3}{1 0}{\Funct}} - \rput(0,.9){\psplotDiffEqn[linecolor=black, varsteptol=.0001]{0}{3}{1 0}{\Funct}} - \rput(0,1.2){\psplotDiffEqn[linecolor=Orange, varsteptol=.00001]{0}{3}{1 0}{\Funct}} - \psset{linewidth=4\pslinewidth,showpoints=false} - \rput*(2.3,.9){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](2.3,.9){\small $\varepsilon<10^{-1}$} - \rput*(2.3,.8){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](2.3,.8){\small $\varepsilon<10^{-2}$} - \rput*(2.3,.7){\psline[linecolor=red](-.75cm,0)} - \rput*[l](2.3,.7){\small $\varepsilon<10^{-3}$} - \rput*(2.3,.6){\psline[linecolor=black](-.75cm,0)} - \rput*[l](2.3,.6){\small $\varepsilon<10^{-4}$} - \rput*(2.3,.5){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](2.3,.5){\small $\varepsilon<10^{-5}$} - \rput*(2.3,.4){\psline[linecolor=green](-.75cm,0)} - \rput*[l](2.3,.4){\small solution exacte} -\end{pspicture} -\end{lstlisting} +By default all arrows are filled polygons. With the option +\Lkeyset{ArrowFill=false} there are ''white`` arrows. Only for the +beginning/end arrows are they empty, the inside arrows are +overpainted by the line. +\psset{arrowscale=1} +\begin{LTXexample}[width=3.5cm] +\psset{arrowscale=2.5} +\psline[linecolor=red,arrowinset=0]{<->}(-1,0)(2,0) +\end{LTXexample} +\begin{LTXexample}[width=3.5cm] +\psset{arrowscale=2.5} +\psline[linecolor=red,arrowinset=0,ArrowFill=false]{<->}(-1,0)(2,0) +\end{LTXexample} +\begin{LTXexample}[width=3.5cm] +\psset{arrowscale=2.5} +\psline[linecolor=red,arrowinset=0,arrowsize=0.2, + ArrowFill=false]{<->}(-1,0)(2,0) +\end{LTXexample} -\clearpage -\subsection{Equation of second order} +\begin{LTXexample}[width=3.5cm] +\psline[linecolor=blue,arrowscale=4, + ArrowFill]{>>->>}(-1,0)(2,0) +\end{LTXexample} -Here is the traditional simulation of two stars attracting each -other according to the classical gravitation law in -$\displaystyle\frac{1}{r^2}$. In 2-Dimensions, the system to be -solved is composed of four second order differential equations. In -order to be described, each of them gives two first order -equations, then we obtain a 8 sized vectorial equation. In the -following example the masses of the stars are 1 and 20. +\begin{LTXexample}[width=3.5cm] +\psline[linecolor=blue,arrowscale=4, + ArrowFill=false]{>>->>}(-1,0)(2,0) +\rule{3cm}{0pt}\\[30pt] +\end{LTXexample} -\[ -\left\{ -\begin{array}[m]{l} - x''_1=\displaystyle\frac{M_2}{r^2}\cos(\theta)\\ - y''_1=\displaystyle\frac{M_2}{r^2}\sin(\theta)\\ - x''_2=\displaystyle\frac{M_1}{r^2}\cos(\theta)\\ - y''_2=\displaystyle\frac{M_1}{r^2}\sin(\theta)\\ -\end{array} -\right. -\mbox{ avec } -\left\{ -\begin{array}[m]{l} - r^2=(x_1-x_2)^2+(y_1-y_2)^2\\ - \cos(\theta)=\displaystyle\frac{(x_1-x_2)}{r}\\ - \sin(\theta)=\displaystyle\frac{(y_1-y_2)}{r}\\ -\end{array} -\right. -\mbox{% -\begin{pspicture}[shift=-2](5,4)\psset{arrowscale=2} - \psframe[linewidth=.75\pslinewidth](5,4) - \pstGeonode[PosAngle={-90,90}](1,1){M_1}(4,3){M_2} - \pstHomO[HomCoef=.33, PointSymbol=none]{M_1}{M_2}[F_1] - \psline[arrows=->](M_1)(F_1) - \pstHomO[HomCoef=.33, PointSymbol=none]{M_2}{M_1}[F_2] - \psline[arrows=->, arrowscale=2](M_2)(F_2) - \pstGeonode[PointSymbol=none, PointName=none](M_2|M_1){A} - \psline[linewidth=.5\pslinewidth](M_1)(A) - \pstMarkAngle{A}{M_1}{M_2}{$\theta$} - \ncline[linewidth=.5\pslinewidth, offset=.5, arrows=<->]{M_1}{M_2} - \ncput*{$r$} -\end{pspicture}} -\] +\begin{LTXexample}[width=3.5cm] +\psline[linecolor=blue,arrowscale=4, + ArrowFill]{>|->|}(-1,0)(2,0) +\end{LTXexample} -\begin{table}[!htbp] - \centering\small - \begin{tabular}{|l@{}>{\ttfamily}l@{}>{ \ttfamily \%\% }l|} - \hline - && x1 y1 x'1 y'1 x2 y2 x'2 y'2\\ - &/yp2 exch def /xp2 exch def /ay2 exch def /ax2 exch def&mise en variables\\ - &/yp1 exch def /xp1 exch def /ay1 exch def /ax1 exch def&mise en variables\\ - &/ro2 ax2 ax1 sub dup mul ay2 ay1 sub dup mul add def&calcul de r*r\\ - &xp1 yp1&\\ - &ax2 ax1 sub ro2 sqrt div ro2 div&calcul de x''1\\ - &ay2 ay1 sub ro2 sqrt div ro2 div&calcul de y''1\\ - &xp2 yp2&\\ - &3 index -20 mul&calcul de x''2=-20x''1\\ - &3 index -20 mul&calcul de y''2=-20y''1\\ - \hline - \end{tabular} - \caption{\PS source code for the gravitational interaction}\label{intgravcode} -\end{table} +\begin{LTXexample}[width=3.5cm] +\psline[linecolor=blue,arrowscale=4, + ArrowFill=false]{>|->|}(-1,0)(2,0)% +\end{LTXexample} -\begin{table}[!htbp] - \centering - \small\newcommand{\POW}{\symbol{'136}} - \begin{tabular}{|l@{}>{\ttfamily}l@{}>{ \ttfamily \%\% }l|} - \hline - &y[2]|&y'[0]\\ - &y[3]|&y'[1]\\ - &(y[4]-y[0])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5|&y'[2]=y''[0]\\ - &(y[5]-y[1])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5|&y'[3]=y''[1]\\ - &y[6]|&y'[4]\\ - &y[7]|&y'[5]\\ - &20*(y[0]-y[4])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5|&y'[6]=y''[4]\\ - &20*(y[1]-y[5])/((y[4]-y[0])\POW 2+(y[5]-y[1])\POW 2)\POW 1.5&y'[7]=y''[5]\\ - \hline - \end{tabular} - \caption{Algebraic description for the gravitational interaction}\label{intgravalgcode} -\end{table} -\newcommand\Grav{% - /yp2 exch def /xp2 exch def /ay2 exch def /ax2 exch def - /yp1 exch def /xp1 exch def /ay1 exch def /ax1 exch def - /ro2 ax2 ax1 sub dup mul ay2 ay1 sub dup mul add def - xp1 yp1 - ax2 ax1 sub ro2 sqrt div ro2 div - ay2 ay1 sub ro2 sqrt div ro2 div - xp2 yp2 - 3 index -20 mul - 3 index -20 mul} -\newcommand\GravAlg{% - y[2]|y[3]|% - (y[4]-y[0])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5|% - (y[5]-y[1])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5|% - y[6]|y[7]|% - 20*(y[0]-y[4])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5|% - 20*(y[1]-y[5])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5} -%% 0 1 2 3 4 5 6 7 -%% x1 y1 x'1 y'1 x2 y2 x'2 y'2 +%-------------------------------------------------------------------------------------- +\subsection{Examples} +%-------------------------------------------------------------------------------------- +All examples are printed with \verb|\psset{arrowscale=2,linecolor=red}|. +\subsubsection{\nxLcs{psline}} -\begin{LTXexample}[width=5cm,wide] -\def\InitCond{ 1 1 .1 0 -1 -1 -2 0} -\begin{pspicture}[shift=-2,showgrid=true](-3,-1.75)(2,1.5) - \psplotDiffEqn[whichabs=0, whichord=1, linecolor=blue, method=rk4, plotpoints=100]{0}{3.95}{\InitCond}{\Grav} - \psset{showpoints=true,whichabs=4, whichord=5} - \psplotDiffEqn[linecolor=black, method=varrkiv, varsteptol=.0001, plotpoints=200]{0}{3.9}{\InitCond}{\Grav} +\bigskip +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=->]{|<->|}(2,1) \end{pspicture} \end{LTXexample} -\vspace{-2ex} -{\captionof{figure}{Gravitational interaction: fixed landmark, trajectory of the stars}\label{fig:InterGravRepFix}} +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=-|]{|-|}(2,1) +\end{pspicture} +\end{LTXexample} +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=->,ArrowInsideNo=2]{->}(2,1) +\end{pspicture} +\end{LTXexample} -\bigskip -\begin{LTXexample}[width=5cm,wide] -\def\InitCond{ 1 1 .1 0 -1 -1 -2 0} -\begin{pspicture}[shift=-1.5,showgrid=true](-4,-1.75)(1,1) - \psplotDiffEqn[linecolor=red, plotpoints=200,method=varrkiv, varsteptol=.0001, showpoints=true, - plotfuncx=y dup 4 get exch 0 get sub, - plotfuncy=dup 5 get exch 1 get sub ]{0}{3.9}{\InitCond}{\Grav} +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=->,ArrowInsideNo=2,ArrowInsideOffset=0.1]{->}(2,1) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=-*]{->}(0,0)(2,1)(3,0)(4,0)(6,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=-*,ArrowInsidePos=0.25]{->}(0,0)(2,1)(3,0)(4,0)(6,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=-*,ArrowInsidePos=0.25,ArrowInsideNo=2]{->}% + (0,0)(2,1)(3,0)(4,0)(6,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=->, ArrowInsidePos=0.25]{->}% + (0,0)(2,1)(3,0)(4,0)(6,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[linestyle=none,ArrowInside=->,ArrowInsidePos=0.25]{->}% + (0,0)(2,1)(3,0)(4,0)(6,2) +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=-<, ArrowInsidePos=0.75]{->}% + (0,0)(2,1)(3,0)(4,0)(6,2) \end{pspicture} \end{LTXexample} -\vspace{-2ex} -{\captionof{figure}{Gravitational interaction : landmark defined by one star}\label{fig:IGnewrep}} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true,ArrowInside=-*} +\psline(0,0)(2,1)(3,0)(4,0)(6,2) +\psset{linestyle=none} +\psline[ArrowInsidePos=0](0,0)(2,1)(3,0)(4,0)(6,2) +\psline[ArrowInsidePos=1](0,0)(2,1)(3,0)(4,0)(6,2) +\end{pspicture} +\end{LTXexample} -\begin{center} -\bgroup -\def\InitCond{ 1 1 .1 0 -1 -1 -2 0} -\psset{xunit=2} -\begin{pspicture}[showgrid=true](0,0)(8,9) - \psset{showpoints=true} - \psplotDiffEqn[linecolor=red, method=varrkiv, plotpoints=2, varsteptol=.0001, - plotfuncy=dup 6 get dup mul exch 7 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} - \psplotDiffEqn[linecolor=blue, method=varrkiv, plotpoints=2, varsteptol=.0001, - plotfuncy=dup 2 get dup mul exch 3 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,5) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=->,ArrowInsidePos=20](0,0)(3,0)% + (3,3)(1,3)(1,5)(5,5)(5,0)(7,0)(6,3) \end{pspicture} -\captionof{figure}{Gravitational interaction : speeds of the -stars} \egroup -\end{center} +\end{LTXexample} -\begin{lstlisting} -\psset{xunit=2} -\begin{pspicture}[showgrid=true](0,0)(8,9) - \psset{showpoints=true} - \psplotDiffEqn[linecolor=red, method=varrkiv, plotpoints=2, varsteptol=.0001, - plotfuncy=dup 6 get dup mul exch 7 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} - \psplotDiffEqn[linecolor=blue, method=varrkiv, plotpoints=2, varsteptol=.0001, - plotfuncy=dup 2 get dup mul exch 3 get dup mul add sqrt]{0}{8}{\InitCond}{\Grav} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,2) +\psset{arrowscale=2,ArrowFill=true} +\psline[ArrowInside=-|]{<->}(0,2)(2,0)(3,2)(4,0)(6,2) \end{pspicture} -\end{lstlisting} +\end{LTXexample} %-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{Simple equation of first order $y'=y$} +\subsubsection{\nxLcs{pspolygon}} %-------------------------------------------------------------------------------------- +% Polygons (\pspolygon macro) -For the initial value $y(0)=1$ we have the solution $y(x)=e^x$. $y$ is always -on the stack, so we have to do nothing. Using the \Lkeyword{algebraic} option, we write it -as \verb$y[0]$. The following example shows different solutions depending to the number of plotpoints -with $y_0=1$: - - -\begin{center} -\bgroup -\psset{xunit=4, yunit=.4} -\begin{pspicture}(3,19)\psgrid[subgriddiv=1] - \psplot[linewidth=6\pslinewidth, linecolor=green]{0}{3}{Euler x exp} - \psplotDiffEqn[linecolor=magenta,plotpoints=16,algebraic=true]{0}{3}{1}{y[0]} - \psplotDiffEqn[linecolor=blue,plotpoints=151]{0}{3}{1}{} - \psplotDiffEqn[linecolor=red,method=rk4,plotpoints=15]{0}{3}{1}{} - \psplotDiffEqn[linecolor=Orange,method=rk4,plotpoints=4]{0}{3}{1}{} - \psset{linewidth=4\pslinewidth} - \rput*(0.35,19){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](0.35,19){\small Euler order 1 $h=0{,}2$} - \rput*(0.35,17){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](0.35,17){\small Euler order 1 $h=0{,}02$} - \rput*(0.35,15){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](0.35,15){\small RK ordre 4 $h=1$} - \rput*(0.35,13){\psline[linecolor=red](-.75cm,0)} - \rput*[l](0.35,13){\small RK ordre 4 $h=0{,}2$} - \rput*(0.35,11){\psline[linecolor=green](-.75cm,0)} - \rput*[l](0.35,11){\small solution exacte} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,3) +\psset{arrowscale=2} +\pspolygon[ArrowInside=-|](0,0)(3,3)(6,3)(6,1) \end{pspicture} -\egroup -\end{center} +\end{LTXexample} -\begin{lstlisting} -\psset{xunit=4, yunit=.4} -\begin{pspicture}(3,19)\psgrid[subgriddiv=1] - \psplot[linewidth=6\pslinewidth, linecolor=green]{0}{3}{Euler x exp} - \psplotDiffEqn[linecolor=magenta,plotpoints=16,algebraic=true]{0}{3}{1}{y[0]} - \psplotDiffEqn[linecolor=blue,plotpoints=151]{0}{3}{1}{} - \psplotDiffEqn[linecolor=red,method=rk4,plotpoints=15]{0}{3}{1}{} - \psplotDiffEqn[linecolor=Orange,method=rk4,plotpoints=4]{0}{3}{1}{} - \psset{linewidth=4\pslinewidth} - \rput*(0.35,19){\psline[linecolor=magenta](-.75cm,0)} - \rput*[l](0.35,19){\small Euler order 1 $h=0{,}2$} - \rput*(0.35,17){\psline[linecolor=blue](-.75cm,0)} - \rput*[l](0.35,17){\small Euler order 1 $h=0{,}02$} - \rput*(0.35,15){\psline[linecolor=Orange](-.75cm,0)} - \rput*[l](0.35,15){\small RK ordre 4 $h=1$} - \rput*(0.35,13){\psline[linecolor=red](-.75cm,0)} - \rput*[l](0.35,13){\small RK ordre 4 $h=0{,}2$} - \rput*(0.35,11){\psline[linecolor=green](-.75cm,0)} - \rput*[l](0.35,11){\small solution exacte} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,3) +\psset{arrowscale=2} +\pspolygon[ArrowInside=->,ArrowInsidePos=0.25]% + (0,0)(3,3)(6,3)(6,1) \end{pspicture} -\end{lstlisting} - -%-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{$y'=\displaystyle\frac{2-ty}{4-t^2}$}% $ -%-------------------------------------------------------------------------------------- +\end{LTXexample} -For the initial value $y(0)=1$ the exact solution is -$y(x)=\displaystyle\frac{t+\sqrt{4-t^2}}{2}$. The function $f$ -described in PostScript code is like (y is still on the stack): -\begin{lstlisting}[style=syntax] -x %% y x -mul %% x*y -2 exch sub %% 2-x*y -4 x dup mul %% 2-x*y 4 x^2 -sub %% 2-x*y 4-x^2 -div %% (2-x*y)/(4-x^2) -\end{lstlisting} -\noindent -The following example uses $y_0=1$. +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,3) +\psset{arrowscale=2} +\pspolygon[ArrowInside=->,ArrowInsideNo=4]% + (0,0)(3,3)(6,3)(6,1) +\end{pspicture} +\end{LTXexample} -\begin{lstlisting}[style=syntax] -\newcommand{\InitCond}{1} -\newcommand{\Func}{x mul 2 exch sub 4 x dup mul sub div} -\newcommand{\FuncAlg}{(2-x*y[0])/(4-x^2)} -\end{lstlisting} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,3) +\psset{arrowscale=2} +\pspolygon[ArrowInside=->,ArrowInsideNo=4,% + ArrowInsideOffset=0.1](0,0)(3,3)(6,3)(6,1) +\end{pspicture} +\end{LTXexample} -\begin{center} -\bgroup -\psset{xunit=6.4, yunit=9.6, showpoints=false} -\begin{pspicture}(0,1)(2,1.5) \psgrid[griddots=10](0,1)(2,1.5) - { \psset{linewidth=4\pslinewidth,linecolor=lightgray} - \psplot{0}{1.8}{x dup dup mul 4 exch sub sqrt add 2 div} - \psplot{1.8}{2}{x dup dup mul 4 exch sub sqrt add 2 div} } - \def\InitCond{1} - \def\Func{x mul 2 exch sub 4 x dup mul sub div} - \psplotDiffEqn[linecolor=magenta, plotpoints=20]{0}{1.9}{\InitCond}{\Func} - \psplotDiffEqn[linecolor=blue, plotpoints=191]{0}{1.9}{\InitCond}{\Func} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11,% - algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} - \psplotDiffEqn[linecolor=Orange, method=rk4, plotpoints=21,% - algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} - \psset{linewidth=4\pslinewidth}\small - \rput*(0,1.4){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](0,1.4){Euler order 1 $h=0{,}1$} - \rput*(0,1.35){\psline[linecolor=blue](-.75cm,0)}\rput*[l](0,1.35){Euler order 1 $h=0{,}01$} - \rput*(0,1.3){\psline[linecolor=Orange](-.75cm,0)}\rput*[l](0,1.3){RK order 4 $h=0{,}19$} - \rput*(0,1.25){\psline[linecolor=red](-.75cm,0)}\rput*[l](0,1.25){RK order 4 $h=0{,}095$} - \rput*(0,1.2){\psline[linecolor=lightgray](-.75cm,0)}\rput*[l](0,1.2){exactly} +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,3) +\psset{arrowscale=2} + \pspolygon[ArrowInside=-|](0,0)(3,3)(6,3)(6,1) + \psset{linestyle=none,ArrowInside=-*} + \pspolygon[ArrowInsidePos=0](0,0)(3,3)(6,3)(6,1) + \pspolygon[ArrowInsidePos=1](0,0)(3,3)(6,3)(6,1) + \psset{ArrowInside=-o} + \pspolygon[ArrowInsidePos=0.25](0,0)(3,3)(6,3)(6,1) + \pspolygon[ArrowInsidePos=0.75](0,0)(3,3)(6,3)(6,1) \end{pspicture} -\egroup -\end{center} +\end{LTXexample} -\begin{lstlisting}[xrightmargin=-1cm,xleftmargin=-1cm] -\psset{xunit=6.4, yunit=9.6, showpoints=false} -\begin{pspicture}(0,1)(2,1.7) \psgrid[subgriddiv=5] - { \psset{linewidth=4\pslinewidth,linecolor=lightgray} - \psplot{0}{1.8}{x dup dup mul 4 exch sub sqrt add 2 div} - \psplot{1.8}{2}{x dup dup mul 4 exch sub sqrt add 2 div} } - \def\InitCond{1} - \def\Func{x mul 2 exch sub 4 x dup mul sub div} - \psplotDiffEqn[linecolor=magenta, plotpoints=20]{0}{1.9}{\InitCond}{\Func} - \psplotDiffEqn[linecolor=blue, plotpoints=191]{0}{1.9}{\InitCond}{\Func} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11,% - algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} - \psplotDiffEqn[linecolor=Orange, method=rk4, plotpoints=21,% - algebraic=true]{0}{1.9}{\InitCond}{(2-x*y[0])/(4-x^2)} - \psset{linewidth=4\pslinewidth} - \rput*(0.3,1.6){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](0.3,1.6){\small Euler order 1 $h=0{,}1$} - \rput*(0.3,1.55){\psline[linecolor=blue](-.75cm,0)}\rput*[l](0.3,1.55){\small Euler order 1 $h=0{,}01$} - \rput*(0.3,1.5){\psline[linecolor=Orange](-.75cm,0)}\rput*[l](0.3,1.5){\small RK order 4 $h=0{,}19$} - \rput*(0.3,1.45){\psline[linecolor=red](-.75cm,0)}\rput*[l](0.3,1.45){\small RK order 4 $h=0{,}095$} - \rput*(0.3,1.4){\psline[linecolor=lightgray](-.75cm,0)}\rput*[l](0.3,1.4){\small exactly} +\psset{linestyle=solid} + +\begin{LTXexample}[width=6.5cm] +\begin{pspicture}(6,5) +\psset{arrowscale=2} + \pspolygon[ArrowInside=->,ArrowInsidePos=20]% + (0,0)(3,0)(3,3)(1,3)(1,5)(5,5)(5,0)(7,0)(6,3) \end{pspicture} -\end{lstlisting} +\end{LTXexample} %-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{$y'=-2xy$} +\subsubsection{\nxLcs{psbezier}} %-------------------------------------------------------------------------------------- +% Bezier curves (\psbezier macro) -For $y(-1)=\frac{1}{e}$ we get $y(x)=e^{-x^2}$. -\begin{center} -\bgroup -\psset{unit=4} -\begin{pspicture}(-1,0)(3,1.1)\psgrid - \psplot[linewidth=4\pslinewidth,linecolor=gray]{-1}{3}{Euler x dup mul neg exp} - \psset{plotpoints=9} - \psplotDiffEqn[linecolor=cyan]{-1}{3}{1 Euler div}{x -2 mul mul} - \psplotDiffEqn[linecolor=yellow, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} - \psset{plotpoints=21} - \psplotDiffEqn[linecolor=blue]{-1}{3}{1 Euler div}{x -2 mul mul} - \psplotDiffEqn[linecolor=Orange, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} - \psset{linewidth=2\pslinewidth} - \rput*(2,1){\psline[linecolor=Orange](-0.25,0)} - \rput*[l](2,1){RK} - \rput*(2,.9){\psline[linecolor=blue](-0.25,0)} - \rput*[l](2,.9){\textsc{Euler}-1} - \rput*(2,.8){\psline[linecolor=gray](-0.25,0)} - \rput*[l](2,.8){solution} +\begin{LTXexample}[width=3.5cm] +\begin{pspicture}(3,3) +\psset{arrowscale=2} + \psbezier[ArrowInside=-|](0,1)(1,0)(2,1)(3,3) + \psset{linestyle=none,ArrowInside=-o} + \psbezier[ArrowInsidePos=0.25](0,1)(1,0)(2,1)(3,3) + \psbezier[ArrowInsidePos=0.75](0,1)(1,0)(2,1)(3,3) + \psset{linestyle=none,ArrowInside=-*} + \psbezier[ArrowInsidePos=0](0,1)(1,0)(2,1)(3,3) + \psbezier[ArrowInsidePos=1](0,1)(1,0)(2,1)(3,3) \end{pspicture} -\egroup -\end{center} +\end{LTXexample} -\begin{lstlisting} -\psset{unit=4} -\begin{pspicture}(-1,0)(3,1.1)\psgrid - \psplot[linewidth=4\pslinewidth,linecolor=gray]{-1}{3}{Euler x dup mul neg exp} - \psset{plotpoints=9} - \psplotDiffEqn[linecolor=cyan]{-1}{3}{1 Euler div}{x -2 mul mul} - \psplotDiffEqn[linecolor=yellow, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} - \psset{plotpoints=21} - \psplotDiffEqn[linecolor=blue]{-1}{3}{1 Euler div}{x -2 mul mul} - \psplotDiffEqn[linecolor=Orange, method=rk4]{-1}{3}{1 Euler div}{x -2 mul mul} - \psset{linewidth=2\pslinewidth} - \rput*(2,1){\psline[linecolor=Orange](-0.25,0)} - \rput*[l](2,1){RK} - \rput*(2,.9){\psline[linecolor=blue](-0.25,0)} - \rput*[l](2,.9){\textsc{Euler}-1} - \rput*(2,.8){\psline[linecolor=gray](-0.25,0)} - \rput*[l](2,.8){solution} + +\resetOptions +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,3) +\psset{arrowscale=2} +\psbezier[ArrowInside=->,showpoints]% + {*-*}(0,0)(2,3)(3,0)(4,2) +\end{pspicture} +\end{LTXexample} + + + + +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,3) +\psset{arrowscale=2} + \psbezier[ArrowInside=->,showpoints=true, + ArrowInsideNo=2](0,0)(2,3)(3,0)(4,2) \end{pspicture} -\end{lstlisting} +\end{LTXexample} -%-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{Spiral of Cornu} -%-------------------------------------------------------------------------------------- +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,3) +\psset{arrowscale=2} + \psbezier[ArrowInside=->,showpoints=true, + ArrowInsideNo=2,ArrowInsideOffset=-0.2]% + {->}(0,0)(2,3)(3,0)(4,2) +\end{pspicture} +\end{LTXexample} -The integrals of \Index{Fresnel}: -\begin{align} x & =\int^t_0\cos\frac{\pi t^2}{2}\mathrm{d}t \\ - y & =\int^t_0\sin\frac{\pi t^2}{2}\mathrm{d}t \\ -\intertext{with} - \dot{x} &= \cos\frac{\pi t^2}{2} \\ - \dot{y} & =\sin\frac{\pi t^2}{2} - \end{align} -\begin{lstlisting} -\psset{unit=8} -\begin{pspicture}(1,1)\psgrid[subgriddiv=5] - \psplotDiffEqn[whichabs=0,whichord=1,linecolor=red,method=rk4,algebraic,% - plotpoints=500,showpoints=true]{0}{10}{0 0}{cos(Pi*x^2/2)|sin(Pi*x^2/2)} +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}(5,3) +\psset{arrowscale=2} + \psbezier[ArrowInsideNo=9,ArrowInside=-|,% + showpoints=true]{*-*}(0,0)(1,3)(3,0)(5,3) \end{pspicture} -\end{lstlisting} +\end{LTXexample} +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,3) +\psset{arrowscale=2} + \psset{ArrowInside=-|} + \psbezier[ArrowInsidePos=0.25,showpoints=true]{*-*}(2,3)(3,0)(4,2) + \psset{linestyle=none} + \psbezier[ArrowInsidePos=0.75](0,0)(2,3)(3,0)(4,2) +\end{pspicture} +\end{LTXexample} -\begin{center} -\bgroup -\psset{unit=8} -\begin{pspicture}(1,1)\psgrid[subgriddiv=5] - \psplotDiffEqn[whichabs=0,whichord=1,linecolor=red,method=rk4,algebraic,% - plotpoints=500,showpoints=true]{0}{10}{0 0}{cos(Pi*x^2/2)|sin(Pi*x^2/2)} +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}(5,6) +\psset{arrowscale=2} + \pnode(3,4){A}\pnode(5,6){B}\pnode(5,0){C} + \psbezier[ArrowInside=->,% + showpoints=true](A)(B)(C) + \psset{linestyle=none,ArrowInside=-<} + \psbezier[ArrowInsideNo=4](0,0)(A)(B)(C) + \psset{ArrowInside=-o} + \psbezier[ArrowInsidePos=0.1](0,0)(A)(B)(C) + \psbezier[ArrowInsidePos=0.9](0,0)(A)(B)(C) + \psset{ArrowInside=-*} + \psbezier[ArrowInsidePos=0.3](0,0)(A)(B)(C) + \psbezier[ArrowInsidePos=0.7](0,0)(A)(B)(C) \end{pspicture} -\egroup -\end{center} +\end{LTXexample} + +\psset{linestyle=solid} + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-3,-5)(15,5) + \psbezier[ArrowInsideNo=19,% + ArrowInside=->,ArrowFill=false,% + showpoints=true]{->}(-3,0)(5,-5)(8,5)(15,-5) +\end{pspicture} +\end{LTXexample} %-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{Lotka-Volterra} +\subsubsection{\nxLcs{pcline}} %-------------------------------------------------------------------------------------- +These examples need the package \verb|pst-node|. -The Lotka-Volterra model describes interactions between two species in an ecosystem, a -predator and a prey. This represents our first multi-species model. Since we are considering -two species, the model will involve two equations, one which describes how the prey -population changes and the second which describes how the predator population changes. - -For concreteness let us assume that the prey in our model are rabbits, and that the -predators are foxes. If we let $R(t)$ and $F(t)$ represent the number of rabbits and -foxes, respectively, that are alive at time t, then the Lotka-Volterra model is: -% -\begin{align} -\dot R &= a\cdot R - b\cdot R\cdot F\\ -\dot F &= e\cdot b\cdot R\cdot F - c\cdot F -\end{align} -% -where the parameters are defined by: -\begin{description} -\item[a] is the natural growth rate of rabbits in the absence of predation, -\item[c] is the natural death rate of foxes in the absence of food (rabbits), -\item[b] is the death rate per encounter of rabbits due to predation, -\item[e] is the efficiency of turning predated rabbits into foxes. -\end{description} +% Lines (\pcline macro) +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,1) +\psset{arrowscale=2} +\pcline[ArrowInside=->](0,0)(2,1) +\end{pspicture} +\end{LTXexample} -The Stella model representing the \Index{Lotka-Volterra} model will be slightly more complex than the -single species models we've dealt with before. The main difference is that our model will have -two stocks (reservoirs), one for each species. Each species will have its own birth and death -rates. In addition, the Lotka-Volterra model involves four parameters rather than two. All told, -the Stella representation of the Lotka-Volterra model will use two stocks, four flows, four -converters and many connectors. -\bgroup -\begin{center} -\def\InitCond{ 0 10 10}%% xa ya xl -\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vlapin} -\def\Vlapin{1} \def\Vaigle{1.6} -\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic,% - plotpoints=20,showpoints=true} -\begin{pspicture}[showgrid=true](-3,-3)(10,10) - \psplotDiffEqn[plotfuncy=pop 0,whichabs=2,linecolor=red]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[whichabs=0,whichord=1,linecolor=black,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[whichabs=0,whichord=1,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,1) +\psset{arrowscale=2} +\pcline[ArrowInside=->]{<->}(0,0)(2,1) \end{pspicture} -\end{center} +\end{LTXexample} -\begin{lstlisting}[label={fig:aiglelapin},xrightmargin=-1.5cm] -\def\InitCond{ 0 10 10}%% xa ya xl -\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vlapin} -\def\Vlapin{1} \def\Vaigle{1.6} -\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic,% - plotpoints=20,showpoints=true} -\begin{pspicture}[showgrid=true](-3,-3)(10,10) - \psplotDiffEqn[plotfuncy=pop 0,whichabs=2,linecolor=red]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[whichabs=0,whichord=1,linecolor=black,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[whichabs=0,whichord=1,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} + +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,1) +\psset{arrowscale=2} +\pcline[ArrowInside=-|,ArrowInsidePos=0.75]{|-|}(0,0)(2,1) \end{pspicture} -\end{lstlisting} +\end{LTXexample} -\begin{center} -\def\InitCond{ 0 10 10}%% xa ya xl -\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vlapin} -\def\Vlapin{1} \def\Vaigle{1.6} -\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic,% - plotpoints=20,showpoints=true} -\begin{pspicture}[showgrid=true](0,-0.25)(10,14) - \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup - mul add sqrt,linecolor=red,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup - mul add sqrt,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[plotfuncy=pop Func aload pop pop dup mul exch dup mul add sqrt, - linecolor=yellow]{0}{10}{\InitCond}{\Faiglelapin} -\end{pspicture} -\end{center} -\egroup +\begin{LTXexample}[width=2.5cm] +\psset{arrowscale=2} +\pcline[ArrowInside=->,ArrowInsidePos=0.65]{*-*}(0,0)(2,0) +\naput[labelsep=0.3]{\large$g$} +\end{LTXexample} + + +\begin{LTXexample}[width=2.5cm] +\psset{arrowscale=2} +\pcline[ArrowInside=->,ArrowInsidePos=10]{|-|}(0,0)(2,0) +\naput[labelsep=0.3]{\large$l$} +\end{LTXexample} -\begin{lstlisting}[label={fig:aiglelapin},xrightmargin=-1.5cm] -\def\InitCond{ 0 10 10}%% xa ya xl -\def\Faiglelapin{\Vaigle*(y[2]-y[0])/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vaigle*y[1]/sqrt(y[1]^2+(y[2]-y[0])^2)|% - -\Vlapin} -\def\Vlapin{1} \def\Vaigle{1.6} -\psset{unit=.7,subgriddiv=0,gridcolor=lightgray,method=adams,algebraic,% - plotpoints=20,showpoints=true} -\begin{pspicture}[showgrid=true](10,12) - \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup - mul add sqrt,linecolor=red,method=rk4]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[plotfuncy=dup 1 get dup mul exch dup 0 get exch 2 get sub dup - mul add sqrt,linecolor=blue]{0}{10}{\InitCond}{\Faiglelapin} - \psplotDiffEqn[plotfuncy=pop Func aload pop pop dup mul exch dup mul add sqrt, - linecolor=yellow]{0}{10}{\InitCond}{\Faiglelapin} -\end{pspicture} -\end{lstlisting} %-------------------------------------------------------------------------------------- -\subsubsection{$y''=y$} +\subsubsection{\nxLcs{pccurve}} %-------------------------------------------------------------------------------------- +These examples also need the package \verb|pst-node|. -Beginning with the initial equation $\displaystyle y(x)=Ae^x+Be^{-x}$ we get the hyperbolic -trigonometrical functions. - -\begin{center} -\bgroup -\def\Funct{exch} \psset{xunit=5cm, yunit=0.75cm} -\begin{pspicture}(0,-0.25)(2,7)\psgrid[subgriddiv=1,griddots=10] - \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler x exp} %%e^x - \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 1}{\Funct} - \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 1}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 1}{\Funct} - \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp %%ch(x) - exch x neg exp add 2 div} - \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 0}{\Funct} - \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 0}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 0}{\Funct} - \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp - exch x neg exp sub 2 div} %%sh(x) - \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{0 1}{\Funct} - \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{0 1}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{0 1}{\Funct} - \rput*(1.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](1.3,.9){\small\textsc{Euler} order 1 $h=1$} - \rput*(1.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](1.3,.8){\small\textsc{Euler} order 1 $h=0{,}1$} - \rput*(1.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](1.3,.7){\small RK order 4 $h=1$} - \rput*(1.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](1.3,.6){\small exact solution} +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,2) +\psset{arrowscale=2} +\pccurve[ArrowInside=->,ArrowInsidePos=0.65,showpoints=true]{*-*}(0,0)(2,2) +\naput[labelsep=0.3]{\large$h$} \end{pspicture} -\egroup -\end{center} +\end{LTXexample} -\begin{lstlisting}[label={fig:minusexp},xrightmargin=-1.5cm] -\def\Funct{exch} \psset{xunit=5cm, yunit=0.75cm} -\begin{pspicture}(0,-0.25)(2,7)\psgrid[subgriddiv=1,griddots=10] - \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler x exp} %%e^x - \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 1}{\Funct} - \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 1}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 1}{\Funct} - \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp %%ch(x) - exch x neg exp add 2 div} - \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{1 0}{\Funct} - \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{1 0}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{1 0}{\Funct} - \psplot[linewidth=4\pslinewidth, linecolor=green]{0}{2}{Euler dup x exp - exch x neg exp sub 2 div} %%sh(x) - \psplotDiffEqn[linecolor=magenta, plotpoints=11]{0}{2}{0 1}{\Funct} - \psplotDiffEqn[linecolor=blue, plotpoints=101]{0}{2}{0 1}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=11]{0}{2}{0 1}{\Funct} - \rput*(1.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](1.3,.9){\small\textsc{Euler} order 1 $h=1$} - \rput*(1.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](1.3,.8){\small\textsc{Euler} order 1 $h=0{,}1$} - \rput*(1.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](1.3,.7){\small RK order 4 $h=1$} - \rput*(1.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](1.3,.6){\small exact solution} + +\begin{LTXexample}[width=2.5cm] +\begin{pspicture}(2,2) +\psset{arrowscale=2} +\pccurve[ArrowInside=->,ArrowInsideNo=3,showpoints=true]{|->}(0,0)(2,2) +\naput[labelsep=0.3]{\large$i$} \end{pspicture} -\end{lstlisting} +\end{LTXexample} + + +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,4) +\psset{arrowscale=2} +\pccurve[ArrowInside=->,ArrowInsidePos=20]{|-|}(0,0)(4,4) +\naput[labelsep=0.3]{\large$k$} +\end{pspicture} +\end{LTXexample} -%-------------------------------------------------------------------------------------- \clearpage -\subsubsection{$y''=-y$} -%-------------------------------------------------------------------------------------- + +\subsection{Special arrows \texttt{v--V},\texttt{t--T}, and \texttt{f--F}} + +Possible optional arguments are + +\psset{linecolor=black} + \begin{center} -\bgroup -\def\Funct{exch neg} -\psset{xunit=1, yunit=4} -\def\quatrepi{12.5663706144}%%4pi=12.5663706144 -\begin{pspicture}(0,-1.25)(\quatrepi,1.25)\psgrid[subgriddiv=1,griddots=10] - \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg cos}%%cos(x) - \psplotDiffEqn[linecolor=blue, plotpoints=201]{0}{3.1415926}{1 0}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=31]{0}{\quatrepi}{1 0}{\Funct} - \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg sin} %%sin(x) - \psplotDiffEqn[linecolor=blue,plotpoints=201]{0}{3.1415926}{0 1}{\Funct} - \psplotDiffEqn[linecolor=red,method=rk4, plotpoints=31]{0}{\quatrepi}{0 1}{\Funct} - \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](3.3,.9){\small Euler order 1 $h=1$} - \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](3.3,.8){\small Euler order 1 $h=0{,}1$} - \rput*(3.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](3.3,.7){\small RK order 4 $h=1$} - \rput*(3.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](3.3,.6){\small exact solution} -\end{pspicture} -\egroup +\begin{tabular}{l|l} +name & meaning\\\hline +\Lkeyword{veearrowlength} & default is 3mm\\ +\Lkeyword{veearrowangle} & default is 30\\ +\Lkeyword{veearrowlinewidth} & default is 0.35mm\\ +\Lkeyword{filledveearrowlength} & default is 3mm\\ +\Lkeyword{filledveearrowangle} & default is 15\\ +\Lkeyword{filledveearrowlinewidth} & default is 0.35mm\\ +\Lkeyword{tickarrowlength} & default is 1.5mm\\ +\Lkeyword{tickarrowlinewidth} & default is 0.35mm\\ +\end{tabular} \end{center} -\begin{lstlisting}[label={fig:minusexp2}] -\def\Funct{exch neg} -\psset{xunit=1, yunit=4} -\def\quatrepi{12.5663706144}%%4pi=12.5663706144 -\begin{pspicture}(0,-1.25)(\quatrepi,1.25)\psgrid[subgriddiv=1,griddots=10] - \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg cos}%%cos(x) - \psplotDiffEqn[linecolor=blue, plotpoints=201]{0}{3.1415926}{1 0}{\Funct} - \psplotDiffEqn[linecolor=red, method=rk4, plotpoints=31]{0}{\quatrepi}{1 0}{\Funct} - \psplot[linewidth=4\pslinewidth,linecolor=green]{0}{\quatrepi}{x RadtoDeg sin} %%sin(x) - \psplotDiffEqn[linecolor=blue,plotpoints=201]{0}{3.1415926}{0 1}{\Funct} - \psplotDiffEqn[linecolor=red,method=rk4, plotpoints=31]{0}{\quatrepi}{0 1}{\Funct} - \rput*(3.3,.9){\psline[linecolor=magenta](-.75cm,0)}\rput*[l](3.3,.9){\small Euler order 1 $h=1$} - \rput*(3.3,.8){\psline[linecolor=blue](-.75cm,0)}\rput*[l](3.3,.8){\small Euler order 1 $h=0{,}1$} - \rput*(3.3,.7){\psline[linecolor=red](-.75cm,0)}\rput*[l](3.3,.7){\small RK order 4 $h=1$} - \rput*(3.3,.6){\psline[linecolor=green](-.75cm,0)}\rput*[l](3.3,.6){\small exact solution} + +\begin{LTXexample}[width=4cm] +\psset{unit=5mm} +\begin{pspicture}(4,6) + \psset{dimen=middle,arrows=c-c, + arrowscale=2,linewidth=.25mm} + \psline[linecolor=red,linewidth=.05mm](0,0)(0,6) + \psline[linecolor=red,linewidth=.05mm](4,0)(4,6) + \psline{v-v}(0,6)(4,6) + \psline{v-V}(0,4)(4,4) + \psline{V-v}(0,2)(4,2) + \psline{V-V}(0,0)(4,0) \end{pspicture} -\end{lstlisting} +\end{LTXexample} -%-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{The mechanical pendulum: $y''=-\frac{g}{l}\sin(y)$}% $ -%-------------------------------------------------------------------------------------- -For small \Index{oscillation}s $\sin(y)\simeq y$: +\begin{LTXexample}[width=4cm] +\psset{unit=5mm} +\begin{pspicture}(4,6) + \psset{dimen=middle,arrows=c-c, + arrowscale=2,linewidth=.25mm} + \psline[linecolor=red,linewidth=.05mm](0,0)(0,6) + \psline[linecolor=red,linewidth=.05mm](4,0)(4,6) + \psline{f-f}(0,6)(4,6) + \psline{f-F}(0,4)(4,4) + \psline{F-f}(0,2)(4,2) + \psline{F-F}(0,0)(4,0) +\end{pspicture} +\end{LTXexample} -\[ y(x)=y_0\cos\left(\sqrt{\frac{g}{l}}x\right) \] -The function $f$ is written in PostScript code: +\begin{LTXexample}[width=4cm] +\psset{unit=5mm} +\begin{pspicture}(4,6) + \psset{dimen=middle,arrows=c-c,linewidth=.25mm} + \psline[linecolor=red,linewidth=.05mm](0,0)(0,6) + \psline[linecolor=red,linewidth=.05mm](4,0)(4,6) + \psline{t-t}(0,6)(4,6) + \psline{t-T}(0,4)(4,4) + \psline{T-t}(0,2)(4,2) + \psline{T-T}(0,0)(4,0) +\end{pspicture} +\end{LTXexample} -\begin{lstlisting}[style=syntax] -exch RadtoDeg sin -9.8 mul %% y' -gsin(y) -\end{lstlisting} +\subsection{Special arrow option \texttt{arrowLW}} -\begin{center} -\bgroup -\def\Func{y[1]|-9.8*sin(y[0])} -\psset{yunit=2,xunit=4,algebraic=true,linewidth=1.5pt} -\begin{pspicture}(0,-2.25)(3,2.25) - \psaxes{->}(0,0)(0,-2)(3,2) - \psplot[linewidth=3\pslinewidth, linecolor=Orange]{0}{3}{.1*cos(sqrt(9.8)*x)} - \psset{method=rk4,plotpoints=50,linecolor=blue} - \psplotDiffEqn{0}{3}{.1 0}{\Func} - \psplot[linewidth=3\pslinewidth,linecolor=Orange]{0}{3}{.25*cos(sqrt(9.8)*x)} - \psplotDiffEqn{0}{3}{.25 0}{\Func} - \psplotDiffEqn{0}{3}{.5 0}{\Func} - \psplotDiffEqn{0}{3}{1 0}{\Func} - \psplotDiffEqn[plotpoints=100]{0}{3}{Pi 2 div 0}{\Func} -\end{pspicture} -\egroup -\end{center} +Only for the arrowtype \Lnotation{o} and \Lnotation{*} it is possible to +set the arrowlinewidth with the optional keyword \Lkeyword{arrowLW}. +When scaling an arrow by the keyword \Lkeyword{arrowscale} the width +of the borderline is also scaled. With the optional argument +\Lkeyword{arrowLW} the line width can be set separately and is not +taken into account by the scaling value. -\begin{lstlisting}[label=fig:second] -\def\Func{y[1]|-9.8*sin(y[0])} -\psset{yunit=2,xunit=4,algebraic=true,linewidth=1.5pt} -\begin{pspicture}(0,-2.25)(3,2.25) - \psaxes{->}(0,0)(0,-2)(3,2) - \psplot[linewidth=3\pslinewidth, linecolor=Orange]{0}{3}{.1*cos(sqrt(9.8)*x)} - \psset{method=rk4,plotpoints=50,linecolor=blue} - \psplotDiffEqn{0}{3}{.1 0}{\Func} - \psplot[linewidth=3\pslinewidth,linecolor=Orange]{0}{3}{.25*cos(sqrt(9.8)*x)} - \psplotDiffEqn{0}{3}{.25 0}{\Func} - \psplotDiffEqn{0}{3}{.5 0}{\Func} - \psplotDiffEqn{0}{3}{1 0}{\Func} - \psplotDiffEqn[plotpoints=100]{0}{3}{Pi 2 div 0}{\Func} +\begin{LTXexample}[width=4cm] +\begin{pspicture}(4,6) +\psline[arrowscale=3,arrows=*-o](0,5)(4,5) +\psline[arrowscale=3,arrows=*-o, + arrowLW=0.5pt](0,3)(4,3) +\psline[arrowscale=3,arrows=*-o, + arrowLW=0.3333\pslinewidth](0,1)(4,1) \end{pspicture} -\end{lstlisting} +\end{LTXexample} + + %-------------------------------------------------------------------------------------- -\clearpage -\subsubsection{$y''=-\frac{y'}{4}-2y$}% $ +\section{Transparent colors} %-------------------------------------------------------------------------------------- -For $y_0=5$ and $y'_0=0$ the solution is: +Transparency is now part of the main \texttt{pstricks} package. +But pay attention, the names and syntax have changed and you need +to run \Lprog{ps2pdf} with the option +\Loption{-dCompatibilityLevel}=1.4. -\[ -5e^{-\frac{x}{8}}\left(\cos\left(\omega x\right)+\frac{\sin(\omega x)}{8\omega}\right) -\mbox{ avec } \omega=\frac{\sqrt{127}}{8} -\] -\begin{center} -\bgroup -\psset{xunit=.6,yunit=0.8,plotpoints=500} -\begin{pspicture}(0,-4.25)(26,5.25) - \psaxes{->}(0,0)(0,-4)(26,5) - \psplot[plotpoints=200,linewidth=4\pslinewidth,linecolor=gray]{0}{26}{% - Euler x -8 div exp x 127 sqrt 8 div mul RadtoDeg dup cos 5 mul exch sin 127 sqrt div 5 mul add mul} - \psplotDiffEqn[linecolor=red,linewidth=5\pslinewidth]{0}{26}{5 0} - {dup 3 1 roll -4 div exch 2 mul sub} - \psplotDiffEqn[linecolor=black,algebraic]{0}{26}{5 0} {y[1]|-y[1]/4-2*y[0]} - \psset{method=rk4, plotpoints=50} - \psplotDiffEqn[linecolor=blue,linewidth=5\pslinewidth]{0}{26}{5 0}{% - dup 3 1 roll -4 div exch 2 mul sub} - \psplotDiffEqn[linecolor=black,algebraic=true]{0}{26}{5 0}{y[1]|-y[1]/4-2*y[0]} -\end{pspicture} -\egroup -\end{center} +%-------------------------------------------------------------------------------------- +\section{,,Manipulating transparent colors''} +%-------------------------------------------------------------------------------------- +\LPack{pstricks-add} supports real transparency and a simulated one with hatch lines: \begin{lstlisting} -\psset{xunit=.6,yunit=0.8,plotpoints=500} -\begin{pspicture}(0,-4.25)(26,5.25) - \psaxes{->}(0,0)(0,-4)(26,5) - \psplot[plotpoints=200,linewidth=4\pslinewidth,linecolor=gray]{0}{26}{% - Euler x -8 div exp x 127 sqrt 8 div mul RadtoDeg dup cos 5 mul exch sin 127 sqrt div 5 mul add mul} - \psplotDiffEqn[linecolor=red,linewidth=5\pslinewidth]{0}{26}{5 0} - {dup 3 1 roll -4 div exch 2 mul sub} - \psplotDiffEqn[linecolor=black,algebraic]{0}{26}{5 0} {y[1]|-y[1]/4-2*y[0]} - \psset{method=rk4, plotpoints=50} - \psplotDiffEqn[linecolor=blue,linewidth=5\pslinewidth]{0}{26}{5 0}{% - dup 3 1 roll -4 div exch 2 mul sub} - \psplotDiffEqn[linecolor=black,algebraic=true]{0}{26}{5 0}{y[1]|-y[1]/4-2*y[0]} -\end{pspicture} +\def\defineTColor{\@ifnextchar[{\defineTColor@i}{\defineTColor@i[]}} +\def\defineTColor@i[#1]#2#3{% transparency "Colors" + \newpsstyle{#2}{% + fillstyle=vlines,hatchwidth=0.1\pslinewidth, + hatchsep=1\pslinewidth,hatchcolor=#3,#1% + }% +} +\defineTColor{TRed}{red} +\defineTColor{TGreen}{green} +\defineTColor{TBlue}{blue} \end{lstlisting} -%-------------------------------------------------------------------------------------- -\clearpage -\section{\nxLcs{psBoxplot}} -%-------------------------------------------------------------------------------------- +There are three predefined "'transparent"` colors \verb+TRed+, +\verb+TGreen+, \verb+TBlue+. They are used as \PST{} styles and +not as colors: -A box-and-whisker plot (often called simply a box plot) is a histogram-like method of -displaying data, invented by John.\,Tukey. The box-and-whisker plot is a box with -ends at the quartiles $Q_1$ and $Q_3$ and has a statistical median M as a horizontal line in -the box. The "`whiskers"* are lines to the farthest points that are not outliers (i.e., -that are within 3/2 times the interquartile range of $Q_1$ and $Q_3$). Then, for every point -more than 3/2 times the interquartile range from the end of a box, is a dot. +\bgroup +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(-3,-5)(5,5) +\psframe(-1,-3)(5,5) % objet de base +\psrotate(2,-2){15}{% + \psframe[style=TRed](-1,-3)(5,5)} +\psrotate(2,-2){30}{% + \psframe[style=TGreen](-1,-3)(5,5)} +\psrotate(2,-2){45}{% + \psframe[style=TBlue](-1,-3)(5,5)} +\psframe[linewidth=3pt](-1,-3)(5,5) +\psdots[dotstyle=+,dotangle=45,dotscale=3](2,-2) % centre de la rotation +\end{pspicture} +\end{LTXexample} +\egroup -The only special optional arguments, beside all other which are valid for drawing lines -and filling areas, are \Lkeyword{IQLfactor}, \Lkeyword{barwidth}, and -\Lkeyword{arrowlength}, where the latter is a factor -which is multiplied with the barwidth for the line ends. -The \Lkeyword{IQLfactor}, preset to 1.5, defines the area for the outliers. +%-------------------------------------------------------------------------------------- +\section{Calculated colors} +%-------------------------------------------------------------------------------------- +The \verb+xcolor+ package (version 2.6) has a new feature for defining colors: +\begin{lstlisting}[style=syntax] + \definecolor[ps]{}{}{< PS code >} +\end{lstlisting} -%\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(-1,-1)(12,14) -\psset{yunit=0.1,fillstyle=solid} -\savedata{\data}[100 90 120 115 120 110 100 110 100 90 100 100 120 120 120] -\rput(1,0){\psBoxplot[fillcolor=red!30]{\data}} -\rput(1,105){2001} -\savedata{\data}[90 120 115 116 115 110 90 130 120 120 120 85 100 130 130] -\rput(3,0){\psBoxplot[arrowlength=0.5,fillcolor=blue!30]{\data}} -\rput(3,107){2008} -\savedata{\data}[35 70 90 60 100 60 60 80 80 60 50 55 90 70 70] -\rput(5,0){\psBoxplot[barwidth=40pt,arrowlength=1.2,fillcolor=red!30]{\data}} -\rput(5,65){2001} -\savedata{\data}[60 65 60 75 75 60 50 90 95 60 65 45 45 60 90] -\rput(7,0){\psBoxplot[barwidth=40pt,fillcolor=blue!30]{\data}} -\rput(7,65){2008} -\savedata{\data}[20 20 25 20 15 20 20 25 30 20 20 20 30 30 30] -\rput(9,0){\psBoxplot[fillcolor=red!30]{\data}} -\rput(9,22){2001} -\savedata{\data}[20 30 20 35 35 20 20 60 50 20 35 15 30 20 40] -\rput(11,0){\psBoxplot[fillcolor=blue!30,linestyle=dashed]{\data}} -\rput(11,25){2008} -\psaxes[dy=1cm,Dy=10](0,0)(12,130) +\verb+model+ can be one of the color models, which \PS will +understand, e.g. \verb+rgb+. With this definition the color is +calculated on the \PS side. +\begin{LTXexample}[pos=t,preset=\centering] +\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}% +\psset{unit=1bp} +\begin{pspicture}(0,-30)(400,100) +\multido{\iLAMBDA=0+1}{400}{% + \pstVerb{ + \iLAMBDA\space 379 add dup /lambda exch def + tx@addDict begin wavelengthToRGB end + }% + \psline[linecolor=bl](\iLAMBDA,0)(\iLAMBDA,100)% +} +\psaxes[yAxis=false,Ox=350,dx=50bp,Dx=50]{->}(-29,-10)(420,100) +\uput[-90](420,-10){$\lambda$[\textsf{nm}]} \end{pspicture} -%\end{LTXexample} +\end{LTXexample} -\begin{lstlisting} -\begin{pspicture}(-1,-1)(12,14) -\psset{yunit=0.1,fillstyle=solid} -\savedata{\data}[100 90 120 115 120 110 100 110 100 90 100 100 120 120 120] -\rput(1,0){\psBoxplot[fillcolor=red!30]{\data}} -\rput(1,105){2001} -\savedata{\data}[90 120 115 116 115 110 90 130 120 120 120 85 100 130 130] -\rput(3,0){\psBoxplot[arrowlength=0.5,fillcolor=blue!30]{\data}} -\rput(3,107){2008} -\savedata{\data}[35 70 90 60 100 60 60 80 80 60 50 55 90 70 70] -\rput(5,0){\psBoxplot[barwidth=40pt,arrowlength=1.2,fillcolor=red!30]{\data}} -\rput(5,65){2001} -\savedata{\data}[60 65 60 75 75 60 50 90 95 60 65 45 45 60 90] -\rput(7,0){\psBoxplot[barwidth=40pt,fillcolor=blue!30]{\data}} -\rput(7,65){2008} -\savedata{\data}[20 20 25 20 15 20 20 25 30 20 20 20 30 30 30] -\rput(9,0){\psBoxplot[fillcolor=red!30]{\data}} -\rput(9,22){2001} -\savedata{\data}[20 30 20 35 35 20 20 60 50 20 35 15 30 20 40] -\rput(11,0){\psBoxplot[fillcolor=blue!30,linestyle=dashed]{\data}} -\rput(11,25){2008} -\psaxes[dy=1cm,Dy=10](0,0)(12,130) -\end{pspicture} -\end{lstlisting} +\begin{center} +\newcommand{\Touch}{% +\psframe[linestyle=none,fillstyle=solid,fillcolor=bl,dimen=middle](0.1,0.75)} +\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}% +% Echelle 1cm <-> 40 nm +% 1 nm <-> 0.025 cm +\psframebox[fillstyle=solid,fillcolor=black]{% +\begin{pspicture}(-1,-0.5)(12,1.5) +\multido{\iLAMBDA=380+2}{200}{% + \pstVerb{ + /lambda \iLAMBDA\space def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! lambda 0.025 mul 9.5 sub 0){\Touch} +} +\multido{\n=0+1,\iDiv=380+40}{11}{% + \psline[linecolor=white](\n,0.1)(\n,-0.1) + \uput[270](\n,0){\textbf{\white\iDiv}}} + \psline[linecolor=white]{->}(11,0) + \uput[270](11,0){\textbf{\white$\lambda$(nm)}} +\end{pspicture}} -The next example uses an external file for the data, which must first be read by the -macro \Lcs{readdata}. The next one creates a horizontal boxplot by rotating -the output with $-90$ degrees. +\psframebox[fillstyle=solid,fillcolor=black]{% +\begin{pspicture}(-1,-0.5)(12,1) + \pstVerb{ + /lambda 656 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 656 0.025 mul 9.5 sub 0){\Touch} + \pstVerb{ + /lambda 486 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 486 0.025 mul 9.5 sub 0){\Touch} + \pstVerb{ + /lambda 434 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 434 0.025 mul 9.5 sub 0){\Touch} + \pstVerb{ + /lambda 410 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 410 0.025 mul 9.5 sub 0){\Touch} +\multido{\n=0+1,\iDiv=380+40}{11}{% + \psline[linecolor=white](\n,0.1)(\n,-0.1) + \uput[270](\n,0){\textbf{\white\iDiv}}} + \psline[linecolor=white]{->}(11,0) + \uput[270](11,0){\textbf{\white$\lambda$(nm)}} +\end{pspicture}} -\begin{filecontents}{boxplot.data} -2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 -\end{filecontents} +\Index{Spectrum} of \Index{hydrogen} emission (Manuel Luque) +\end{center} +\begin{lstlisting} +\newcommand{\Touch}{% +\psframe[linestyle=none,fillstyle=solid,fillcolor=bl,dimen=middle](0.1,0.75)} +\definecolor[ps]{bl}{rgb}{tx@addDict begin Red Green Blue end}% +% Echelle 1cm <-> 40 nm +% 1 nm <-> 0.025 cm +\psframebox[fillstyle=solid,fillcolor=black]{% +\begin{pspicture}(-1,-0.5)(12,1.5) +\multido{\iLAMBDA=380+2}{200}{% + \pstVerb{ + /lambda \iLAMBDA\space def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! lambda 0.025 mul 9.5 sub 0){\Touch} +} +\multido{\n=0+1,\iDiv=380+40}{11}{% + \psline[linecolor=white](\n,0.1)(\n,-0.1) + \uput[270](\n,0){\textbf{\white\iDiv}}} + \psline[linecolor=white]{->}(11,0) + \uput[270](11,0){\textbf{\white$\lambda$(nm)}} +\end{pspicture}} -%\begin{LTXexample}[pos=t] -\readdata{\data}{boxplot.data} -\begin{pspicture}(-1,-1)(2,10) -\psset{yunit=0.25,fillstyle=solid} -\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32] -\rput(1,0){\psBoxplot[fillcolor=blue!30]{\data}} -\psaxes[dy=1cm,Dy=4](0,0)(2,35) -\end{pspicture} -% -\begin{pspicture}(-1,-1)(11,2) -\psset{xunit=0.25,fillstyle=solid} -\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32] -\rput{-90}(0,1){\psBoxplot[yunit=0.25,fillcolor=blue!30]{\data}} -\psaxes[dx=1cm,Dx=4](0,0)(35,2) -\end{pspicture} -%\end{LTXexample} +\psframebox[fillstyle=solid,fillcolor=black]{% +\begin{pspicture}(-1,-0.5)(12,1) + \pstVerb{ + /lambda 656 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 656 0.025 mul 9.5 sub 0){\Touch} + \pstVerb{ + /lambda 486 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 486 0.025 mul 9.5 sub 0){\Touch} + \pstVerb{ + /lambda 434 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 434 0.025 mul 9.5 sub 0){\Touch} + \pstVerb{ + /lambda 410 def + lambda + tx@addDict begin wavelengthToRGB end + }% + \rput(! 410 0.025 mul 9.5 sub 0){\Touch} +\multido{\n=0+1,\iDiv=380+40}{11}{% + \psline[linecolor=white](\n,0.1)(\n,-0.1) + \uput[270](\n,0){\textbf{\white\iDiv}}} + \psline[linecolor=white]{->}(11,0) + \uput[270](11,0){\textbf{\white$\lambda$(nm)}} +\end{pspicture}} -\begin{lstlisting} -\readdata{\data}{boxplot.data} -\begin{pspicture}(-1,-1)(2,10) -\psset{yunit=0.25,fillstyle=solid} -\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32] -\rput(1,0){\psBoxplot[fillcolor=blue!30]{\data}} -\psaxes[dy=1cm,Dy=4](0,0)(2,35) -\end{pspicture} -% -\begin{pspicture}(-1,-1)(11,2) -\psset{xunit=0.25,fillstyle=solid} -\savedata{\data}[2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32] -\rput{-90}(0,1){\psBoxplot[yunit=0.25,fillcolor=blue!30]{\data}} -\psaxes[dx=1cm,Dx=4](0,0)(35,2) -\end{pspicture} +Spectrum of hydrogen emission (Manuel Luque) \end{lstlisting} + %-------------------------------------------------------------------------------------- -\clearpage -\section{\nxLcs{psMatrixPlot}} +\section{Gouraud shading} %-------------------------------------------------------------------------------------- -\begin{filecontents}{matrix.data} -/dotmatrix [ % -0 1 1 0 0 0 0 1 1 1 -0 1 1 0 1 1 1 0 1 0 -1 0 1 1 0 0 0 1 1 0 -0 0 1 0 0 0 0 0 1 1 -1 1 1 1 1 0 1 0 0 1 -0 0 1 1 0 1 0 1 1 1 -1 0 0 0 1 1 0 0 0 1 -0 0 0 1 1 1 0 1 1 0 -1 1 0 0 0 0 1 0 0 1 -1 0 1 0 0 1 1 1 0 0 -] def -\end{filecontents} +\begin{quotation} +\Index{Gouraud} shading is a method used in computer graphics to simulate the differing effects of +light and colour across the surface of an object. In practice, Gouraud shading is used to +achieve smooth lighting on low-polygon surfaces without the heavy computational requirements +of calculating lighting for each pixel. The technique was first presented by Henri Gouraud in 1971.\\ +~\hfill{\small \url{http://www.wikipedia.org}} +\end{quotation} +PostScript level 3 supports this kind of shading and it can only +be seen with Acroread 7 or later. The syntax is easy: -This macro allows you to visualize a matrix. The datafile must be -defined as a PostScript matrix named \Lps{dotmatrix}: \begin{lstlisting}[style=syntax] -/dotmatrix [ % <------------ important line -0 1 1 0 0 0 0 1 1 1 -0 1 1 0 1 1 1 0 1 0 -1 0 1 1 0 0 0 1 1 0 -0 0 1 0 0 0 0 0 1 1 -1 1 1 1 1 0 1 0 0 1 -0 0 1 1 0 1 0 1 1 1 -1 0 0 0 1 1 0 0 0 1 -0 0 0 1 1 1 0 1 1 0 -1 1 0 0 0 0 1 0 0 1 -1 0 1 0 0 1 1 1 0 0 -] def % <------------ important line + \psGTriangle(x1,y1)(x2,y2)(x3,y3){color1}{color2}{color3} \end{lstlisting} -Only the value 0 is important, in which case nothing happens, and -for all other cases a dot is printed. The syntax of the macro is: - -\begin{BDef} -\Lcs{psMatrixPlot}\OptArgs\Largb{rows}\Largb{columns}\Largb{data file} -\end{BDef} - -The \Index{matrix} is scanned line by line from the the first one to the -last. In general it appears as a bottom-to-top version of the -above listed matrix, the first row $0\,1\,1\,0\,0\,0\,0\,1\,1\,1$ -is the first plotted line ($y=1$). With the option -\Lkeyword{ChangeOrder}=\true\ it looks exactly like the above view. - -\bgroup -\begin{center} -%\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(-0.5,-0.75)(11,11) - \psaxes{->}(11,11) - \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=magenta]% - {10}{10}{matrix.data} - \psMatrixPlot[dotsize=.5cm,dotstyle=o,ChangeOrder]{10}{10}{matrix.data} -\end{pspicture} -%\end{LTXexample} -\end{center} - -\begin{lstlisting} -\begin{pspicture}(-0.5,-0.75)(11,11) - \psaxes{->}(11,11) - \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=magenta]% - {10}{10}{matrix.data} - \psMatrixPlot[dotsize=.5cm,dotstyle=o,ChangeOrder]{10}{10}{matrix.data} -\end{pspicture} -\end{lstlisting} +\psset{unit=0.75cm} \begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(-0.5,-0.75)(11,11) - \psaxes{->}(11,11) - \psMatrixPlot[dotscale=3,dotstyle=*,linecolor=blue]{10}{8}{matrix.data} +\begin{pspicture}(0,-.25)(10,10) + \psGTriangle(0,0)(5,10)(10,0){red}{green}{blue} \end{pspicture} \end{LTXexample} -\clearpage -With the \Lkeyword{colorType}=1 the data is printed as continous color -in the range of the wavelength. The smallest value of the data array -is set to red and the biggest value is set to violett. All other values -are substituted by the corresponding color of the wavlength. -\Lkeyword{colorType}=2 ist the same, but vice versa -with the color, from violet to red. The following examples uses a 200$\times$200 -matrix data, which is saved as /dotmatrix [...] in the file \LFile{pstricks-add-doc.dat}. - \begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(10,10) - \psMatrixPlot[colorType=1,xStep=0.05,yStep=0.05]{200}{200}{dotmatrix.data} +\begin{pspicture}(0,-.25)(10,10) + \psGTriangle*(0,0)(9,10)(10,3){black}{white!50}{red!50!green!95} \end{pspicture} \end{LTXexample} \begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(10,10) - \psMatrixPlot[colorType=2,xStep=0.05,yStep=0.05]{200}{200}{dotmatrix.data} +\begin{pspicture}(0,-.25)(10,10) + \psGTriangle*(0,0)(5,10)(10,0){-red!100!green!84!blue!86} + {-red!80!green!100!blue!40} + {-red!60!green!30!blue!100} \end{pspicture} \end{LTXexample} -\egroup - -%-------------------------------------------------------------------------------------- -\clearpage -\section{\nxLcs{psforeach} and \nxLcs{psForeach}} -%-------------------------------------------------------------------------------------- - -The macro \Lcs{psforeach} allows a loop with an individual increment. - -\begin{BDef} -\Lcs{psforeach}\Largb{variable}\Largb{value list}\Largb{action}\\ -\Lcs{psForeach}\Largb{variable}\Largb{value list}\Largb{action} -\end{BDef} - -With \Lcs{psforeach} the \Larg{action} is done inside a group and for \Lcs{psForeach} not. -This maybe useful when using the macro to create tabular cells, which are -alread grouped itself. - -\begin{LTXexample} -\begin{pspicture}[showgrid=true](5,5) - \psforeach{\nA}{0, 1, 1.5, 3, 5}{% - \psdot[dotscale=3](\nA,\nA)} +\begin{LTXexample}[pos=t,preset=\centering] +\definecolor{rose}{rgb}{1.00, 0.84, 0.88} +\definecolor{vertpommepasmure}{rgb}{0.80, 1.0, 0.40} +\definecolor{fushia}{rgb}{0.60, 0.30, 1.0} +\begin{pspicture}(0,-.25)(10,10) + \psGTriangle(0,0)(5,10)(10,0){rose}{vertpommepasmure}{fushia} \end{pspicture} \end{LTXexample} -\begin{LTXexample}[pos=t] -%\usepackage{pst-func} -\makeatletter -\newcommand*\InitToks{\toks@={}} -\newcommand\AddToks[1]{\toks@=\expandafter{\the\toks@ #1}} -\newcommand*\PrintToks{\the\toks@} -\newcommand*{\makeTable}[4][5mm]{% - \begingroup - \InitToks% - \AddToks{\begin{tabular}{|*{#2}{>{\RaggedLeft}p{#1}|}@{}l@{}}\cline{1-#2}} - \psForeach{\iA}{#3}{\expandafter\AddToks\expandafter{\iA & }} - \AddToks{\\\cline{1-#2}}% - \psForeach{\iA}{#3}{\expandafter\AddToks\expandafter{\expandafter% - \psPrintValue\expandafter{\iA\space /x ED #4} & }} - \AddToks{\\\cline{1-#2}\end{tabular}}% - \PrintToks - \endgroup -} -\makeatother -\sffamily -\psset{decimals=2,valuewidth=7,xShift=-20} -$y=2^x$\\ -\makeTable[1cm]{6}{2,4,6,8,10,12}{2 x exp} -\end{LTXexample} +\appendix %-------------------------------------------------------------------------------------- @@ -7690,8 +4290,6 @@ This refers to all options of the packages \LPack{pstricks}, \LPack{pst-plot} and \LPack{pst-node}. -\appendix - %-------------------------------------------------------------------------------------- \section{PostScript} diff --git a/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro b/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro index 10e4745ac26..25eb33517a9 100644 --- a/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro +++ b/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro @@ -1,14 +1,10 @@ -%% $Id: pstricks-add.pro 122 2009-08-13 07:21:10Z herbert $ +%% $Id: pstricks-add.pro 247 2010-01-04 22:45:42Z herbert $ % PostScript prologue for pstricks-add.tex. -% Version 0.22, 2009/03/17 -% For distribution, see pstricks.tex. -% -% HISTORY -> see file Changes -% +% Version 0.23, 2009/12/17 % /tx@addDict 410 dict def tx@addDict begin %% -123 srand % set random generator +realtime srand % set random generator % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /GTriangle { @@ -139,6 +135,12 @@ calculateRGB } def % now the colors are saved in Red Green Blue % +/wavelengthToGRAY { % the wavelength in nm must be on top of the stack + cvi /lambda exch def % no floating point here + calculateRGB + Red Green Blue RGBtoGRAY +} def % now the gray color is on the stack +% /wavelengthToCMYK { % the wavelength in nm must be on top of the stack cvi /lambda exch def % no floating point here gsave @@ -167,39 +169,6 @@ end } bind def % -%%%%% ### bubblesort ### -%% syntax : array bubblesort --> array2 trie par ordre croissant -%% code de Bill Casselman -%% http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/ -/bubblesort { -4 dict begin - /a exch def - /n a length 1 sub def - n 0 gt { - % at this point only the n+1 items in the bottom of a remain to - % the sorted largest item in that blocks is to be moved up into - % position n - n { - 0 1 n 1 sub { - /i exch def - a i get a i 1 add get gt { - % if a[i] > a[i+1] swap a[i] and a[i+1] - a i 1 add - a i get - a i a i 1 add get - % set new a[i] = old a[i+1] - put - % set new a[i+1] = old a[i] - put - } if - } for - /n n 1 sub def - } repeat - } if - a -end -} def -% %/amplHand {.8} def %/dtHand 2 def /varHand { rand sin amplHand mul add } def diff --git a/Master/texmf-dist/source/generic/pstricks-add/Makefile b/Master/texmf-dist/source/generic/pstricks-add/Makefile index b4d4838d016..9bfc6c54295 100644 --- a/Master/texmf-dist/source/generic/pstricks-add/Makefile +++ b/Master/texmf-dist/source/generic/pstricks-add/Makefile @@ -61,6 +61,7 @@ tds: # cp -u Changes $(TDS)/dvips/$(PACKAGE)/ cp -u $(PACKAGE).pro $(TDS)/dvips/$(PACKAGE)/ + cp -u $(PACKAGE).pro ~/Links/dvips-local/ # cp -u Changes $(TDS)/source/$(PACKAGE)/ cp -u $(MAIN).tex $(TDS)/source/$(PACKAGE)/ diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex b/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex deleted file mode 100644 index 1ad488864df..00000000000 --- a/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex +++ /dev/null @@ -1,701 +0,0 @@ -%% $Id: pst-fp.tex 155 2009-11-30 07:58:45Z herbert $ -%% -%% -%% This is file `pst-fp.tex', -%% -%% IMPORTANT NOTICE: -%% -%% Package `pst-fp.tex' -%% -%% Herbert Voss -%% stolen from the fp package by Michael Mehlich -%% -%% This program can be redistributed and/or modified under the terms -%% of the LaTeX Project Public License Distributed from CTAN archives -%% in directory macros/latex/base/lppl.txt. -%% -%% DESCRIPTION: -%% `pst-fp' is a PSTricks related package for a division, -%% multiplication and addition -%% -\csname PSTFPloaded\endcsname -\let\PSTFPloaded\endinput -% -% Requires some packages -\ifx\PSTricksLoaded\endinput\else\input pstricks \fi -% -\def\fileversion{0.04} -\def\filedate{2009/11/24} -\message{`pst-fp' v\fileversion, \filedate\space (hv)} -% -\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax - -%fixed point arithmetic with values between (including) -% -999999999999999999.999999999999999999 -% and +999999999999999999.999999999999999999 - -\def\pstFPadd#1#2#3{\pstFP@callc\pstFP@add#1{#2}{#3}+\relax} % #1 := #2+#3 -\def\pstFPmul#1#2#3{\pstFP@callc\pstFP@mul#1{#2}{#3}} % #1 := #2*#3 -\def\pstFPdiv#1#2#3{\pstFP@callc\pstFP@div#1{#2}{#3}} % #1 := #2/#3 - -\countdef\pstFP@actcounter=10 % register 0 for counter -\ifnum\pstFP@actcounter<60\relax \pstFP@actcounter=60\fi - -\newcount\pstFP@xs %sign of 1st value -\newcount\pstFP@xia%integer part of 1st value -\newcount\pstFP@xib%integer part of 1st value -\newcount\pstFP@xfa%fractional part of 1st value -\newcount\pstFP@xfb%fractional part of 1st value - -\countdef\pstFP@ys=5 %sign of 2nd value -\countdef\pstFP@yia=6%integer part of 2nd value -\countdef\pstFP@yib=7%integer part of 2nd value -\countdef\pstFP@yfa=8%fractional part of 2nd value -\countdef\pstFP@yfb=9%fractional part of 2nd value - -\countdef\pstFP@xk=10 %registers for splitting 1st value -\countdef\pstFP@xl=11 -\countdef\pstFP@xm=12 -\countdef\pstFP@xn=13 -\countdef\pstFP@xo=14 -\countdef\pstFP@xp=15 -\countdef\pstFP@xq=16 -\countdef\pstFP@xr=17 -\countdef\pstFP@xz=18 -\countdef\pstFP@xt=19 -\countdef\pstFP@xu=20 -\countdef\pstFP@xv=21 - -\countdef\pstFP@yk=22 %registers for splitting 2nd value -\countdef\pstFP@yl=23 -\countdef\pstFP@ym=24 -\countdef\pstFP@yn=25 -\countdef\pstFP@yo=26 -\countdef\pstFP@yp=27 -\countdef\pstFP@yq=28 -\countdef\pstFP@yr=29 -\countdef\pstFP@yz=30 -\countdef\pstFP@yt=31 -\countdef\pstFP@yu=32 -\countdef\pstFP@yv=33 - -\newcount\pstFP@rega %auxiliary registers -\newcount\pstFP@regb -\countdef\pstFP@regc=36 -\countdef\pstFP@regd=37 -\countdef\pstFP@rege=38 - -\countdef\pstFP@rs=39 %result registers -\countdef\pstFP@ria=40 -\countdef\pstFP@rib=41 -\countdef\pstFP@rfa=42 -\countdef\pstFP@rfb=43 - -\newcount\pstFP@regs %local auxiliary registers -\countdef\pstFP@count=45 -\countdef\pstFP@res=46 -\countdef\pstFP@shift=47 -\newcount\pstFP@times -\countdef\pstFP@prod=49 - -%auxiliary macros which may be used in all of the following macros -\newif\ifpstFP@test - -\def\pstFP@ignorenext#1{} -\def\pstFP@first#1#2\relax{#1} -\def\pstFP@swallow#1\relax{} -% -\def\ifpstFP@zero#1{% - \ifnum% - \expandafter\ifnum\csname pstFP@#1ia\endcsname=0 0\else1\fi% - \expandafter\ifnum\csname pstFP@#1ib\endcsname=0 0\else1\fi% - \expandafter\ifnum\csname pstFP@#1fa\endcsname=0 0\else1\fi% - \expandafter\ifnum\csname pstFP@#1fb\endcsname=0 0\else1\fi% - =0\relax% -} -% -%read value -% -\def\pstFP@correctintcounter#1\relax{% - {\edef\pstFP@tmp{#1}% - \pstFP@count=0\relax% - \loop% - \edef\pstFP@tmpa{\expandafter\pstFP@first\pstFP@tmp\noexpand\relax}% - \expandafter\ifx\pstFP@tmpa0\relax% - \advance\pstFP@count1\relax% - \edef\pstFP@tmp{\expandafter\pstFP@ignorenext\pstFP@tmp}% - \repeat% - \ifnum\pstFP@count>18\relax% - \typeout{>>>> Overflow}% - \fi% - \expandafter\if!\pstFP@tmp!% - \advance\pstFP@count-18\relax% - \pstFP@count=-\pstFP@count% - \loop% - \ifnum\pstFP@count>0\relax% - \pstFP@regc=\pstFP@rega% - \divide\pstFP@rega10\relax\multiply\pstFP@rega10\relax% - \advance\pstFP@regc-\pstFP@rega\multiply\pstFP@regc100000000\relax% - \divide\pstFP@rega10\relax% - \divide\pstFP@regb10\relax\advance\pstFP@regb\pstFP@regc% - \advance\pstFP@count-1\relax% - \repeat% - \global\pstFP@rega=\pstFP@rega% - \global\pstFP@regb=\pstFP@regb% - \else% - \typeout{>>>>Number too big}% - \fi% - }% -} -\def\pstFP@@setintcounter#1#2#3#4#5#6#7#8#9{% - \pstFP@regb=#1#2#3#4#5#6#7#8#9\relax% - \pstFP@correctintcounter% -} -\def\pstFP@setintcounter#1#2#3#4#5#6#7#8#9{% - \pstFP@rega=#1#2#3#4#5#6#7#8#9\relax% - \pstFP@@setintcounter% -} - -\def\pstFP@@setfractcounter#1#2#3#4#5#6#7#8#9{% - \pstFP@regb=#1#2#3#4#5#6#7#8#9\relax% - \pstFP@swallow% -} -\def\pstFP@setfractcounter#1#2#3#4#5#6#7#8#9{% - \pstFP@rega=#1#2#3#4#5#6#7#8#9\relax% - \pstFP@@setfractcounter% -} - -\def\pstFP@getsign#1\relax{% - {\pstFP@regs=1\relax% - \edef\pstFP@tmp{#1}% - \loop% - \edef\pstFP@tmpa{\expandafter\pstFP@first\pstFP@tmp\noexpand\relax}% - \expandafter\ifx\pstFP@tmpa-\relax% - \multiply\pstFP@regs-1\relax% - \fi% - \ifnum\expandafter\ifx\pstFP@tmpa-1\else0\fi\expandafter\ifx\pstFP@tmpa+1\else0\fi>0% - \edef\pstFP@tmp{\expandafter\pstFP@ignorenext\pstFP@tmp}% - \repeat% - \global\let\pstFP@tmp\pstFP@tmp% - \global\pstFP@regs=\pstFP@regs% - }% -} - -\def\pstFP@removeleadingzeros#1\relax{% - {\edef\pstFP@tmp{#1}% - \loop% - \edef\pstFP@tmpa{\expandafter\pstFP@first\pstFP@tmp\noexpand\relax}% - \expandafter\ifx\pstFP@tmpa0\relax% - \edef\pstFP@tmp{\expandafter\pstFP@ignorenext\pstFP@tmp}% - \repeat% - \global\let\pstFP@tmp\pstFP@tmp% - }% -} - -\newif\ifpstFP@nonstop -\def\pstFP@strip#1{% - {\edef\pstFP@tmp{#1}% - \edef\pstFP@tmpb{}% - \ifx\pstFP@tmp\@empty\else% - \pstFP@nonstoptrue% - \loop% - \edef\pstFP@tmpa{\expandafter\pstFP@first\pstFP@tmp\noexpand\relax}% - \expandafter\ifx\pstFP@tmpa-\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa+\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa0\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa1\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa2\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa3\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa4\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa5\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa6\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa7\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa8\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \expandafter\ifx\pstFP@tmpa9\relax\edef\pstFP@tmpb{\pstFP@tmpb\pstFP@tmpa}\else% - \ifx\pstFP@tmpa\@empty\pstFP@nonstopfalse\else% - \ifx\pstFP@tmpa\space\pstFP@nonstopfalse\else% - \typeout{>>> Illegal character \pstFP@tmpa\space found in float number}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% - \edef\pstFP@tmp{\expandafter\pstFP@ignorenext\pstFP@tmp}% - \ifx\pstFP@tmp\@empty\pstFP@nonstopfalse\fi% - \ifpstFP@nonstop% - \repeat% - \fi% - \global\let\pstFP@tmp\pstFP@tmpb% - }% -} - -\def\pstFP@readvalue#1#2#3{% - % #1 macro family to catch the value - % #2.#3 value - % - % regular expression [+|-]*[d]_0^18.[d]* - % - \pstFP@strip{#2}% - %sign - \expandafter\pstFP@getsign\pstFP@tmp\relax% - \csname pstFP@#1s\endcsname=\pstFP@regs% - % - %integer part - \pstFP@removeleadingzeros\pstFP@tmp\relax% - \expandafter\pstFP@setintcounter\pstFP@tmp000000000000000000\relax% - \csname pstFP@#1ia\endcsname=\pstFP@rega% - \csname pstFP@#1ib\endcsname=\pstFP@regb% - % - %fractional part - \pstFP@strip{#3}% - \expandafter\pstFP@setfractcounter\pstFP@tmp000000000000000000\relax% - \csname pstFP@#1fa\endcsname=\pstFP@rega% - \csname pstFP@#1fb\endcsname=\pstFP@regb% - % - %correct sign - \ifnum\pstFP@rega=0\relax% - \ifnum\pstFP@regb=0\relax% - \expandafter\ifnum\csname pstFP@#1ib\endcsname=0\relax% - \expandafter\ifnum\csname pstFP@#1ia\endcsname=0\relax% - \csname pstFP@#1s\endcsname=1\relax% - \fi% - \fi% - \fi% - \fi% -} -% -%store value in macro -% -\def\pstFP@store#1#2{% - % #1 macro - % #2 macro family (value) to store - % - \ifpstFP@zero{#2}% - \csname pstFP@#2s\endcsname=1\relax% - \fi% - \expandafter\ifnum\csname pstFP@#2s\endcsname<0\relax% - \edef#1{-}% - \else% - \edef#1{}% - \fi% - \expandafter\ifnum\csname pstFP@#2ia\endcsname=0\relax% - \expandafter\ifnum\csname pstFP@#2ib\endcsname=0\relax% - \edef#1{#10}% - \else% - \edef#1{#1\expandafter\the\csname pstFP@#2ib\endcsname}% - \fi% - \else% - \expandafter\advance\csname pstFP@#2ib\endcsname1000000000\relax% - \edef#1{#1\expandafter\the\csname pstFP@#2ia\endcsname\expandafter\pstFP@ignorenext\the\csname pstFP@#2ib\endcsname}% - \fi% - \expandafter\advance\csname pstFP@#2fa\endcsname1000000000\relax% - \expandafter\advance\csname pstFP@#2fb\endcsname1000000000\relax% - \edef#1{#1\noexpand.\expandafter\pstFP@ignorenext\the\csname pstFP@#2fa\endcsname\expandafter\pstFP@ignorenext\the\csname pstFP@#2fb\endcsname}% -} -%macros to expand some arguments -% -\def\pstFP@callc#1#2#3#4{% - % #1 macro to call - % #2 macro, which gets the result - % #3 1st value - % #4 2nd value - % expand the values and split them into the integer and the fractional parts - \edef\next{\noexpand#1\noexpand#2#3..\noexpand\relax#4..\noexpand\relax}% - \next% -} -% -\def\pstFP@divten#1{% - \expandafter\pstFP@regc\csname pstFP@#1ia\endcsname% - \expandafter\divide\csname pstFP@#1ia\endcsname10\relax% - \expandafter\pstFP@regb\csname pstFP@#1ia\endcsname% - \multiply\pstFP@regb10\relax% - \advance\pstFP@regc-\pstFP@regb% - \multiply\pstFP@regc100000000\relax% - % - \expandafter\pstFP@rega\csname pstFP@#1ib\endcsname% - \expandafter\divide\csname pstFP@#1ib\endcsname10\relax% - \expandafter\pstFP@regb\csname pstFP@#1ib\endcsname% - \multiply\pstFP@regb10\relax% - \advance\pstFP@rega-\pstFP@regb% - \multiply\pstFP@rega100000000\relax% - \expandafter\advance\csname pstFP@#1ib\endcsname\pstFP@regc% - % - \expandafter\pstFP@regc\csname pstFP@#1fa\endcsname% - \expandafter\divide\csname pstFP@#1fa\endcsname10\relax% - \expandafter\pstFP@regb\csname pstFP@#1fa\endcsname% - \multiply\pstFP@regb10\relax% - \advance\pstFP@regc-\pstFP@regb% - \multiply\pstFP@regc100000000\relax% - \expandafter\advance\csname pstFP@#1fa\endcsname\pstFP@rega% - % - \expandafter\divide\csname pstFP@#1fb\endcsname10\relax% - \expandafter\advance\csname pstFP@#1fb\endcsname\pstFP@regc% -} -% -\def\pstFP@multen#1{% - \expandafter\multiply\csname pstFP@#1ia\endcsname10\relax% - \expandafter\ifnum\csname pstFP@#1ib\endcsname<100000000\relax% - \else% - \expandafter\pstFP@regc\csname pstFP@#1ib\endcsname% - \divide\pstFP@regc100000000% - \expandafter\advance\csname pstFP@#1ia\endcsname\pstFP@regc% - \multiply\pstFP@regc100000000% - \expandafter\advance\csname pstFP@#1ib\endcsname-\pstFP@regc% - \fi% - \expandafter\multiply\csname pstFP@#1ib\endcsname10\relax% - \expandafter\ifnum\csname pstFP@#1fa\endcsname<100000000\relax% - \else% - \expandafter\pstFP@regc\csname pstFP@#1fa\endcsname% - \divide\pstFP@regc100000000% - \expandafter\advance\csname pstFP@#1ib\endcsname\pstFP@regc% - \multiply\pstFP@regc100000000% - \expandafter\advance\csname pstFP@#1fa\endcsname-\pstFP@regc% - \fi% - \expandafter\multiply\csname pstFP@#1fa\endcsname10\relax% - \expandafter\ifnum\csname pstFP@#1fb\endcsname<100000000\relax% - \else% - \expandafter\pstFP@regc\csname pstFP@#1fb\endcsname% - \divide\pstFP@regc100000000% - \expandafter\advance\csname pstFP@#1fa\endcsname\pstFP@regc% - \multiply\pstFP@regc100000000% - \expandafter\advance\csname pstFP@#1fb\endcsname-\pstFP@regc% - \fi% - \expandafter\multiply\csname pstFP@#1fb\endcsname10\relax% -} -% -\def\pstFP@counttimes{% - {\global\pstFP@times=0\relax% - \loop% - \ifnum% - \ifnum\pstFP@xia>\pstFP@yia1% - \else\ifnum\pstFP@xia<\pstFP@yia0% - \else% - \ifnum\pstFP@xib>\pstFP@yib1% - \else\ifnum\pstFP@xib<\pstFP@yib0% - \else% - \ifnum\pstFP@xfa>\pstFP@yfa1% - \else\ifnum\pstFP@xfa<\pstFP@yfa0% - \else% - \ifnum\pstFP@xfb>\pstFP@yfb1% - \else\ifnum\pstFP@xfb<\pstFP@yfb0% - \else% - 1% - \fi\fi% - \fi\fi% - \fi\fi% - \fi\fi% - =1\relax% - \global\advance\pstFP@times1\relax% - \global\advance\pstFP@xfb-\pstFP@yfb% - \ifnum\pstFP@xfb<0\relax% - \global\advance\pstFP@xfb1000000000\relax% - \global\advance\pstFP@xfa-1\relax% - \fi% - \global\advance\pstFP@xfa-\pstFP@yfa% - \ifnum\pstFP@xfa<0\relax% - \global\advance\pstFP@xfa1000000000\relax% - \global\advance\pstFP@xib-1\relax% - \fi% - \global\advance\pstFP@xib-\pstFP@yib% - \ifnum\pstFP@xib<0\relax% - \global\advance\pstFP@xib1000000000\relax% - \global\advance\pstFP@xia-1\relax% - \fi% - \global\advance\pstFP@xia-\pstFP@yia% - \repeat% - }% -} -% -%add two values -\def\pstFP@add#1#2.#3.#4\relax#5.#6.#7\relax#8\relax{% - % #1 macro, which gets the result - % #2 integer part of 1st value - % #3 fractional part of 1st value - % #4 dummy to swallow everthing after the 2nd '.' - % #5 integer part of 2nd value - % #6 fractional part of 2nd value - % #7 dummy to swallow everthing after the 2nd '.' - % - {\ifx#8+\relax% - \pstFP@readvalue{x}{#2}{#3}% - \pstFP@readvalue{y}{#5}{#6}% - \ifnum\pstFP@xs=\pstFP@ys% - \advance\pstFP@xfb\pstFP@yfb% - \advance\pstFP@xfa\pstFP@yfa% - \ifnum\pstFP@xfb<1000000000\relax\else% - \advance\pstFP@xfb-1000000000\relax% - \advance\pstFP@xfa1\relax% - \fi% - \advance\pstFP@xib\pstFP@yib% - \ifnum\pstFP@xfa<1000000000\relax\else% - \advance\pstFP@xfa-1000000000\relax% - \advance\pstFP@xib1\relax% - \fi% - \advance\pstFP@xia\pstFP@yia% - \ifnum\pstFP@xib<1000000000\relax\else% - \advance\pstFP@xib-1000000000\relax% - \advance\pstFP@xia1\relax% - \fi% - \ifnum\pstFP@xia<1000000000\relax\else% - \pstFP@errmessage{Overflow}% - \fi% - \pstFP@store\pstFP@tmp{x}% - \else% - \advance\pstFP@xfb-\pstFP@yfb% - \ifnum\pstFP@xfb<0\relax% - \advance\pstFP@yfa1\relax% - \advance\pstFP@xfb1000000000\relax% - \fi% - \advance\pstFP@xfa-\pstFP@yfa% - \ifnum\pstFP@xfa<0\relax% - \advance\pstFP@yib1\relax% - \advance\pstFP@xfa1000000000\relax% - \fi% - \advance\pstFP@xib-\pstFP@yib% - \ifnum\pstFP@xib<0\relax% - \advance\pstFP@yia1\relax% - \advance\pstFP@xib1000000000\relax% - \fi% - \advance\pstFP@xia-\pstFP@yia% - \ifnum\pstFP@xia<0\relax% - \pstFP@xs=-\pstFP@xs% - \ifnum\pstFP@xfb=0\relax\else% - \advance\pstFP@xfb-1000000000\relax\pstFP@xfb=-\pstFP@xfb% - \advance\pstFP@xfa1\relax% - \fi% - \ifnum\pstFP@xfa=0\relax\else% - \advance\pstFP@xfa-1000000000\relax\pstFP@xfa=-\pstFP@xfa% - \advance\pstFP@xib1\relax% - \fi% - \ifnum\pstFP@xib=0\relax\else% - \advance\pstFP@xib-1000000000\relax\pstFP@xib=-\pstFP@xib% - \advance\pstFP@xia1\relax% - \fi% - \relax\pstFP@xia=-\pstFP@xia% - \fi% - \pstFP@store\pstFP@tmp{x}% - \fi% - \global\let\pstFP@tmp\pstFP@tmp% - }% - \let#1\pstFP@tmp% -} - -\def\pstFP@div#1#2.#3.#4\relax#5.#6.#7\relax{% - % #1 macro, which gets the result - % #2 integer part of 1st value - % #3 fractional part of 1st value - % #4 dummy to swallow everthing after the 2nd '.' - % #5 integer part of 2nd value - % #6 fractional part of 2nd value - % #7 dummy to swallow everthing after the 2nd '.' - % - % algorithmic idea (for x>0, y>0) - % - %determine \pstFP@shift such that y*10^\pstFP@shift <100000000<=y*10^(\pstFP@shift+1) - % - %determine \pstFP@shift' such that x*10^\pstFP@shift'<100000000<=x*10^(\pstFP@shift+1) - % - x=x*\pstFP@shift' - % - y=y*\pstFP@shift - % - \pstFP@shift=\pstFP@shift-\pstFP@shift' - % - res=0 - % - while y>0 %fixed-point representation! - % - \pstFP@times=0 - % - while x>y - % - \pstFP@times=\pstFP@times+1 - % - x=x-y - % - end - % - y=y/10 - % - res=10*res+\pstFP@times/1000000000 - % - end - % - %shift the result according to \pstFP@shift - % - {\pstFP@readvalue{x}{#2}{#3}% - \pstFP@readvalue{y}{#5}{#6}% - % - %sign - \multiply\pstFP@xs\pstFP@ys% - \pstFP@rs=\pstFP@xs% - % - %compute division - \ifpstFP@zero{y}% - \typeout{>>>>Division by zero}% - \else% - \ifpstFP@zero{x}\def\next##1{\edef\pstFP@tmp{0}}\else\def\next##1{##1}\fi% - \next% - {\pstFP@shift=0\relax% - \loop% - \ifnum\pstFP@yia<100000000\relax% - \pstFP@multen{y}% - \advance\pstFP@shift1\relax% - \repeat% - \loop% - \ifnum\pstFP@xia<100000000\relax% - \pstFP@multen{x}% - \advance\pstFP@shift-1\relax% - \repeat% - \pstFP@ria=0\pstFP@rib=0\pstFP@rfa=0\pstFP@rfb=0\relax% - \loop% - \ifpstFP@zero{y}\else% - \pstFP@counttimes%divides x by \pstFP@times*y - \pstFP@divten{y}% - \pstFP@multen{r}% - \advance\pstFP@rfb\pstFP@times% - \ifnum\pstFP@rfb<1000000000\relax\else% - \advance\pstFP@rfa1\advance\pstFP@rfb-1000000000\relax% - \ifnum\pstFP@rfa<1000000000\relax\else% - \advance\pstFP@rib1\advance\pstFP@rfa-1000000000\relax% - \ifnum\pstFP@rib<1000000000\relax\else% - \advance\pstFP@ria1\advance\pstFP@rib-1000000000\relax% - \fi% - \fi% - \fi% - \repeat% - \loop% - \ifnum\pstFP@shift>17% - \advance\pstFP@shift-1\relax% - \ifnum\pstFP@ria<100000000\else\pstFP@ria=-1\fi% - \ifnum\pstFP@ria<0\pstFP@ria=-1\fi% - \pstFP@multen{r}% - \repeat% - \ifnum\pstFP@ria<1000000000\else\pstFP@ria=-1\fi% - \loop% - \ifnum\pstFP@shift<17% - \advance\pstFP@shift1\relax% - \pstFP@divten{r}% - \repeat% - \ifnum\pstFP@ria<0\relax% - \typeout{>>>>Overflow}% - \else% - \pstFP@store\pstFP@tmp{r}% - \fi% - }% - \fi% - % - \global\let\pstFP@tmp=\pstFP@tmp% - % - }% - \let#1\pstFP@tmp% -} -%multiply two values - -\def\pstFP@firstnine#1#2#3#4#5#6#7#8#9{% - \pstFP@res=#1#2#3#4#5#6#7#8#9\relax% -} -\def\pstFP@@ninesplit#1\relax#2\end#3{% - #1% - \edef#3{#2}% -} -\def\pstFP@ninesplit#1{% - \edef#1{\expandafter\pstFP@firstnine\pstFP@rd}% - \expandafter\pstFP@@ninesplit#1\end#1\relax% -} - -\def\pstFP@split#1#2#3#4{% - % #1 highest three digits - % #2 medium three digits - % #3 least three digits - % #4 counter - \pstFP@regc=#4% - \divide\pstFP@regc1000000\relax% - #1=\pstFP@regc% - \multiply\pstFP@regc-1000000\relax\advance\pstFP@regc#4% - #3=\pstFP@regc% - \divide\pstFP@regc1000\relax% - #2=\pstFP@regc% - \multiply\pstFP@regc-1000\relax\advance\pstFP@regc#3% - #3=\pstFP@regc% -} - -\def\pstFP@@mul#1#2#3{% - \pstFP@regc=\csname pstFP@x#1\endcsname% - \multiply\pstFP@regc\csname pstFP@y#2\endcsname% - \advance\pstFP@prod\pstFP@regc% - % - \ifx#3\relax% - \let\next=\relax% - \else% - \let\next=\pstFP@@mul% - \fi% - \next#3% -} - -\def\pstFP@saveshift{% - % save rightmost three digits - \pstFP@regc=\pstFP@prod% - \divide\pstFP@prod1000\relax% - \multiply\pstFP@prod1000\relax% - \advance\pstFP@regc-\pstFP@prod% - \advance\pstFP@regc1000\relax% - \edef\pstFP@rd{\expandafter\pstFP@ignorenext\the\pstFP@regc\pstFP@rd}% - % - \divide\pstFP@prod1000\relax% -} - -\def\pstFP@mul#1#2.#3.#4\relax#5.#6.#7\relax{% - % #1 macro, which gets the result - % #2 integer part of 1st value - % #3 fractional part of 1st value - % #4 dummy to swallow everthing after the 2nd '.' - % #5 integer part of 2nd value - % #6 fractional part of 2nd value - % #7 dummy to swallow everthing after the 2nd '.' - % - % split value in various parts - % x y = 123 456 789 123 456 789 . 123 456 789 123 456 789 - % -> xk xl xm xn xo xp xq xr xs xt xu xv - % -> yk yl ym yn yo yp yq yr ys yt yu yv - % multiply these parts and save the result wrt the necessary shifts - % - {\pstFP@readvalue{x}{#2}{#3}% - \pstFP@readvalue{y}{#5}{#6}% - % - %sign - \multiply\pstFP@xs\pstFP@ys% - \pstFP@rs=\pstFP@xs% - % - % split parts - \pstFP@split\pstFP@xk\pstFP@xl\pstFP@xm\pstFP@xia\pstFP@split\pstFP@xn\pstFP@xo\pstFP@xp\pstFP@xib% - \pstFP@split\pstFP@xq\pstFP@xr\pstFP@xz\pstFP@xfa\pstFP@split\pstFP@xt\pstFP@xu\pstFP@xv\pstFP@xfb% - \pstFP@split\pstFP@yk\pstFP@yl\pstFP@ym\pstFP@yia\pstFP@split\pstFP@yn\pstFP@yo\pstFP@yp\pstFP@yib% - \pstFP@split\pstFP@yq\pstFP@yr\pstFP@yz\pstFP@yfa\pstFP@split\pstFP@yt\pstFP@yu\pstFP@yv\pstFP@yfb% - % - \pstFP@prod=0\relax% - \edef\pstFP@rd{}% - % - %compute result - \pstFP@@mul vv \relax\pstFP@saveshift% - \pstFP@@mul vu uv \relax\pstFP@saveshift% - \pstFP@@mul uu vt tv \relax\pstFP@saveshift% - \pstFP@@mul ut tu vz zv \relax\pstFP@saveshift% - \pstFP@@mul tt zu uz rv vr \relax\pstFP@saveshift% - \pstFP@@mul zt tz ur ru vq qv \relax\pstFP@saveshift% - \pstFP@@mul zz rt tr uq qu vp pv \relax\pstFP@saveshift% - \pstFP@@mul zr rz tq qt up pu vo ov \relax\pstFP@saveshift% - \pstFP@@mul rr qz zq tp pt uo ou vn nv \relax\pstFP@saveshift% - \pstFP@@mul rq qr zp pz to ot un nu vm mv \relax\pstFP@saveshift% - \pstFP@@mul qq rp pr zo oz tn nt um mu vl lv \relax\pstFP@saveshift% - \pstFP@@mul qp pq ro or zn nz tm mt ul lu kv vk \relax\pstFP@saveshift% - \pstFP@@mul pp oq qo rn nr zm mz tl lt ku uk \relax\pstFP@saveshift% - \pstFP@@mul op po nq qn rm mr zl lz tk kt \relax\pstFP@saveshift% - \pstFP@@mul oo pn np mq qm rl lr kz zk \relax\pstFP@saveshift% - \pstFP@@mul no on mp pm lq ql kr rk \relax\pstFP@saveshift% - \pstFP@@mul nn mo om pl lp qk kq \relax\pstFP@saveshift% - \pstFP@@mul mn nm lo ok pk kp \relax\pstFP@saveshift% - \pstFP@@mul mm ln nl ko ok \relax\pstFP@saveshift% - \pstFP@@mul lm ml kn nk \relax\pstFP@saveshift% - \pstFP@@mul ll km mk \relax\pstFP@saveshift% - \pstFP@@mul kl lk \relax\pstFP@saveshift% - \pstFP@@mul kk \relax\pstFP@saveshift\pstFP@saveshift% - \pstFP@ninesplit\pstFP@rd% - \ifnum\pstFP@res=0\relax% - \pstFP@ninesplit\pstFP@rd% - \ifnum\pstFP@res=0\relax% - \pstFP@ninesplit\pstFP@rd\pstFP@ria=\pstFP@res% - \pstFP@ninesplit\pstFP@rd\pstFP@rib=\pstFP@res% - \pstFP@ninesplit\pstFP@rd\pstFP@rfa=\pstFP@res% - \pstFP@ninesplit\pstFP@rd\pstFP@rfb=\pstFP@res% - \pstFP@store\pstFP@tmp{r}% - \else\typeout{pstFPmul: Overflow}\fi% - \else\typeout{pstFPmul: Overflow}\fi% - \global\let\pstFP@tmp\pstFP@tmp}% - \let#1\pstFP@tmp% -} -% -\catcode`\@=\PstAtCode\relax -% -%% END: pst-fp.tex -\endinput 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 e4618d5fbde..0cf76d4e7af 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 154 2009-11-30 07:51:26Z herbert $ +%% $Id: pstricks-add.tex 288 2010-02-11 15:43:29Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -8,7 +8,7 @@ %% Package `pstricks-add.tex' %% %% Dominique Rodriguez -%% Herbert Voss +%% Herbert Voss %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -28,11 +28,10 @@ \ifx\PSTthreeDLoaded\endinput\else\input pst-3d \fi \ifx\MultidoLoaded\endinput\else \input multido \fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi -\ifx\PSTFPloaded\endinput\else \input pst-fp \fi \ifx\PSTmathLoaded\endinput\else \input pst-math \fi % -\def\fileversion{3.36} -\def\filedate{2009/11/14} +\def\fileversion{3.38} +\def\filedate{2009/12/13} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -41,146 +40,6 @@ % %% prologue for postcript \pstheader{pstricks-add.pro}% -%\pstheader{pst-math.pro}% for equation solver -%\pstheader{pst-algparser.pro}% now done by pstricks.tex -% -%-------------------------------- pstricks ------------------------------------ -% -%%%%%%% \begin{pspicture} %%%%%%%%%%%%%%%%%%% -\newdimen\pst@dimm% -\newdimen\pst@dimn% -\newdimen\pst@dimo% -\newdimen\pst@dimp% -\newcount\pst@cntm% -\newcount\pst@cntn% -\newcount\pst@cnto% -\newcount\pst@cntp% -%\psset{dx=0}% -%\psset{dy=0}% -\newcount\@zero\@zero=0\relax -\chardef\f@ur=4 -% -\def\psPiFour{12.566371} -\def\psPiTwo{6.283185} -\def\psPi{3.14159265} -\def\psPiH{1.570796327} -\newdimen\pstRadUnit -\newdimen\pstRadUnitInv -\pstRadUnit=1.047198cm % this is pi/3 -\pstRadUnitInv=0.95493cm % this is 3/pi -% -\def\pst@getdimdim#1 #2 #3\@nil{% - \def\pst@tempA{#2}% - \ifx\pst@tempA\@empty - \pssetlength\pst@dimn{#1}% - \pst@dimm=\z@% - \else% - \pssetlength\pst@dimm{#1}% - \pssetlength\pst@dimn{#2}% - \fi% -} -\def\pst@getxdimdim#1 #2 #3\@nil{% - \def\pst@tempA{#2}% - \ifx\pst@tempA\@empty - \pssetxlength\pst@dimn{#1}% - \pst@dimm=\z@ - \else% - \pssetxlength\pst@dimm{#1}% - \pssetxlength\pst@dimn{#2}% - \fi% -} -\def\pst@getydimdim#1 #2 #3\@nil{% - \def\pst@tempA{#2} - \ifx\pst@tempA\@empty - \pssetylength\pst@dimn{#1} - \pst@dimm=\z@ - \else - \pssetylength\pst@dimm{#1}% - \pssetylength\pst@dimn{#2}% - \fi% -} -% -% stolen from latex.ltx to make it TeX compatible -% -\newcount\psLoopIndex -\def\@fornoop#1\@@#2#3{} -\long\def\@for#1:=#2\do#3{% - \pst@cntm=0% - \expandafter\def\expandafter\@fortmp\expandafter{#2}% - \ifx\@fortmp\@empty \else - \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi} -\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else - #5\def#4{#2}\ifx #4\@nnil \else\global\advance\psLoopIndex by \@ne\relax% - #5\@iforloop #3\@@#4{#5}\fi\fi} -\long\def\@iforloop#1,#2\@@#3#4{\global\advance\psLoopIndex by \@ne\relax% - \def#3{#1}\ifx #3\@nnil - \expandafter\@fornoop \else - #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}} -\def\psforeach#1#2#3{% - \begingroup% - \edef\reserved@a{#2}% - \@for#1:=\reserved@a\do{#3}% - \endgroup% -} -\def\psForeach#1#2#3{% - \edef\reserved@a{#2}% - \@for#1:=\reserved@a\do{#3}% -} -% -% A modulo macro for integer values -% \pst@mod{34}{6}\value ==> \value is 4 -% -\def\pst@mod#1#2#3{% - \begingroup% - \pst@cntm=#1\pst@cntn=#2\relax% - \pst@cnto=\pst@cntm% - \divide\pst@cntm by \pst@cntn% - \multiply\pst@cntn by \pst@cntm% - \advance\pst@cnto by -\pst@cntn% - \edef\value{\endgroup\def\noexpand#3{\number\pst@cnto}}\value% -} -\def\pst@max#1#2#3{% - \begingroup% - \pst@cntm=#1\pst@cntn=#2\relax% - \ifnum\pst@cntm<\pst@cntn\pst@cntm=\pst@cntn\fi - \global#3=\the\pst@cntm% - \endgroup% -} -\def\pst@maxdim#1#2#3{% - \begingroup% - \pst@dimm=#1\pst@dimn=#2\relax% - \ifdim\pst@dimm<\pst@dimn\pst@dimm=\pst@dimn\fi - \global#3=\the\pst@dimm% - \endgroup% -} -\def\pst@mindim#1#2#3{% - \begingroup% - \pst@dimm=#1\pst@dimn=#2\relax% - \ifdim\pst@dimm>\pst@dimn\pst@dimm=\pst@dimn\fi - \global#3=\the\pst@dimm% - \endgroup% -} -\def\pst@abs#1#2{% - \begingroup% - \pst@cntm=#1\relax% - \ifnum\pst@cntm<\z@\pst@cntm=-\pst@cntm\fi% - \global#2=\the\pst@cntm - \endgroup% -} -\def\pst@absdim#1#2{% - \begingroup% - \pst@dimm=#1\relax% - \ifdim\pst@dimm<\z@\pst@dimm=-\pst@dimm\fi% - \global#2=\the\pst@dimm% - \endgroup% -} -\def\pst@int#1{\expandafter\pst@@int#1..\@nil} -\def\pst@@int#1.#2.\@nil{#1} -% -\def\pstFPMul#1#2#3{\pstFP@callc\pstFP@mul#1{#2}{#3}% % #1 := int(#2/#3) - \edef#1{\pst@int{#1}}}% -\def\pstFPDiv#1#2#3{\pstFP@callc\pstFP@div#1{#2}{#3}% % #1 := int(#2/#3) - \edef#1{\pst@int{#1}}}% % \def\psGetSlope(#1,#2)(#3,#4)#5{% 4 values without a dimen! #5 is a macro \pst@dimm=#1pt% @@ -188,6 +47,7 @@ \pst@dimn=#2pt% \advance\pst@dimn by -#4pt \pst@divide{\pst@dimn}{\pst@dimm}#5} +% \def\psGetDistance(#1,#2)(#3,#4)#5{% 4 values without a dimen! #5 is a macro \pst@dimm=#1pt% \advance\pst@dimm by -#3pt% @@ -197,13 +57,6 @@ \edef#5{\strip@pt\pst@dimo} }% %--------------------------------------- small stuff ------------------------------- -\def\use@keep@par{% same as \use@par, but keeps the values - \ifx\pst@par\@empty\else - \expandafter\@psset\pst@par,\@nil -% \def\pst@par{}% - \fi% -} -% \define@boolkey[psset]{pstricks-add}[Pst@]{CMYK}[true]{} \psset[pstricks-add]{CMYK=true} % @@ -219,27 +72,18 @@ \defineTColor{TGreen}{green} \defineTColor{TBlue}{blue} % -\define@key[psset]{pstricks-add}{fsAngle}[137.50775]{\pst@getangle{#1}\pst@fsAngle } -\define@key[psset]{pstricks-add}{fsOrigin}{% - \pst@@getcoor{#1}\edef\pst@fsOrigin{\pst@coor T }} -\psset[pstricks-add]{fsOrigin={0,0},fsAngle=137.50775} -% -\def\psfs@spiral{\pst@fill{\pst@fsOrigin \pst@usecolor\psfillcolor clip newpath -0 .1 500 { dup dup sqrt 4 div 0 360 arc fill \pst@fsAngle rotate } for }} -% -\def\rmultiput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\rmultiput@i}{\rmultiput@i[]}}} -\def\rmultiput@i[#1]{\begingroup\psset{#1}\rmultiput@ii} -\def\rmultiput@ii#1{\def\@rmultiputArg{#1}% - \@ifnextchar({\rmultiput@iii}{\rmultiput@iii(\z@,\z@)}} -\def\rmultiput@iii(#1){% +\def\rmultiput{\pst@object{rmultiput}} +\def\rmultiput@i#1{% \pst@killglue% - \if@star\rput*(#1){\@rmultiputArg} - \else\rput(#1){\@rmultiputArg}\fi - \@ifnextchar({\rmultiput@iii}{\endgroup}% -} + \begingroup% + \use@par% + \@ifnextchar({\rmultiput@ii{#1}}{\rmultiput@ii{#1}(\z@,\z@)}} +\def\rmultiput@ii#1(#2){% + \if@star\rput*(#2){#1}\else\rput(#2){#1}\fi + \@ifnextchar({\rmultiput@ii{#1}}{\endgroup}} % #1: (x,y) #2: rotAngle #3: object -\def\psrotate{\def\pst@par{}\pst@object{psrotate}} +\def\psrotate{\pst@object{psrotate}} \def\psrotate@i(#1)#2{% \pst@killglue \begingroup% @@ -273,81 +117,11 @@ [#1 0 0 #1 #1 xH mul neg xH add #1 yH mul neg yH add] concat } \tx@TMChange }% \box\pst@hbox% - \pst@Verb{\tx@TMRestore}% + \pst@Verb{ \tx@TMRestore }% \end@SpecialObj} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Begin patch TN; Date (YY-MM-DD): 04-07-17; first part -\define@key[psset]{}{dash}{% defined in pstricks.tex - \pst@expandafter\psset@@dash{#1}\@nil% Error handling for empty argument. -} -\define@key[psset]{pstricks-add}{maxdashes}[11]{\def\psk@maxdashes{#1}} -%\psset{maxdashes=11} -\def\psset@@dash#1\@nil{% - \def\psk@dash{}% - % modification 04-08-07: - \pst@cntm0 - \def\next##1 ##2\relax{% - \expandafter\ifnum\psk@maxdashes>\pst@cntm\relax % 04-08-07 - \edef\@tempa{##1}% - \ifx\@tempa\@empty\else% gobble leading spaces - \pssetlength\pst@dimc{##1}% - \advance\pst@cntm by 1 - \edef\psk@dash{\psk@dash\space\pst@number\pst@dimc}% - \fi% - \edef\@tempa{##2}% - \ifx\@tempa\@empty\else% detect end - \ifx\@tempa\space\else% gobble trailing spaces - \next##2\relax% - \fi\fi% - \else% 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} -%% End patch TN; Date (YY-MM-DD): 04-07-17; 1st part -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -%\psset{dash=5pt 3pt}% black white black white -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Begin patch TN; Date (YY-MM-DD): 04-07-17; 2nd part -\def\psls@dashed{% - \psk@linecap\space setlinecap - \ifpsdashadjust - [ \psk@dash ] \pst@linetype\space \tx@DashLine - \else - [ \psk@dash ] 0 setdash stroke - \fi} -%% End patch TN; Date (YY-MM-DD): 04-07-17; 2nd part -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%----------------------------------------------------------------------------------- -\pst@def{DashLine}< - dup 0 gt - { /a .5 def PathLength exch div } - { pop /a 1 def PathLength } ifelse - /b ED % pattern should fit evenly in b - dup /X ED % pattern array - 0 get /y ED % length of first black segment - /z 0 X {add} forall def % length of the full pattern - %% Computation of the scaling factor as described by van Zandt: - b a .5 sub 2 mul y mul sub z Div round - z mul a .5 sub 2 mul y mul add b exch Div - %%%% scaling factor on stack. - /z ED %% now, z is the scaling factor - false % for the length test below - X { z mul } forall X astore %% modification TN 04-08-07 - %%% Checking whether at least one dash in X has positive length: - {0 gt or} forall - { X 1 a sub y mul } - { [ 1 0 ] 0 } - ifelse - setdash stroke > -%% TN end patch; Date (YY-MM-DD): 04-07-17; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \define@key[psset]{pstricks-add}{intSeparator}{\def\psk@intSeparator{#1}} -%\psset{intSeparator={,}} +\psset{intSeparator={,}} % \def\psFormatInt{\def\pst@par{}\pst@object{psFormatInt}} \def\psFormatInt@i#1{{% @@ -467,13 +241,6 @@ \psset[pstricks-add]{filledveearrowangle=15} % default angle \define@key[psset]{pstricks-add}{filledveearrowlinewidth}[0.35mm]{\pst@getlength{#1}\psk@filledveearrowlinewidth} \psset[pstricks-add]{filledveearrowlinewidth=0.35mm} % default vee arrow line width -\define@key[psset]{pstricks-add}{arrowLW}{\pst@getlength{#1}\psk@arrowLW} -% arrowLW as LineWidth for the circled line ends -% -\def\psas@o{\psk@arrowLW\space dup 0 eq { pop }{ SLW } ifelse - {\pst@usecolor\psfillcolor true} false \psk@dotsize \tx@EndDot } -\@namedef{psas@*}{\psk@arrowLW\space dup 0 eq { pop }{ SLW } ifelse - {\pst@usecolor\psfillcolor false} false \psk@dotsize \tx@EndDot} \pst@def{VeeArrow}<% 1 setlinecap % round caps @@ -586,7 +353,7 @@ \define@key[psset]{pstricks-add}{nArrowsA}[2]{\def\psk@nArrowsA{#1}} \define@key[psset]{pstricks-add}{nArrowsB}[2]{\def\psk@nArrowsB{#1}} \define@key[psset]{pstricks-add}{nArrows}[2]{\def\psk@nArrowsA{#1}\def\psk@nArrowsB{#1}} -%\psset{nArrows=2} +\psset{nArrows=2} % \@namedef{psas@>>}{% \psk@nArrowsA\space 1 sub { @@ -667,16 +434,6 @@ \define@key[psset]{pstricks-add}{ArrowInsidePos}[0.5]{\pst@checknum{#1}\psk@ArrowInsidePos}% %\psset{ArrowInsidePos=0.5} % -% Modified version of \begin@ClosedObj -\def\begin@ClosedObj{% - \leavevmode% - \pst@killglue% - \begingroup% - \use@par% - \solid@star% - \ifpsdoubleline\pst@setdoublesep\fi% - \pst@addarrowdef% DG addition - \init@pscode} % % Redefinition of the PostScript /Line macro to print the intermediate % arrow on each segment of the line @@ -995,11 +752,9 @@ /VPutPos { { VPutLines } HPutCurve } def }> % -\define@key[psset]{pstricks-add}{dashNo}{\def\psk@dashNo{#1}} -\define@key[psset]{pstricks-add}{linecap}{\def\psk@linecap{#1}} \define@key[psset]{pstricks-add}{randomPoints}[1000]{\def\psk@randomPoints{#1}} \define@boolkey[psset]{pstricks-add}[Pst@]{color}[true]{} -%\psset{randomPoints=1000,color=false} +\psset{randomPoints=1000,color=false} % \def\psRandom{\def\pst@par{}\pst@object{psRandom}}% hv 2004-11-12 \def\psRandom@i{\@ifnextchar({\psRandom@ii}{\psRandom@iii(0,0)(1,1)}} @@ -1079,175 +834,7 @@ \end@OpenObj% } % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%% %%%%%%%%%% -%%%%%%%%%%% pst-node %%%%%%%%%% -%%%%%%%%%%% %%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% This fixes a bug in pst-node, where the XY-direction is wrong -% the types are changed 1<->2 between X<->Y -% -\define@key[psset]{}{XnodesepA}{% - \pst@getlength{#1}\psk@nodesepA - \def\psk@nodeseptypeA{2 }% -} -\define@key[psset]{}{XnodesepB}{% - \pst@getlength{#1}\psk@nodesepB - \def\psk@nodeseptypeB{2 }% -} -\define@key[psset]{}{Xnodesep}{% - \pst@getlength{#1}\psk@nodesepA - \let\psk@nodesepB\psk@nodesepA - \def\psk@nodeseptypeA{2 }% - \def\psk@nodeseptypeB{2 }% -} -\define@key[psset]{}{YnodesepA}{% - \pst@getlength{#1}\psk@nodesepA - \def\psk@nodeseptypeA{1 }% -} -\define@key[psset]{}{YnodesepB}{% - \pst@getlength{#1}\psk@nodesepB - \def\psk@nodeseptypeB{1 }% -} -\define@key[psset]{}{Ynodesep}{% - \pst@getlength{#1}\psk@nodesepA - \let\psk@nodesepB\psk@nodesepA - \def\psk@nodeseptypeA{1 }% - \def\psk@nodeseptypeB{1 }% -} -% -% \psGetNodeCenter defines the PS variable #1.x and #1.y, which can then -% be used by the user. #1 must be a valid node name -\def\psGetNodeCenter#1{ tx@NodeDict begin /N@#1 load GetCenter end % x y on stack in system coor - \pst@number\psyunit div /#1.y ED % /#1.y in user coor - \pst@number\psxunit div /#1.x ED } % /#1.x in user coor -\def\psGetNodeEdge#1{ tx@NodeDict begin /N@#1 load 1 GetEdge end % x y on stack in system coor - \pst@number\psyunit div /#1.y ED % /#1.y in user coor - \pst@number\psxunit div /#1.x ED } % /#1.x in user coor -% -\define@key[psset]{pstricks-add}{lineAngle}[0]{% - \ifdim#1pt=\z@\else\psset{armB=0.5}\fi - \def\psk@lineAngle{#1}}% -%\psset{lineAngle=0}% -% -\pst@def{NCDiag}<{ - GetEdgeA GetEdgeB GetArmA GetArmB mark - \psk@lineAngle\space abs 0 gt { - /xTemp xA2 10 add def - /yTemp yA2 \psk@lineAngle\space dup sin exch cos div 10 mul add def - /dY1 yTemp yA2 sub def - /dX1 xTemp xA2 sub def - /dY2 yB2 yB1 sub def - /dX2 xB2 xB1 sub def - dX1 abs 0.01 lt { - /m2 dY2 dX2 div def - /xB2 xA2 def - /yB2 xA2 xB1 sub m2 mul yB1 add def - }{ - dX2 abs 0.01 lt { - /m1 dY1 dX1 div def - /xB2 xB1 def - /yB2 xB1 xA2 sub m1 mul yA2 add def - }{% - /m1 dY1 dX1 div def - /m2 dY2 dX2 div def - /xB2 m1 xA2 mul m2 xB1 mul sub yA2 sub yB1 add m1 m2 sub div def - /yB2 xB2 xA2 sub m1 mul yA2 add def - } ifelse - } ifelse - } if - ArmB 0 ne { xB1 yB1 } if - xB2 yB2 xA2 yA2 - ArmA 0 ne { xA1 yA1 } if - tx@Dict begin false Line end - /LPutVar [ xB1 yB1 xB2 yB2 xA2 yA2 xA1 yA1 ] cvx def - /LPutPos { LPutLines } def - /HPutPos { HPutLines } def - /VPutPos { VPutLines } def -}> -% hv 2003-12-22 -\pst@def{NCDiagg}<{ - GetEdgeA GetArmA \psk@lineAngle\space abs 0 gt { \psk@lineAngle\space } - { yB yA2 sub xB xA2 sub Atan 180 add } ifelse /AngleB ED - GetEdgeB mark - \psk@lineAngle\space abs 0 gt { - /dY2 yA2 yA1 sub def - /dX2 xA2 xA1 sub def - \psk@lineAngle\space abs 90 eq { - /m2 dY2 dX2 div def - /yA2 xB xA2 sub m2 mul yA2 add def - /xA2 xB def - }{ - /m1 \psk@lineAngle\space dup sin exch cos div def % tan alpha - dX2 abs 0.01 lt { - /yA2 xA1 xB sub m1 mul yB add def - /xA2 xA1 def - }{% - /m2 dY2 dX2 div def - /xA2 m1 xB mul m2 xA2 mul sub yA2 add yB sub m1 m2 sub div def - /yA2 xA2 xB sub m1 mul yB add def - } ifelse - } ifelse - } if - xB1 yB1 xA2 yA2 - ArmA 0 ne { xA1 yA1 } if - tx@Dict begin false Line end - /LPutVar [ xB1 yB1 xA2 yA2 xA1 yA1 ] cvx def - /LPutPos { LPutLines } def - /HPutPos { HPutLines } def - /VPutPos { VPutLines } def -}> -% -\def\ncbarr{\def\pst@par{}\pst@object{ncbarr}} -\def\ncbarr@i#1#2{ - \begingroup - \use@par% - \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 - \ifdim\pst@dimm=\z@\else\ifdim\pst@dimm=\pst@dimn\else\psset{angleA=0}\fi\fi - \ncbar[arrows=-]{#1}{barr@tempNode} - \ifdim\psk@angleA pt=\z@\relax - \ncbar[angleA=180,angleB=180]{barr@tempNode}{#2} - \else\ncbar[angleA=0,angleB=0]{barr@tempNode}{#2}\fi% - \endgroup -} -% #1-------#4----------------#2 -% where #1#4= #3 * #1#2 -% -\def\psLNode(#1)(#2)#3#4{% - \pst@getcoor{#1}\pst@tempA% - \pst@getcoor{#2}\pst@tempB% - \pnode(!% - \pst@tempA /YA exch \pst@number\psyunit div def - /XA exch \pst@number\psxunit div def - \pst@tempB /YB exch \pst@number\psyunit div def - /XB exch \pst@number\psxunit div def - /dx XB XA sub def - /dy YB YA sub def - XA dx #3\space mul add YA dy #3\space mul add){#4} -} -% -% build the linear combination #2*#1+#4*#3=#5 -\def\psLCNode(#1)#2(#3)#4#5{% - \pst@getcoor{#1}\pst@tempA% - \pst@getcoor{#3}\pst@tempB% - \pnode(!% - \pst@tempA /YA exch \pst@number\psyunit div def - /XA exch \pst@number\psxunit div def - \pst@tempB /YB exch \pst@number\psyunit div def - /XB exch \pst@number\psxunit div def - XA #2\space mul XB #4\space mul add - YA #2\space mul YB #4\space mul add){#5}% -} -% -% -\define@boolkey[psset]{pstricks-add}[Pst@]{trueAngle}[true]{} -%\psset{trueAngle=false} -% -\def\psRelNode{\def\pst@par{}\pst@object{psRelNode}} +\def\psRelNode{\pst@object{psRelNode}} \def\psRelNode@i(#1)(#2)#3#4{{% A - B - factor - node name \use@par \pst@getcoor{#1}\pst@tempA% @@ -1349,30 +936,6 @@ } ifelse ){#5}% } % -\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% - \pssetlength\pst@dimp{#3}% - \pnode(!% - \pst@tempA /YA exch \pst@number\psyunit div def - /XA exch \pst@number\psxunit div def - \pst@tempB /YB exch \pst@number\psyunit div def - /XB exch \pst@number\psxunit div def - /dx XB XA sub def - /dy YB YA sub def - /angle dy dx Atan def - /linelength \pst@number\pst@dimp \pst@number\psunit div def - XA linelength angle cos mul add YA linelength angle sin mul add ){#4}% -} -\def\nlput{\def\pst@par{}\pst@object{nlput}} -\def\nlput@i(#1)(#2)#3#4{% - \begin@SpecialObj - \psLDNode(#1)(#2){#3}{temp@lnput} - \pcline[linestyle=none](#1)(temp@lnput)% - \ncput[npos=1]{#4}% - \end@SpecialObj -}% \define@cmdkeys[psset]{pstricks-add}[PSTPSPNk@]{% Christophe Jorssen 2007 blName,bcName,brName, clName,ccName,crName, @@ -1405,1320 +968,6 @@ \endgroup \ignorespaces} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%% %%%%%%%%%% -%%%%%%%%%%% pst-plot %%%%%%%%%% -%%%%%%%%%%% %%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -%the following works only for plotstyle line, polygon and bezier -\define@key[psset]{pstricks-add}{yMaxValue}[-1.0]{\def\psk@yMaxValue{#1 }} -\psset{yMaxValue=-1.0} -% can be in PS syntax (eg 1e1.2) and must be positiv! negative values -% will beignored -% -% For quick plots, define: -% \beginqp@ : What to do to first point (PS code only). -% \doqp@ : What to do to subsequent points (PS code only). -% \endqp@ : How to end plot. -% \testqp@ : Set \@psttrue if OK to use quick plot. - -\def\doqp@line{ - \psk@yMaxValue 0 gt - { dup abs - \psk@yMaxValue \pst@number\psyunit mul gt - { moveto }{ L } ifelse } - { L } ifelse -} -\def\doqp@polygon{ - \psk@yMaxValue 0 gt - { dup abs - \psk@yMaxValue \pst@number\psyunit mul gt - { moveto }{ L } ifelse } - { L } ifelse -} -\def\doqp@bezier{/n n 1 add def n 3 mod 0 eq { % we need 3 points - \psk@yMaxValue 0 gt - { dup % last y value - abs \psk@yMaxValue\space \pst@number\psyunit mul gt - { moveto pop pop pop pop }{ curveto } ifelse } - { curveto } ifelse - } if -} -% -% Euclide Algorithm (macro by Jean-Come Charpentier) -% #1 : numerator (number.unit) (e.g. 4.\pi or 3.\ell or 12.a) -% #2 : denominator -\def\psIrFrac#1#2{{% - % extrait le num'erateur et l'unit'e - \ps@extract@unit#1\@nil - % d'enominateur - \pst@cntb=#2\relax - \pst@cntc=\@ne - % test du signe et op'erandes toutes positives - \ifnum\pst@cnta<\z@ - \pst@cntc=-\pst@cntc - \pst@cnta=-\pst@cnta - \fi - \ifnum\pst@cntb<\z@ - \pst@cntc=-\pst@cntc - \pst@cntb=-\pst@cntb - \fi - \ifnum\pst@cntc=\@ne - \def\ps@ir@sign{}% - \else - \def\ps@ir@sign{-}% - \fi - % calcul pgcd - \loop - \pst@cntd=\pst@cnta - \pst@cntc=\pst@cnta - \divide\pst@cntd\pst@cntb - \multiply\pst@cntd\pst@cntb - \advance\pst@cntc-\pst@cntd - \ifnum\pst@cntc>\z@ - \pst@cnta=\pst@cntb - \pst@cntb=\pst@cntc - \repeat - % pgcd dans \ir@r - \pst@cntc=\pst@cntb - \pst@cnta=\ps@ir@num - \pst@cntb=#2\relax - % op'erandes toutes positives - \ifnum\pst@cnta<\z@ - \pst@cnta=-\pst@cnta - \fi - \ifnum\pst@cntb<\z@ - \pst@cntb=-\pst@cntb - \fi - % division par le pgcd - \divide\pst@cnta\pst@cntc - \divide\pst@cntb\pst@cntc - % affichage - \ifnum\pst@cnta=\z@ - 0% - \else\ifnum\pst@cnta=\@ne - \ifnum\pst@cntb=\@ne - \ps@ir@sign\ps@ir@unit% - \else - \frac{\ps@ir@sign\ps@ir@unit}{\the\pst@cntb}% - \fi - \else - \ifnum\pst@cntb=\@ne - \ps@ir@sign\the\pst@cnta\ps@ir@unit% - \else - \frac{\ps@ir@sign\the\pst@cnta\ps@ir@unit}{\the\pst@cntb}% - \fi - \fi\fi -}} -% -\def\ps@extract@unit#1.#2\@nil{% - \pst@cnta=#1\relax - \def\ps@ir@num{#1}% sauvegarde (le pgcd 'ecrase la valeur \ir@a) - \def\ps@ir@unit{#2}% -} -% -\define@key[psset]{pstricks-add}{labelFontSize}[{}]{\def\psk@labelFontSize{#1}}% -\define@boolkey[psset]{pstricks-add}[Pst@]{mathLabel}[true]{% - \ifPst@mathLabel% - \def\pshlabel##1{$\psk@labelFontSize##1$}% - \def\psvlabel##1{$\psk@labelFontSize##1$}% - \else% - \def\pshlabel##1{\psk@labelFontSize##1}% - \def\psvlabel##1{\psk@labelFontSize##1}% - \fi} -%\psset{labelFontSize={},mathLabel} -% -\define@key[psset]{pstricks-add}{decimalSeparator}[.]{\def\psk@decimalSeparator{#1}}% -\define@boolkey[psset]{pstricks-add}[Pst@]{comma}[true]{% - \ifPst@comma\def\psk@decimalSeparator{,}\else\def\psk@decimalSeparator{.}\fi} -\define@boolkey[psset]{pstricks-add}[Pst@]{xAxis}[true]{} -\define@boolkey[psset]{pstricks-add}[Pst@]{yAxis}[true]{} -\define@boolkey[psset]{pstricks-add}[Pst@]{xyAxes}[true]{% - \@nameuse{Pst@xAxis#1}\@nameuse{Pst@yAxis#1}}% -%\psset{decimalSeparator=.}% -% -\define@key[psset]{pstricks-add}{xlabelPos}[b]{\pst@expandafter\psset@@xlabelPos{#1}\@nil} -\define@key[psset]{pstricks-add}{ylabelPos}[l]{\pst@expandafter\psset@@ylabelPos{#1}\@nil} -\def\psset@@xlabelPos#1#2\@nil{% - \ifx#1t - \def\psk@xlabelPos{\tw@}% 2=top - \pst@xticksizeC=\pst@xticksizeB% - \else - \ifx#1a - \def\psk@xlabelPos{\@ne}% 1=axis - \pst@xticksizeC=\z@% - \else - \def\psk@xlabelPos{\z@}% 0=bottom - \pst@xticksizeC=\pst@xticksizeA% - \fi\fi}% -\def\psset@@ylabelPos#1#2\@nil{% - \ifx#1r - \def\psk@ylabelPos{\tw@}% 2=right - \pst@yticksizeC=\pst@yticksizeB% - \else - \ifx#1a - \def\psk@ylabelPos{\@ne}% 1=axis - \pst@yticksizeC=\z@% - \else - \def\psk@ylabelPos{\z@}% 0=left - \pst@yticksizeC=\pst@yticksizeA% - \fi\fi} -%\psset{xlabelPos=b, ylabelPos=l}% -% -\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]{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={}}% -% -\define@key[psset]{pstricks-add}{trigLabelBase}[0]{\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\psk@trigLabelBase<2 - \def\de@nominator{\@ne}\else\def\de@nominator{\psk@trigLabelBase}\fi - \def\pst@tempA{##1} - \pst@abs{\pst@tempA}\pst@cntm - \pst@mod{\pst@cntm}{\de@nominator}\pst@cntp % cntb=##1 modulo trigLabelBase - \ifnum\@ne>\pst@cntp % 1 > modulo -> then we have pi/x - \pst@cnto=\pst@cntm \divide\pst@cnto by \de@nominator - \ifPst@mathLabel% - $\psk@labelFontSize - \ifnum\pst@tempA<0 -\fi - \ifnum\pst@cnto=\@ne % #1 = trigLabelBase - \pi % print pi - \else - \the\pst@cnto\pi % print \pst@cnto/\de@nominator pi - \fi$% - \else% - \psk@labelFontSize% - \ifnum\pst@tempA<0 -\fi% - \ifnum\pst@cnto=\@ne% % #1 = trigLabelBase - $\pi$% % print pi - \else% - \the\pst@cnto$\pi$% % print \pst@cnto/\de@nominator pi - \fi% - \fi% - \else% - \ifPst@mathLabel% - $\psk@labelFontSize% - \ifnum\pst@cntp=\@ne% % < 1 pi? - \if\pst@cntm=\@ne% - \frac{\pi}{\de@nominator}% % pi/x - \else\ifnum\pst@tempA=-1 \frac{-\pi}{\de@nominator}% - \else \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator}% - \else\frac{\pst@tempA\pi}{\de@nominator}% (x pi)/y - \fi\fi\fi% - \else% - \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator}% - \else\ifnum\pst@tempA=\de@nominator \pi% - \else\frac{\pst@tempA\pi}{\de@nominator}% - \fi\fi\fi$% - \else% - \psk@labelFontSize% - \ifnum\pst@cntp=\@ne% % < 1 pi? - \if\pst@cntm=\@ne% - $\frac{\pi}{\de@nominator}$% % pi/x - \else\ifnum\pst@tempA=-1 $\frac{-\pi}{\de@nominator}$% - \else \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$% - \else$\frac{\pst@tempA\pi}{\de@nominator}$% (x pi)/y - \fi\fi\fi% - \else% - \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$% - \else\ifnum\pst@tempA=\de@nominator $\pi$% - \else$\frac{\pst@tempA\pi}{\de@nominator}$% - \fi\fi\fi% - \fi% - \fi% - }% - \else% - \def\pst@@@hlabel##1{% - \edef\@xyDecimals{\psk@xDecimals}% - \ifnum\psk@ticks<\tw@% ticks=all|x - \ifx\psk@xlogBase\@empty% - \pshlabel{\psk@labelFontSize\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}% - \else% - \pshlabel{\psk@labelFontSize\psk@xlogBase\textsuperscript{\expandafter\@stripDecimals##1..\@nil}}% - \fi% - \fi% - }% - \ifPst@mathLabel% - \def\pshlabel##1{$\psk@labelFontSize##1$}\else% - \def\pshlabel##1{\psk@labelFontSize##1}% - \fi% - \fi% -}% -\psset{trigLabels=false} -% -%logLines=all|x|y|none (0,1,2,3) -\def\psk@logLines{3} -\define@key[psset]{pstricks-add}{logLines}[none]{\pst@expandafter\psset@@logLines#1\@nil\psk@logLines} -\def\psset@@logLines#1#2\@nil#3{% - \ifx#1a - \let#3\z@ - \Pst@maxxTickstrue\Pst@maxyTickstrue - \set@xticksize{0 4pt}\set@yticksize{0 4pt}% - \def\psk@xsubticksize{1}\def\psk@ysubticksize{1}% - \else - \ifx#1x - \let#3\@ne - \Pst@maxxTickstrue\Pst@maxyTicksfalse - \set@xticksize{0 4pt}\def\psk@xsubticksize{1}% - \else - \ifx#1y - \let#3\tw@ - \Pst@maxyTickstrue\Pst@maxxTicksfalse - \set@yticksize{0 4pt}\def\psk@ysubticksize{1}% - \else - \ifx#1n\let#3\thr@@\else - \@pstrickserr{Bad argument: `#1#2'}\@ehpa - \fi\fi\fi\fi} -%\psset{logLines=none}% -% -% 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]{pstricks-add}{ylabelFactor}[\relax]{\def\psk@ylabelFactor{#1}} -\define@key[psset]{pstricks-add}{xlabelFactor}[\relax]{\def\psk@xlabelFactor{#1}} -\define@boolkey[psset]{pstricks-add}[Pst@]{showOriginTick}[true]{}% -%\psset{xlabelFactor=\relax,ylabelFactor=\relax}% - -%% #1 : optional arguments passed to psline -%% #2 : x value -%% #3 : label -\def\psxTick{\def\pst@par{}\pst@object{psxTick}}% idea by Martin Chicoine -\def\psxTick@i(#1)#2{{ - \pst@killglue - \addbefore@par{arrows=-,linewidth=\psk@xtickwidth\pslinewidth} - \use@par - \psline(#1,\pst@xticksizeB)(#1,\pst@xticksizeA) - \rput[t](! \psk@origin - #1 \pst@number\pslabelsep \pst@number\pst@xticksizeB add - \pst@number\psyunit div neg ){\pshlabel{#2\vphantom{1}}}}\ignorespaces} -% -%% #1 : optional arguments passed to psline -%% #2 : y value -%% #3 : label -\def\psyTick{\def\pst@par{}\pst@object{psyTick}}% idea by Martin Chicoine -\def\psyTick@i(#1)#2{{ - \pst@killglue - \addbefore@par{arrows=-,linewidth=\psk@ytickwidth\pslinewidth} - \use@par - \psline(\pst@yticksizeB,#1)(\pst@yticksizeA,#1) - \rput[r]{0}(! \psk@origin - \pst@number\pst@yticksizeB \pst@number\pslabelsep add - \pst@number\psxunit div neg #1){\psvlabel{#2}}}\ignorespaces} -% -%% #1 integer -%% #2 decimals -%% #3 dot -\def\@stripDecimals#1.#2.#3\@nil{% - \def\pst@dummy{#1}% - \ifx\pst@dummy\@empty\the\@zero\else#1\fi% the integer part -} -% -\def\pst@@@vlabel#1{% - \edef\@xyDecimals{\psk@yDecimals}% -% \psk@yLabel% - \ifodd\psk@ticks% ticks=all||y (0,2) - \else% - \ifx\psk@ylogBase\@empty% -% \ifPst@comma - \psvlabel{\expandafter\@LabelComma#1..\@nil\psk@ylabelFactor}% -% \else\psvlabel{#1\psk@ylabelFactor}\fi% - \else% - \psvlabel{\psk@ylogBase\textsuperscript{\expandafter\@stripDecimals#1..\@nil }}% - \fi% - \fi% -} -\newcount\@digitcounter\@digitcounter=0\relax -\def\@inc@digitcounter{\global\advance\@digitcounter by 1\relax} -\def\@get@digitcounter{\the\@digitcounter\relax} -\def\@Reset@digitcounter{\global\@digitcounter=0\relax} -\def\@zeroFill{% - \ifnum \@xyDecimals>\@get@digitcounter - \bgroup - 0\@inc@digitcounter\@zeroFill - \egroup% - \fi% -} -% #1 the value, maybe empty -% -\def\@process@digits#1#2;{% - \ifx *#1\@zeroFill\else#1\@inc@digitcounter - \ifnum\@xyDecimals>\@get@digitcounter\expandafter\@process@digits#2;\fi\fi% -} -% -\def\@writeDecimals#1{% - \ifx\@xyDecimals\@empty% take value as is - \def\@tempa{#1}% write only if not empty - \ifx\@tempa\@empty% write nothing - \else\ifmmode\expandafter\mathord\expandafter{\psk@decimalSeparator}\else\psk@decimalSeparator\fi#1\fi% -% \else\psk@decimalSeparator\fi% - \else% write only \xy@decimals - \ifnum\@xyDecimals>\@zero - \ifmmode\expandafter\mathord\expandafter{\psk@decimalSeparator}\else\psk@decimalSeparator\fi% -% \psk@decimalSeparator - \@Reset@digitcounter - \expandafter\@process@digits#1*; - \fi% - \fi% -} -%% #1 integer -%% #2 decimals -%% #3 dot -\def\@LabelComma#1.#2.#3\@nil{% - \def\pst@tempA{#1}% - \ifx\pst@tempA\@empty\the\@zero\else#1\fi% the integer part - \def\pst@tempA{#2}% - \ifx\pst@tempA\@empty\@writeDecimals{}\else\@writeDecimals{#2}\fi} -% -\def\psxs@none{% - \let\psk@arrowA\@empty% - \let\psk@arrowB\@empty% - \psxs@axes} -% -% -\def\psxs@axes{{% - \ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}\fi% - \ifPst@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}{y}\fi}} -% -\def\psaxes{\def\pst@par{}\pst@object{psaxes}} -\def\psaxes@i{\pst@getarrows\psaxes@ii} -\def\psaxes@ii(#1){\@ifnextchar({\psaxes@iii(#1)}{\psaxes@iv(0,0)(0,0)(#1)}} -\def\psaxes@iii(#1)(#2){\@ifnextchar({\psaxes@iv(#1)(#2)}{\psaxes@iv(#1)(#1)(#2)}} -\def\psaxes@iv(#1)(#2)(#3){\@ifnextchar[{\psaxes@v(#1)(#2)(#3)}{\psaxes@vii(#1)(#2)(#3)}}% -\def\psaxes@v(#1)(#2)(#3)[#4]{\@ifnextchar[{\psaxes@vi(#1)(#2)(#3)[#4]}{\psaxes@vi(#1)(#2)(#3)[#4][]}}% -\def\psaxes@vi(#1)(#2)(#3)[#4,#5][#6,#7]{% - \psaxes@vii(#1)(#2)(#3)% - \begingroup% - \use@par% - \uput{\pslabelsep}[#5](#3|#1){#4}\uput{\pslabelsep}[#7](#1|#3){#6}% - \endgroup% - \ignorespaces% -} -% -\def\psaxes@vii(#1,#2)(#3,#4)(#5,#6){% - \pst@killglue% - \begingroup% - \pssetxlength\pst@dimc{#5}% ur-x - \pssetylength\pst@dimd{#6}% ur-y - \ifdim\pst@dimc<\z@\ifdim\pst@dimd<\z@% axes show to left and down - \addbefore@par{xlabelPos=top,ylabelPos=right}\fi\fi% - \setbox\pst@hbox=\hbox\bgroup% - \use@par% now the same with an optional unit=... in par - \pssetxlength\pst@dimg{#1}% o-x - \pssetylength\pst@dimh{#2}% o-y - \pssetxlength\pst@dima{#3}% ll-x - \pssetylength\pst@dimb{#4}% ll-y - \pssetxlength\pst@dimc{#5}% ur-x - \pssetylength\pst@dimd{#6}% ur-y -% 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) -% -% Whole thing will be translated to origin: - \advance\pst@dima by -\pst@dimg% Dist. from ll-x to o-x - \advance\pst@dimb by -\pst@dimh% Dist. from ll-y to o-y - \advance\pst@dimc by -\pst@dimg% Dist. from ur-x to o-x - \advance\pst@dimd by -\pst@dimh% Dist. from ur-y to o-y -% Make lines/arrows or frame: - \@nameuse{psxs@\psk@axesstyle}% \psxs@axes or \psxs@frame or \psxs@polar - \ifPst@yAxis% - \begingroup% - \ifdim\pst@dima=\z@\else\showoriginfalse\fi% - \ifnum\psk@dy=\z@% - \pst@dimg=\psk@Dy\psyunit% - \ifdim\pst@dimg<\p@\pst@cnta=\psk@Dy\edef\psk@Dy{-\the\pst@cnta}\fi% v.1.21 - \edef\psk@dy{\number\pst@dimg}% - \fi% -% \ifPst@xAxis\else\showorigintrue\fi% 2009-10-21 - \pst@vlabels{\pst@dimd}{\psk@arrowB}{#3}{#5}% - \ifPst@xAxis\showoriginfalse\fi% - \pst@vlabels{\pst@dimb}{\psk@arrowA}{#3}{#5}% - \endgroup% - \fi% - \ifPst@xAxis% - \begingroup% - \ifdim\pst@dimb=\z@\else\showoriginfalse\fi% - \ifnum\psk@dx=\z@% - \pst@dimg=\psk@Dx\psxunit% - \ifdim\pst@dimg<\p@\pst@cnta=\psk@Dx\edef\psk@Dx{-\the\pst@cnta}% v.1.21 - \fi% v.1.21 - \edef\psk@dx{\number\pst@dimg}% - \fi% -% \ifPst@yAxis\else\showorigintrue\fi% 2009-10-21 - \pst@hlabels{\pst@dimc}{\psk@arrowB}{#4}{#6}% - \ifPst@yAxis\showoriginfalse\fi% - \pst@hlabels{\pst@dima}{\psk@arrowA}{#4}{#6}% - \endgroup% - \fi% -% Now close "\pst@hbox" (which is 0-dimensional), and put it at the origin. - \egroup% - \pssetxlength\pst@dimg{#1}% - \pssetylength\pst@dimh{#2}% - \leavevmode\psput@cartesian\pst@hbox% - \endgroup% - \ignorespaces% -} -% -\newdimen\psk@subticksize\psk@subticksize=\z@ -\newdimen\pst@xticksizeA -\newdimen\pst@xticksizeB -\newdimen\pst@xticksizeC -\newdimen\pst@yticksizeA -\newdimen\pst@yticksizeB -\newdimen\pst@yticksizeC -% -\def\set@xticksize#1{% - \pst@expandafter\pst@getydimdim{#1} {} {}\@nil % y-unit!! - \ifdim\pst@dimm>\pst@dimn % first > second value - \pst@xticksizeA=\the\pst@dimn% - \pst@xticksizeB=\the\pst@dimm% - \else - \pst@xticksizeA=\the\pst@dimm% - \pst@xticksizeB=\the\pst@dimn% first > second value - \fi - \edef\psk@xticksize{\pst@number\pst@xticksizeA \pst@number\pst@xticksizeB}% - \ifnum\psk@xlabelPos<\z@ % top - \pst@xticksizeC=\pst@dimn - \else - \pst@xticksizeC=\pst@dimm% bottom - \fi% -} -\def\set@yticksize#1{% - \pst@expandafter\pst@getxdimdim{#1} {} {}\@nil % x-unit! - \ifdim\pst@dimm>\pst@dimn % first > second value - \pst@yticksizeA=\the\pst@dimn% - \pst@yticksizeB=\the\pst@dimm% - \else - \pst@yticksizeA=\the\pst@dimm% - \pst@yticksizeB=\the\pst@dimn% first > second value - \fi - \edef\psk@yticksize{\pst@number\pst@yticksizeA \pst@number\pst@yticksizeB}% - \ifnum\psk@ylabelPos<\z@ % right - \pst@yticksizeC=\pst@dimn - \else - \pst@yticksizeC=\pst@dimo% left - \fi% -} -\newif\ifPst@maxxTicks -\newif\ifPst@maxyTicks -\define@key[psset]{}{ticksize}{% - \psDEBUG[key:ticksize]{setting ticksize} - \def\pst@tempA{max}% - \def\pst@tempB{#1}% - \ifx\pst@tempA\pst@tempB - \psDEBUG[key:ticksize]{setting ticksize to max} - \Pst@maxxTickstrue\Pst@maxyTickstrue - \set@xticksize{0 4pt}\set@yticksize{0 4pt}% - \else - \psDEBUG[key:ticksize]{setting ticksize to user values} - \Pst@maxxTicksfalse\Pst@maxyTicksfalse% - \set@xticksize{#1}\set@yticksize{#1}% - \fi} -\define@key[psset]{pstricks-add}{xticksize}{% - \def\pst@tempA{max}% - \def\pst@tempB{#1}% - \ifx\pst@tempA\pst@tempB - \Pst@maxxTickstrue\set@xticksize{0 4pt}% - \psDEBUG[key:xticksize]{setting ticksize to max} - \else\set@xticksize{#1}\Pst@maxxTicksfalse\fi} -\define@key[psset]{pstricks-add}{yticksize}{% - \def\pst@tempA{max}% - \def\pst@tempB{#1}% - \ifx\pst@tempA\pst@tempB - \psDEBUG[key:yticksize]{setting ticksize to max} - \Pst@maxyTickstrue\set@yticksize{0 4pt}% - \else\set@yticksize{#1}\Pst@maxyTicksfalse\fi}% overwrites the definition in pstricks -%\psset{ticksize=-4pt 4pt} -% -% full= 0, top=1, bottom=-1, inner=2 => -1 0 1 2 -\def\psset@tickstyle#1{\pst@expandafter\psset@@tickstyle{#1}\@nil}% overwrite it -\def\psset@@tickstyle#1#2\@nil{% - \ifx#1f\let\psk@tickstyle\z@\else % full - \ifx#1t\let\psk@tickstyle\@ne % top - \edef\psk@xticksize{0 \pst@number\pst@xticksizeB}% - \edef\psk@yticksize{0 \pst@number\pst@yticksizeB}% - \else\ifx#1b\let\psk@tickstyle\m@ne % bottom - \edef\psk@xticksize{\pst@number\pst@xticksizeA 0}% - \edef\psk@yticksize{\pst@number\pst@yticksizeA 0}% - \else\ifx#1i\let\psk@tickstyle\tw@% % inner (for frame) - \else\@pstrickserr{Bad tick style: `#1#2'}\@ehpa - \fi\fi\fi\fi -} -% -\define@key[psset]{pstricks-add}{subticks}[1]{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}} -\define@key[psset]{pstricks-add}{xsubticks}[1]{\def\psk@xsubticks{#1}} -\define@key[psset]{pstricks-add}{ysubticks}[1]{\def\psk@ysubticks{#1}} -% -\define@key[psset]{pstricks-add}{subticksize}[0.75]{\def\psk@xsubticksize{#1}\def\psk@ysubticksize{#1}} -\define@key[psset]{pstricks-add}{xsubticksize}[0.75]{\def\psk@xsubticksize{#1}} -\define@key[psset]{pstricks-add}{ysubticksize}[0.75]{\def\psk@ysubticksize{#1}} -% -\define@key[psset]{pstricks-add}{tickwidth}[0.5\pslinewidth]{% - \pst@getlength{#1}\psk@xtickwidth% - \pst@getlength{#1}\psk@ytickwidth} -\define@key[psset]{pstricks-add}{xtickwidth}[0.5\pslinewidth]{\pst@getlength{#1}\psk@xtickwidth} -\define@key[psset]{pstricks-add}{ytickwidth}[0.5\pslinewidth]{\pst@getlength{#1}\psk@ytickwidth} -\define@key[psset]{pstricks-add}{subtickwidth}[0.25\pslinewidth]{% - \pst@getlength{#1}\psk@xsubtickwidth% - \pst@getlength{#1}\psk@ysubtickwidth} -\define@key[psset]{pstricks-add}{xsubtickwidth}[0.25\pslinewidth]{\pst@getlength{#1}\psk@xsubtickwidth} -\define@key[psset]{pstricks-add}{ysubtickwidth}[0.25\pslinewidth]{\pst@getlength{#1}\psk@ysubtickwidth} -% -\define@key[psset]{pstricks-add}{tickcolor}[black]{% - \pst@getcolor{#1}\psk@xtickcolor% - \pst@getcolor{#1}\psk@ytickcolor} -\define@key[psset]{pstricks-add}{xtickcolor}[black]{\pst@getcolor{#1}\psk@xtickcolor} -\define@key[psset]{pstricks-add}{ytickcolor}[black]{\pst@getcolor{#1}\psk@ytickcolor} -\define@key[psset]{pstricks-add}{subtickcolor}[gray]{% - \pst@getcolor{#1}\psk@xsubtickcolor% - \pst@getcolor{#1}\psk@ysubtickcolor} -\define@key[psset]{pstricks-add}{xsubtickcolor}[gray]{\pst@getcolor{#1}\psk@xsubtickcolor} -\define@key[psset]{pstricks-add}{ysubtickcolor}[gray]{\pst@getcolor{#1}\psk@ysubtickcolor} -% -\define@key[psset]{pstricks-add}{xticklinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psxticklinestyle{#1}}} -\define@key[psset]{pstricks-add}{xsubticklinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psxsubticklinestyle{#1}}} -\define@key[psset]{pstricks-add}{yticklinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psyticklinestyle{#1}}} -\define@key[psset]{pstricks-add}{ysubticklinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psysubticklinestyle{#1}}} -\define@key[psset]{pstricks-add}{ticklinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psxticklinestyle{#1}\def\psyticklinestyle{#1}}} -\define@key[psset]{pstricks-add}{subticklinestyle}[solid]{% - \@ifundefined{psls@#1}% - {\@pstrickserr{Line style `#1' not defined}\@eha}% - {\def\psxsubticklinestyle{#1}\def\psysubticklinestyle{#1}}} -% -%\psset{subticksize=0.75,subticks=1,tickcolor=black,ticklinestyle=solid,% -% subticklinestyle=solid,% -% subtickcolor=gray,% -% tickwidth=0.5\pslinewidth,% -% subtickwidth=0.25\pslinewidth} -% -\newif\ifis@yAxis% -% -\def\psxs@@axes#1#2#3#4#5#6{% llx,lly,urx,ury,exch,x|y,arrowA,arrowB - \pst@killglue% - \begin@SpecialObj% - \ifx#6x\relax% % x-axis? - \is@yAxisfalse% - \ifnum\psk@dx=\z@% - \pst@dimg=\psk@Dx\psxunit% - \def\psk@dx{\number\pst@dimg}% - \fi% - \else% - \is@yAxistrue% - \ifnum\psk@dy=\z@% - \pst@dimg=\psk@Dy\psyunit% - \def\psk@dy{\number\pst@dimg}% - \fi% - \fi% - \let\pst@linetype\pst@arrowtype% - \def\pst@tempA{none}% - \pst@addarrowdef% - \addto@pscode{ - /showOrigin \ifPst@showOriginTick true \else false \fi def % ticks for 0/0 ? - \ifis@yAxis 0 \pst@number#4 \else \pst@number#3 0 \fi - \ifis@yAxis 0 \pst@number#2 \else \pst@number#1 0 \fi - ArrowA - CP 4 2 roll - ArrowB - /yEnd exch def /xEnd exch def - xEnd yEnd - \ifx\psk@axesstyle\pst@tempA - pop pop % axesstyle = none (only ticks) - \else - L % the line with arrows - \fi - /yStart exch def - /xStart exch def - \@nameuse{psls@\pslinestyle} % linestyle for the axes - stroke % draw the main line -% \psk@ticks: all=0; x=1; y=2; none=3 - \number\psk@ticks\space dup 2 mod 0 eq \ifis@yAxis true \else false \fi and - exch 2 lt \ifis@yAxis false \else true \fi and or { - /viceversa - \ifis@yAxis\pst@number#2 \pst@number#4 \else\pst@number#1 \pst@number#3 \fi - gt { true }{ false } ifelse def % other way round - /epsilon 0.01 def % rounding errors - /minTickline \ifis@yAxis \pst@number#1 \else \pst@number#2 \fi def - /maxTickline \ifis@yAxis \pst@number#3 \else \pst@number#4 \fi def - /dT \ifis@yAxis \psk@dy \else \psk@dx \fi\space abs % added abs 2006-07-07 - 65536 div viceversa { neg } if def % div to get pt instead of sp - /subTNo \ifis@yAxis\psk@ysubticks\else\psk@xsubticks\fi \space def - subTNo 0 gt { /dsubT dT subTNo div def}{ /dsubT 0 def } ifelse % deltaSubTick - \ifis@yAxis \psk@yticksize \else \psk@xticksize \fi - /tickend exch def /tickstart exch def - /Twidth \ifis@yAxis \psk@ytickwidth \else \psk@xtickwidth \fi\space def - /subTwidth \ifis@yAxis \psk@ysubtickwidth \else \psk@xsubtickwidth \fi\space def - /STsize \ifis@yAxis \psk@ysubticksize \else \psk@xsubticksize \fi\space def - /TColor { - \ifis@yAxis\pst@usecolor\psk@ytickcolor - \else\pst@usecolor\psk@xtickcolor\fi\space } def - /subTColor { - \ifis@yAxis\pst@usecolor\psk@ysubtickcolor - \else\pst@usecolor\psk@xsubtickcolor\fi\space } def - /MinValue { \ifis@yAxis yStart \else xStart \fi - \ifx\psk@arrowA\@empty\else - \psk@arrowsize\space CLW mul add \psk@arrowlength\space mul - viceversa { sub epsilon add }{ add epsilon sub } ifelse \fi } def - /MaxValue { \ifis@yAxis yEnd \else xEnd \fi - \ifx\psk@arrowB\@empty\else - \psk@arrowsize\space CLW mul add \psk@arrowlength\space mul - viceversa { add epsilon sub }{ sub epsilon add } ifelse \fi } def - /logLines { - \ifnum\psk@logLines=\z@ true \else % all axes - \ifnum\psk@logLines<\tw@ % x axis - \ifis@yAxis false \else true \fi % do we have x or y axis - \else - \ifnum\psk@logLines<\thr@@ % y axis - \ifis@yAxis true \else false \fi % do we have x or y axis - \else - false % no one - \fi - \fi - \fi - } def - /LSstroke { % set linestyle and stroke - \ifis@yAxis\@nameuse{psls@\psyticklinestyle} - \else\@nameuse{psls@\psxticklinestyle}\fi stroke} def - /subLSstroke { % set sublinestyle and stroke - \ifis@yAxis\@nameuse{psls@\psysubticklinestyle} - \else\@nameuse{psls@\psxsubticklinestyle}\fi stroke} def -%\iffalse -% start ticks --------------------------------------------------------- -% showOrigin { 0 }{ dT } ifelse - 0 dT MaxValue 1 add { % the positive part of the axes - /cntTick exch def % the index - logLines { % log lines? - gsave - 1 10 subTNo div 9.99 { % do not write a line for 1 - /dx exch def % save index - /x cntTick dT dx log mul add def % - x abs MaxValue abs le { % out of range? - \ifis@yAxis - \ifPst@maxyTicks true \else false \fi - \else - \ifPst@maxxTicks true \else false \fi - \fi - { x minTickline #5 moveto - x maxTickline #5 lineto } - { x tickstart STsize mul #5 moveto - x tickend STsize mul #5 lineto } ifelse - } if - } for - subTwidth SLW subTColor % set line width and subtick color - subLSstroke - grestore % restore main tick status - stroke - /dsubT 0 def % no other subticks - } if % end logLines - dsubT abs 0 gt { % du we have subticks? - gsave % save graphic state -% start subticks ---------------------------------------------------------- - /cntsubTick cntTick dsubT add def - subTNo 1 sub { - cntsubTick abs MaxValue abs le { % out of range? - \ifis@yAxis - \ifPst@maxyTicks true \else false \fi - \else - \ifPst@maxxTicks true \else false \fi - \fi - { cntsubTick minTickline STsize mul #5 moveto - cntsubTick maxTickline STsize mul #5 lineto } - { cntsubTick tickstart STsize mul #5 moveto - cntsubTick tickend STsize mul #5 lineto } ifelse - }{ exit } ifelse - /cntsubTick cntsubTick dsubT add def - } repeat - subTwidth SLW subTColor % set line width and subtick color - subLSstroke -% end subticks ---------------------------------------------------------- - grestore % restore tick status - } if - showOrigin { - gsave - \ifis@yAxis - \ifPst@maxyTicks true \else false \fi - \else - \ifPst@maxxTicks true \else false \fi - \fi - { cntTick minTickline #5 moveto - cntTick maxTickline #5 lineto } - { cntTick tickstart #5 moveto % line begin main Tick - cntTick tickend #5 lineto } ifelse % lineto tick end - Twidth SLW TColor % set line width and tick color - LSstroke - grestore - }{ /showOrigin true def } ifelse % only for the very first tick valid - } for -% end ticks ---------------------------------------------------------- -%\fi -%\iffalse -% ================================================ % the other side - /showOrigin \ifPst@showOriginTick true \else false \fi def % ticks for 0/0 ? - /dT dT neg def % the other side of the axis - /dsubT dsubT neg def -% start ticks ---------------------------------------------------------- -% showOrigin { 0 }{ dT } ifelse - 0 dT MinValue epsilon viceversa { add }{ sub } ifelse { - /cntTick exch def - logLines { % log lines? - gsave - 1 10 subTNo div 9.99 { % do not write a line for 1 - /dx exch def % save index - /x cntTick dT dx log mul add def % - x abs MinValue abs le { % out of range? - \ifis@yAxis - \ifPst@maxyTicks true \else false \fi - \else - \ifPst@maxxTicks true \else false \fi - \fi - { x minTickline #5 moveto - x maxTickline #5 lineto } - { x tickstart STsize mul #5 moveto - x tickend STsize mul #5 lineto } ifelse - } if - } for - /dsubT 0 def - subTwidth SLW subTColor % set line width and subtick color - subLSstroke - grestore - } % end loglines - dsubT abs 0 gt { % do we have subticks? - gsave % save main state -% start subticks ---------------------------------------------------------- - /cntsubTick cntTick dsubT add def - subTNo 1 sub { - cntsubTick abs MinValue abs le { % out of range? - cntsubTick tickstart STsize mul #5 moveto - cntsubTick tickend STsize mul #5 lineto - }{ exit } ifelse - /cntsubTick cntsubTick dsubT add def - } repeat % for -% end subticks ---------------------------------------------------------- - subTwidth SLW subTColor % set line width and subtick color - subLSstroke - grestore % restore main state - } if - showOrigin { - gsave - cntTick tickstart #5 moveto % line begin main Tick - cntTick tickend #5 lineto % lineto tick end - Twidth SLW TColor % set line width and tick color - LSstroke - grestore - }{ /showOrigin true def } ifelse % only for the very first tick valid - } for -% end ticks ---------------------------------------------------------- -%\fi - } if% - }% end of \pscode - \end@SpecialObj% - \ignorespaces% -}% -% -% -\def\psxs@frame{% - \begin@SpecialObj% - \addto@pscode{ % the frame - \pst@number\pst@dima \pst@number\pst@dimb moveto % lower left - \pst@number\pst@dimc \pst@number\pst@dimb L % upper left - \pst@number\pst@dimc \pst@number\pst@dimd L % upper right - \pst@number\pst@dima \pst@number\pst@dimd L % lower right - closepath - }% - \pst@stroke% - \psk@fillstyle% - \end@SpecialObj% - \let\psk@arrowA\@empty% - \let\psk@arrowB\@empty% - \pst@xticksizeC=\z@\pst@yticksizeC=\z@% - \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}% x axis - \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ exch }{y}% y axis - \ifnum\psk@tickstyle=\tw@ % llx,lly,urx,ury,exch,x|y,arrowA,arrowB - \psDEBUG[psxs@frame]{psk@tickstyle=2 (inner)}% - \psDEBUG[psxs@frame]{pst@dima=\pst@number\pst@dima}% - \psDEBUG[psxs@frame]{pst@dimb=\pst@number\pst@dimb}% - \psDEBUG[psxs@frame]{pst@dimc=\pst@number\pst@dimc}% - \psDEBUG[psxs@frame]{pst@dimd=\pst@number\pst@dimd}% - \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ neg \pst@number\pst@dimd add }{x}% % upper x axis - \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ neg \pst@number\pst@dimc add exch }{y}% right y axis - \fi% -} -% -\def\psxs@polar{% (rx,ry) % all other values are ignored - \pst@killglue - \begingroup - \edef\pst@dimC{\strip@pt\pst@dimc}% RadiusX - \pstFPDiv\pstR@dius{\pst@dimC}{\strip@pt\psxunit}% in cm and as int - \addbefore@par{Dy=30}% for the angle step - \use@keep@par - \pstFPDiv\pstN@lpha{360}{\psk@Dy}% No of (int) main lines - \pstFPdiv\pstd@lpha{\psk@Dy}{\psk@ysubticks}% sub dAlpha - \pstFPdiv\pstdR@dius{1}{\psk@xsubticks}% sub dRadius - \pst@cntm=\psk@xsubticks\advance\pst@cntm by \m@ne - \multido{\iA=\psk@Dx+\psk@Dx,\rB=\pstdR@dius+\psk@Dx,\iB=0+1}{\pstR@dius}{% - \multido{\rA=\rB+\pstdR@dius}{\the\pst@cntm}{\pscircle[linestyle=\psxsubticklinestyle, - linecolor=\psk@xsubtickcolor,linewidth=\psk@xsubtickwidth pt]{\rA}} - \pscircle[linestyle=\psxticklinestyle,linecolor=\psk@xtickcolor, - linewidth=\psk@xtickwidth pt]{\iA}% - \uput[-45](\iB,0){\pshlabel{\iB}}\uput[45](0,\iB){\pshlabel{\iB}}% - }% -% \uput[-45](\pstR@dius,0){\pstR@dius}\uput[45](0,\pstR@dius){\pstR@dius}% - \pst@cntm=\psk@ysubticks\advance\pst@cntm by \m@ne - \multido{\iA=\psk@Dy+\psk@Dy,\rB=\pstd@lpha+\psk@Dy}{\pstN@lpha}{% - \multido{\rA=\rB+\pstd@lpha}{\the\pst@cntm}{\psline[linestyle=\psysubticklinestyle, - linecolor=\psk@ysubtickcolor,linewidth=\psk@ysubtickwidth pt](\pstR@dius;\rA)} - \psline[linestyle=\psyticklinestyle, - linecolor=\psk@ytickcolor,linewidth=\psk@ytickwidth pt](\pstR@dius;\iA)% - \uput[\iA](\pstR@dius;\iA){\psvlabel{\iA}}} - \endgroup\ignorespaces% - \Pst@xAxisfalse\Pst@yAxisfalse% -} - -% #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max -\def\pst@hlabels#1#2#3#4{% - \ifdim#1=\z@\else% % start from 0 ? - \ifx#2\empty\else\advance#1\ifdim#1>\z@-\fi7\pslinewidth\fi% - \pst@cnta=#1\relax% % Distance (in sp) to end. - \divide\pst@cnta\psk@dx\relax% % Number of ticks/labels - \ifnum\pst@cnta=\z@\else% - \pst@dimb=\psk@dx sp% % Space between ticks. - \ifPst@yAxis\else\showorigintrue\fi% - \ifnum\psk@labels<\tw@\ifPst@xAxis\pst@@hlabels\fi\fi% - \showoriginfalse% - \fi% - \fi% -} -% Knows \pst@dimb and \pst@cnta -\def\pst@@hlabels{% - \psDEBUG[pst@@hlabels]{xticksizeC=\the\pst@xticksizeC}% - \setbox\z@=\vbox{% save all in a box - \ifcase\psk@xlabelPos - \vskip-\pst@xticksizeA\vskip\pslabelsep\or - \vskip-1ex\vskip-\pslabelsep\or - \vskip-\pst@xticksizeB\vskip-\pslabelsep\vskip-1ex - \fi - \ifnum\pst@cnta<\z@ \pst@dimb=-\pst@dimb\fi - \hbox to\z@{% - \ifshoworigin\hbox to \z@{\hss\pst@@@hlabel{\psk@Ox}\hss}\fi% - \mmultido{\nA=\psk@Ox+\psk@Dx}{\pst@cnta}{% - \hskip\pst@dimb\hbox to \z@{\hss% - \ifdim\nA pt=\z@ \pst@@@hlabel{0}% - \else\expandafter\pst@@@hlabel{\nA}% - \fi% prevent -0, doesn't work with \ifnum - \hss}% - }\hss% - }% - }\ht\z@\z@ \dp\z@\z@ \box\z@}% set all values to zero -% -% #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max -% \psk@labels 0:all; 1:x; 2:y; 3:none -\def\pst@vlabels#1#2#3#4{% - \ifdim#1=\z@\else% - \ifx#2\empty\else\advance#1\ifdim#1>\z@-\fi7\pslinewidth\fi% - \pst@cnta=#1\relax% % % Distance (in sp) to end. - \divide\pst@cnta\psk@dy\relax% % Number of ticks/labels - \ifnum\pst@cnta=\z@\else% - \pst@dima=\psk@dy sp% % Space between ticks. -% \ifPst@xAxis\else\showorigintrue\fi% - \ifodd\number\psk@labels\else\ifPst@yAxis\pst@@vlabels\fi\fi% - \showoriginfalse% - \fi% - \fi% -} -% \pst@dima: the width between two labels in pt -% \pst@dimc: the coordinate of the origin in pt -% \pst@cnta: the lowest label -% \pst@ticksizeC the lowest or highest value -\def\pst@@vlabels{% - \psDEBUG[pst@@vlabels]{yticksizeC=\the\pst@yticksizeC}% -% for left labels we use \def\llap#1{\hb@xt@\z@{\hss#1}} - \vbox to\z@{% - \ifnum\pst@cnta>\z@ \pst@dima=-\pst@dima\fi% up or down label positions - \offinterlineskip% - \ifshoworigin% - \vbox to \z@{\vss\hbox to\z@{% - \ifcase\psk@ylabelPos% - \hss\pst@@@vlabel{\psk@Oy}\hskip\pslabelsep\hskip-\pst@yticksizeA\or% - \hskip\pslabelsep\hss\pst@@@vlabel{\psk@Oy}\hss\or % right labels - \hskip\pst@yticksizeB\hskip\pslabelsep\pst@@@vlabel{\psk@Oy}% - \fi}\vss}% - \fi% - \mmultido{\nA=\psk@Oy+\psk@Dy}{\pst@cnta}{% - \vbox to\pst@dima{\vss}% - \vbox to \z@{% - \vss\hbox to\z@{% - \ifcase\psk@ylabelPos% and also check for -0 - \hss\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% - \hskip\pslabelsep\hskip-\pst@yticksizeA\or% top - \hss\ifdim\nA pt=\z@\pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% - \ifdim\pslabelsep=\z@\hss\else\kern-\pslabelsep\fi\or% axis - \hskip\pst@yticksizeB\hskip\pslabelsep% - \ifdim\nA pt=\z@\pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% bottom - \fi}\vss}% - }\vss}% -} -% -\define@key[psset]{pstricks-add}{nStep}[1]{\def\psk@nStep{#1}} -\define@key[psset]{pstricks-add}{nStart}[0]{\def\psk@nStart{#1}} -\define@key[psset]{pstricks-add}{nEnd}[{}]{\def\psk@nEnd{#1}} -\define@key[psset]{pstricks-add}{xStep}[0]{\def\psk@xStep{#1}} -\define@key[psset]{pstricks-add}{yStep}[0]{\def\psk@yStep{#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]{pstricks-add}{plotNo}[1]{\def\psk@plotNo{#1}} -\define@key[psset]{pstricks-add}{plotNoMax}[1]{\def\psk@plotNoMax{#1}} -% -%\psset{nStep=1, nStart=0, nEnd={},% -% xStep=0, yStep=0, xStart={}, xEnd={}, yStart={}, yEnd={}, comma=false,% -% plotNo=1,plotNoMax=1}% -% -\def\pstScalePoints(#1,#2)#3#4{% -% xScale | yScale | xOperator | yOperator -% the operators can be any Postscript code - \def\pstXScale{#1 }% - \def\pstYScale{#2 }% - \def\pstXPSScale{#3 }% - \def\pstYPSScale{#4 }% - \pst@def{ScalePoints}<% - /y ED /x ED - /yPSOp { #4 y mul #2 mul } def - /xPSOp { #3 x mul #1 mul } def - counttomark dup dup cvi eq not { exch pop } if - /m exch def /n m 2 div cvi def - n { - yPSOp m 1 roll xPSOp m 1 roll - /m m 2 sub - def } repeat>% -} -%\pstScalePoints(1,1){}{}% the default -> no special operators -% -\def\listplot@ii#1{% - \@nameuse{beginplot@\psplotstyle}% - \addto@pscode{/D {} def mark}% - #1% - \addto@pscode{ - \tx@PreparePoints - \pst@number\psxunit - \pst@number\psyunit - \tx@ScalePoints - }% - \@nameuse{endplot@\psplotstyle}% -} -% -\define@boolkey[psset]{pstricks-add}[Psk@]{xyValues}[true]{} -\psset[pstricks-add]{xyValues} -% -\define@boolkey[psset]{pstricks-add}[Pst@]{ChangeOrder}[true]{} -% -\pst@def{PreparePoints}<{% - counttomark /m exch def - \ifPsk@xyValues\else % we have only y values - /mm m def - /M m 1 add def - m { mm exch M 2 roll /M M 1 add def /mm mm 1 sub def } repeat - /m m dup add def - \fi - \ifPst@ChangeOrder - /m0 m def - m \psk@plotNoMax\space 1 add div 1 sub cvi { - m0 \psk@plotNoMax\space 1 add roll /m0 m0 \psk@plotNoMax\space 1 add sub def - } repeat - \fi - /n m \psk@plotNoMax\space 1 add div cvi def - \psk@plotNoMax\space 1 gt {% multiple data files? - n { - \psk@plotNoMax\space \psk@plotNo\space 1 sub neg roll % x yNo y y y ... - \psk@plotNoMax\space 1 sub { pop } repeat % x yNo - /m m \psk@plotNoMax\space 1 sub sub def - m 2 roll - } repeat - } if % no multiple data files -% counttomark /m exch def -% /n m 2 div cvi def - /xMax -99999 def /yMax -99999 def - /xP 0 def /yP 0 def - m copy - n { - /y exch def /x exch def - xMax x lt { /xMax x def } if - yMax y lt {/yMax y def } if - xP x gt { /xP x def } if - yP y gt { /yP y def } if - } repeat -% m 2 roll - \psk@xStep\space 0 gt \psk@yStep\space 0 gt or (\psk@xStart) length 0 gt or - (\psk@yStart) length 0 gt or (\psk@xEnd) length 0 gt or (\psk@yEnd) length 0 gt or { -% - (\psk@xStart) length 0 gt {\psk@xStart\space }{ xP } ifelse /xStart exch def - (\psk@yStart) length 0 gt {\psk@yStart\space }{ yP } ifelse /yStart exch def - (\psk@xEnd) length 0 gt { \psk@xEnd\space }{ xMax } ifelse /xEnd exch def - (\psk@yEnd) length 0 gt { \psk@yEnd\space }{ yMax } ifelse /yEnd exch def - n { - m -2 roll - 2 copy /yVal exch def /xVal exch def - xVal xP ge - yVal yP ge and - xVal xEnd le and - yVal yEnd le and - xVal xStart ge and - yVal yStart ge and { - /xP xP \psk@xStep\space add def - /yP yP \psk@yStep\space add def - }{% - pop pop - /m m 2 sub def - } ifelse - } repeat - }{% - /ncount 1 def - (\psk@nEnd) length 0 gt { \psk@nEnd\space }{ m } ifelse - /nEnd exch def - n { - m -2 roll - \psk@nStep\space 1 gt { ncount \psk@nStart\space sub \psk@nStep\space mod 0 eq }{ true } ifelse - ncount nEnd le and - ncount \psk@nStart\space ge and not { -% ncount nEnd le and -% ncount \psk@nStart\space ge and not { - pop pop - /m m 2 sub def - } if - /ncount ncount 1 add def - } repeat - } ifelse -}> -% -% -\define@key[psset]{pstricks-add}{xAxisLabel}[x]{\def\psk@xAxisLabel{#1}} -\define@key[psset]{pstricks-add}{yAxisLabel}[y]{\def\psk@yAxisLabel{#1}} -%\psset{xAxisLabel=x,yAxisLabel=y} -\iffalse -\define@key[psset]{pstricks-add}{xAxisLabelPos}{% - \def\pst@tempA{#1}% - \ifx\pst@tempA\@empty\let\psk@xAxisLabelPos\relax\else% - \pst@getcoor{#1}\psk@xAxisLabelPos\fi} -\define@key[psset]{pstricks-add}{yAxisLabelPos}{% - \def\pst@tempA{#1}% - \ifx\pst@tempA\@empty\let\psk@yAxisLabelPos\relax\else% - \pst@getcoor{#1}\psk@yAxisLabelPos\fi} -\fi -\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]{pstricks-add}{llx}[\z@]{\pssetxlength\psk@llx{#1}} -\define@key[psset]{pstricks-add}{lly}[\z@]{\pssetylength\psk@lly{#1}} -\define@key[psset]{pstricks-add}{urx}[\z@]{\pssetxlength\psk@urx{#1}} -\define@key[psset]{pstricks-add}{ury}[\z@]{\pssetylength\psk@ury{#1}} -%\psset{llx=\z@, lly=\z@, urx=\z@, ury=\z@}% prevents rounding errors -\newif\ifPst@plot@box -\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,#2){\catcode`\!=12\relax - \@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% - \begingroup% - \pst@dimo=#3\p@ \pst@dimp=#1\p@ \multiply\pst@dimp by \m@ne% - \advance\pst@dimo by \pst@dimp% delta x - \pst@dimm=#5% - \pstFPdiv\pst@@dx{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}% - \pst@xunit=\pst@@dx\p@ -% - \pst@dimo=#4\p@ \pst@dimp=#2\p@ \multiply\pst@dimp by \m@ne% - \advance\pst@dimo by \pst@dimp% delta y - \ifx!#6\pst@dimm=\pst@@dx\pst@dimo\else\pst@dimm=#6\fi% - \pstFPdiv\pst@@dy{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}% - \pst@yunit=\pst@@dy\p@% - % - \pst@dimm=#1\pst@xunit% - \advance\pst@dimm by \psk@llx% - \pst@dimn=#2\pst@yunit% - \advance\pst@dimn by \psk@lly% - \pst@dimo=#3\pst@xunit% - \advance\pst@dimo by \psk@urx% - \pst@dimp=#4\pst@yunit% - \advance\pst@dimp by \psk@ury% - \if@star\pspicture*(\pst@dimm,\pst@dimn)(\pst@dimo,\pst@dimp)\else% - \pspicture(\pst@dimm,\pst@dimn)(\pst@dimo,\pst@dimp)\fi% - \psset{xunit=\pst@xunit,yunit=\pst@yunit}% - \bgroup% - \use@par% - \psaxes(#1,#2)(#3,#4)% - \egroup% - \psgraph@vi(#1,#2)(#1,#2)(#3,#4)% -} -\def\psgraph@v(#1,#2)(#3,#4)(#5,#6)#7#8{% with special origin -% Xorig | yorig | minX | minY | maxX | maxY | Length x-axis | length y-axis% - \pst@killglue% - \begingroup% - \pst@dimo=#5\p@ \pst@dimp=#3\p@ \multiply\pst@dimp by \m@ne% - \advance\pst@dimo by \pst@dimp% delta x - \pst@dimm=#7% - \pstFPdiv\pst@@dx{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}% - \pst@xunit=\pst@@dx\p@% -% - \pst@dimo=#6\p@\pst@dimp=#4\p@\multiply\pst@dimp by \m@ne% - \advance\pst@dimo by \pst@dimp% delta y - \ifx!#8\pst@dimm=\pst@@dx\pst@dimo\else\pst@dimm=#8\fi% - \pstFPdiv\pst@@dy{\strip@pt\pst@dimm}{\strip@pt\pst@dimo}% - \pst@yunit=\pst@@dy\p@ - % - \pst@dima=#3\pst@xunit \advance\pst@dima by \psk@llx% - \pst@dimb=#4\pst@yunit \advance\pst@dimb by \psk@lly% - \pst@dimc=#5\pst@xunit \advance\pst@dimc by \psk@urx% - \pst@dimd=#6\pst@yunit \advance\pst@dimd by \psk@ury% - \if@star\pspicture*(\pst@dima,\pst@dimb)(\pst@dimc,\pst@dimd)\else% - \pspicture(\pst@dima,\pst@dimb)(\pst@dimc,\pst@dimd)\fi% - \psset{xunit=\pst@xunit,yunit=\pst@yunit}% - \bgroup% - \use@par% - \psaxes(#1,#2)(#3,#4)(#5,#6)% - \egroup% - \psgraph@vi(#1,#2)(#3,#4)(#5,#6)% -} -% -\def\setxLabelC@@r#1,#2(#3,#4)(#5){% - \pst@getcoor{#5}\pst@tempB% - \ifx c#1 - \pssetylength\pst@dimm{#2}% - \rput(! #4 #3 add 2 div \pst@number\pst@dimm \pst@tempB\space exch pop add - \pst@number\psyunit div ){\psk@xAxisLabel}% - \else% - \pst@getcoor{\psk@xAxisLabelPos}\pst@tempA% - \rput(! \pst@tempA\space \pst@tempB\space exch pop add \tx@UserCoor ){\psk@xAxisLabel}% - \fi} -\def\setyLabelC@@r#1,#2(#3,#4)(#5){% - \pst@getcoor{#5}\pst@tempB% - \ifx c#2 - \pssetxlength\pst@dimm{#1}% - \rput{90}(! \pst@number\pst@dimm \pst@tempB\space pop add \pst@number\psxunit div #4 #3 add 2 div ){\psk@yAxisLabel}% - \else% - \pst@getcoor{\psk@yAxisLabelPos}\pst@tempA% - \rput{90}(! \pst@tempB\space pop \pst@tempA\space 3 1 roll add exch \tx@UserCoor ){\psk@yAxisLabel}% - \fi -} -% -\def\psgraph@vi(#1,#2)(#3,#4)(#5,#6){% - \ifx\psk@xAxisLabel\@empty\else% - \ifx\psk@xAxisLabelPos\@empty\uput[0](#5,#2){\psk@xAxisLabel}% - \else \expandafter\setxLabelC@@r\psk@xAxisLabelPos(#3,#5)(#1,#2)\fi% - \fi% - \ifx\psk@yAxisLabel\@empty\else% - \ifx\psk@yAxisLabelPos\@empty\uput[90](#1,#6){\psk@yAxisLabel}% - \else\expandafter\setyLabelC@@r\psk@yAxisLabelPos(#4,#6)(#1,#2)\fi% - \fi% - \ignorespaces% -} -\def\endpsgraph{% - \pst@killglue% - \endpspicture% - \endgroup% -} -\@namedef{psgraph*}{\psgraph*} -\@namedef{endpsgraph*}{\endpsgraph} -% -\define@key[psset]{pstricks-add}{ignoreLines}{\def\psk@ignoreLines{#1}} - -\newcount\linecnt -\begingroup -\catcode`\,=13 -\catcode`\_=13 -\gdef\savedata@#1[#2]{% - \xdef\pst@tempg{#2_}% - \endgroup - \let#1\pst@tempg - \global\let\pst@tempg\relax - \ignorespaces} - -\gdef\readdata@{% - \read1 to \pst@tempA - \ifnum\linecnt=\psk@nStep - \global\linecnt=0 - \expandafter\readdata@@\pst@tempA_\@nil - \fi - \global\advance\linecnt by 1 - \ifeof1\else\expandafter\readdata@\fi} -\gdef\pst@@readfile#1#2\@nil{\addto@pscode{,#1#2}}% -\gdef\readdata@@#1#2\@nil{\xdef\pst@tempg{\pst@tempg,#1#2}}% -\endgroup - -\def\readdata{\@ifnextchar[{\readdata@i}{\readdata@i[]}} -\def\readdata@i[#1]#2#3{% - \def\pst@tempA{#1}% - \ifx\pst@tempA\@empty\else\psset{#1}\fi - \openin1=#3 - \begingroup - \def\pst@tempg{}% - \ifeof1 - \@pstrickserr{Data file `#3' not found.}\@ehpa - \else - \pst@datadelimiters - \catcode`\[=1 - \catcode`\]=2 - \pst@cnta=0 - \loop \ifnum\the\pst@cnta<\psk@ignoreLines - \advance\pst@cnta by 1\relax - \read1 to \pst@tempA - \repeat - \ifnum\Pst@Debug>0 \typeout{>>> ignored \the\pst@cnta\space data lines}\fi% - \global\linecnt=\psk@nStep% - \readdata@% - \fi% - \endgroup% - \global\let#2\pst@tempg% - \global\let\pst@tempg\relax% -\ignorespaces} -% -% D.G. addition - Jun. 9, 1998 - Polar plots using the \psplot macro -% Code added according the way suggested by Ulrich Dirr -% For polar plots -\define@boolkey[psset]{pstricks-add}[Pst@]{polarplot}[true]{} -\define@boolkey[psset]{pstricks-add}[Pst@]{algebraic}[true]{} -\psset[pstricks-add]{polarplot=false,algebraic=false}% 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}}% @@ -2730,357 +979,10 @@ \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}{varsteptol}{\def\psk@varsteptol{#1}}% +\define@key[psset]{pstricks-add}{adamsorder}{\def\psk@adamsorder{#1}}% %\define@key[psset]{pstricks-add}{varstepincrease}{\def\psk@varstepincrease{#1}}% varrk4 % -\def\psplot@i#1#2{\@ifnextchar[{\psplot@I{#1}{#2}}{\psplot@I{#1}{#2}[]}} -\def\psplot@I#1#2[#3]#4{% - \pst@killglue% - \begingroup% - \use@par% - \@nameuse{beginplot@\psplotstyle}% -% D.G. modification begin - Jun. 9, 1998 - \ifPst@polarplot% - \addto@pscode{ - \psplot@init - #3 - /x #1 def - /x1 #2 def - /dx x1 x sub \psk@plotpoints div def - /F@pstplot \ifPst@algebraic (#4) - \ifx\psk@PlotDerivative\@none\else - \psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat - \fi\space - tx@AlgToPs begin AlgToPs end cvx - \else { #4 } \fi def - \ifPst@VarStep - /StillZero 0 def /LastNonZeroStep dx def - /F2@pstplot tx@Derive begin (#4) (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 -% #4 dup x cos mul exch x sin mul - \pst@number\psyunit mul exch - \pst@number\psxunit mul exch - } def}% - \else% polarplot -% D.G. modification end - \addto@pscode{ - \psplot@init - #3 - /x #1 def - /x1 #2 def - /dx x1 x sub \psk@plotpoints div def - /F@pstplot \ifPst@algebraic (#4) - \ifx\psk@PlotDerivative\@none\else - \psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat - \fi\space - tx@AlgToPs begin AlgToPs end cvx - \else { #4 } \fi def - \ifPst@VarStep - /StillZero 0 def /LastNonZeroStep dx def - /F2@pstplot tx@Derive begin (#4) (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 #4 \fi \pst@number\psyunit mul - } def}% - \fi% - \gdef\psplot@init{}% - \@pstfalse% - \@nameuse{testqp@\psplotstyle}% - \if@pst\psplot@ii\else\psplot@iii\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{ - /ps@Exit false def - 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 - } - ps@Exit { exit } if - \ifx\psk@method\@varrkiv loop \else repeat \fi - ps@Exit not { - /x x1 def - xy \@nameuse{doqp@\psplotstyle} - } if }% - \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 \space - /x x1 def - xy - 2 copy \tx@UserCoor 2 array astore /SaveFinalState ED - n 2 roll}% - \fi% - \@nameuse{endplot@\psplotstyle}} -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\parametricplot@i#1#2{\@ifnextchar[{\parametricplot@I{#1}{#2}}{\parametricplot@I{#1}{#2}[]}} -\def\parametricplot@I#1#2[#3]#4{% - \pst@killglue% - \begingroup - \use@par - \@nameuse{beginplot@\psplotstyle}% - \addto@pscode{% - \psplot@init - #3 - /t #1 def - /t1 #2 def - /dt t1 t sub \psk@plotpoints div def - /F@pstplot \ifPst@algebraic (#4) - \ifx\psk@PlotDerivative\@none\else - \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat - \fi\space - tx@AlgToPs begin AlgToPs end cvx - \else { #4 } \fi def - \ifPst@VarStep - /StillZero 0 def /LastNonZeroStep dt def - /F2@pstplot tx@Derive begin (#4) (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 #4 \fi - \pst@number\psyunit mul exch - \pst@number\psxunit mul exch - } def}% - \gdef\psplot@init{}% - \@pstfalse - \@nameuse{testqp@\psplotstyle}% - \if@pst - \parametricplot@ii - \else - \parametricplot@iii - \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{% - /ps@Exit false def - xy \@nameuse{beginqp@\psplotstyle} - \psk@plotpoints 1 sub { - /t t dt add def - xy \@nameuse{doqp@\psplotstyle} - ps@Exit { exit } if - } repeat - ps@Exit not { - /t t1 def - xy \@nameuse{doqp@\psplotstyle} - } if }% - \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]{pstricks-add}{barwidth}{\pst@getlength{#1}\Add@barwidth} -\psset[pstricks-add]{barwidth=0.25cm} -% -\def\psbar@ii{\addto@pscode{false \tx@NArray \psbar@iii}} -\def\psbar@iii{% - newpath - n { - /Yval exch def /Xval exch def - Xval \number\Add@barwidth 0.5 mul sub 0 moveto - 0 Yval rlineto \number\Add@barwidth 0 rlineto - 0 Yval neg rlineto \number\Add@barwidth neg 0 rlineto - } repeat -}% -\def\beginplot@bar{\begin@SpecialObj} -\def\endplot@bar{% - \psbar@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi% - \pst@stroke - \end@SpecialObj} -% -\define@key[psset]{pstricks-add}{PSfont}[Times-Roman]{\def\psk@PSfont{/#1 }} -\define@key[psset]{pstricks-add}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth } -\define@key[psset]{pstricks-add}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale } -\define@key[psset]{pstricks-add}{decimals}[-1]{\pst@getint{#1}\psk@decimals } -\psset[pstricks-add]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1} -% -\def\psvalues@ii{ - \addto@pscode{false \tx@NArray \psvalues@iii}} -\def\psvalues@iii{% - \psk@PSfont findfont \psk@fontscale scalefont setfont - newpath - n { /yO ED /xO ED - gsave -% \psk@valuewidth 2 div \psk@fontscale mul 0 rlineto 0 \psk@fontscale rlineto -% \psk@valuewidth 2 div \psk@fontscale mul neg 0 rlineto 0 \psk@fontscale neg rlineto -% closepath gsave 1 setgray fill stroke grestore - yO \pst@number\psyunit div - \psk@decimals 0 eq { cvi } if - \psk@decimals 0 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if - \psk@valuewidth string cvs /Str ED - Str stringwidth pop /yS \psk@fontscale def /xS ED - gsave newpath - xO yO \pst@number\pslabelsep add moveto \psk@rot rotate - xS 0 rlineto 0 yS rlineto xS neg 0 rlineto 0 yS neg rlineto - closepath 1 setgray fill stroke grestore - xO yO \pst@number\pslabelsep add moveto \psk@rot rotate Str show grestore } repeat -}% -\def\beginplot@values{\begin@SpecialObj} -\def\endplot@values{% - \psvalues@ii% - \pst@stroke - \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 % m*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 @@ -3189,8 +1091,8 @@ abc aload pop pop exch % b a #7 mul 2 mul add % b+2*a*x0=mTan \ifPST@Tnormal - neg 1 exch div % mOrth - #8 mul /dy ED % mOrth*dx + neg 1 exch div % -1/mTan=mOrth + #8 mul /dy ED % mOrth*dx=dy [ #7 #8 add y0 dy add \tx@ScreenCoor % x0+dx y0 +dy #7 y0 \tx@ScreenCoor % x0 y0 @@ -3272,17 +1174,18 @@ cleartomark y2 y1 sub \pst@number\psyunit mul x2 x1 sub \pst@number\psxunit mul } ifelse atan % atan(dy dx), we have the slope angle of the secant + \ifPST@Tnormal 90 add \fi \else % there is a derivation defined - #2 dup /x ED /t ED tx@addDict begin mark FDer@pstplot end counttomark 1 gt % test, if we have parametricplot - { /y ED /x ED } - { \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 - \else /y ED /x 1 def \fi } ifelse - cleartomark - y \pst@number\psyunit mul x \pst@number\psxunit mul Atan \ifPST@Tnormal 90 add \fi -% y ATAN1 % we have the slope angle of the tangent. ATAN is defined int the pstricks.pro, patch 6 + #2 dup /x ED /t ED tx@addDict begin mark FDer@pstplot end counttomark 1 gt % test, if we have parametricplot + { /y ED /x ED } + { \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 + \else /y ED /x 1 def \fi } ifelse + cleartomark + y \pst@number\psyunit mul x \pst@number\psxunit mul Atan \ifPST@Tnormal 90 add \fi + % y ATAN1 % we have the slope angle of the tangent. ATAN is defined int the pstricks.pro, patch 6 \fi cvi 180 mod dup 90 gt { 180 sub } if % -90 <= angle <= 90 rotate % rotate, depending to the origin @@ -3291,7 +1194,7 @@ \ifPST@Tnormal 0 0 % moveto #3 - y \pst@number\psyunit mul x \pst@number\psxunit mul Atan 90 add cos div \pst@number\psxunit mul 0 % lineto + y \pst@number\psyunit mul x \pst@number\psxunit mul Atan cos div \pst@number\psxunit mul 0 % lineto \else % points are in reverse order ... \ifx\pst@tempRight\@empty #3 \else \pst@tempRight\space \fi \pst@number\psxunit mul 0 % moveto StarVersion { 0 }{\ifx\pst@tempRight\@empty #3 neg \else @@ -3577,117 +1480,6 @@ \ignorespaces% }} % -\define@key[psset]{pstricks-add}{IQLfactor}{\pst@checknum{#1}\pst@IQLfactor} -%\psset[pstricks-add]{IQLfactor=1.5} -% -\def\psBoxplot@ii{% - \addto@pscode{ - /Barwidth \number\Add@barwidth 2 div def - /Endwidth Barwidth \psk@arrowlength\space mul def - tx@addDict begin % BSort from pro file - NArray bubblesort end - /NArray ED % save sorted array - [ NArray { yUnit mul } forall ] /NArray ED % multiply with y unit - NArray 0 get /MinVal ED % save minimum - NArray m 1 sub get /MaxVal ED % maximum - m 2 div cvi /M ED % the middle - NArray length 2 mod 0 eq { % even numbers of entries - M 1 sub NArray exch get % even number of values - NArray M get % and the upper one - add 2 div /Median ED % the median - }{ - NArray M get /Median ED % odd numbers of values - } ifelse - m 2 mod 1 eq { % get the lower Quartil even/odd - M 2 div cvi 1 add dup /M2 ED % save middle index - 1 sub NArray exch get - NArray M2 get - add 2 div /LowerQuartil ED - }{ - NArray M 2 div cvi get /LowerQuartil ED - } ifelse % end even/odd - m 2 mod 1 eq { % get the upper Quartil - M 1.5 mul cvi 1 add dup /M3 ED - 1 sub NArray exch get - NArray M3 get - add 2 div /UpperQuartil ED - }{ % upper quartil - NArray M 1.5 mul cvi get /UpperQuartil ED - } ifelse - /IQL UpperQuartil LowerQuartil sub \pst@IQLfactor\space mul def - 0 1 m 1 sub { % Index on stack - dup /Index ED - NArray exch get LowerQuartil sub abs IQL sub 0 gt { - newpath 0 NArray Index get 2 0 360 arc gsave - 1 0 0 setrgbcolor fill grestore - stroke closepath - NArray Index 1 add get /MinVal ED }{ exit } ifelse - } for - m 1 sub -1 0 { % Index on stack - dup /Index ED - NArray exch get UpperQuartil sub abs IQL sub 0 gt { - newpath 0 NArray Index get 2 0 360 arc gsave - 1 0 0 setrgbcolor fill grestore - stroke closepath - NArray Index 1 sub get /MaxVal ED }{ exit } ifelse - } for -% - Endwidth neg MaxVal moveto % we are on top - Endwidth dup add 0 rlineto - 0 MaxVal moveto - 0 UpperQuartil lineto % upper quartil - 0 LowerQuartil moveto - 0 MinVal lineto - Endwidth neg MinVal moveto - Endwidth dup add 0 rlineto - gsave - \pst@number\pslinewidth SLW - \pst@usecolor\pslinecolor - \tx@setStrokeTransparency - \tx@setStrokeTransparency - \@nameuse{psls@\pslinestyle} - stroke - grestore - newpath - Barwidth neg LowerQuartil moveto % lower quartil - Barwidth neg UpperQuartil lineto - Barwidth dup add 0 rlineto - Barwidth LowerQuartil lineto - closepath - gsave \pst@usecolor\psfillcolor \tx@setTransparency fill grestore - Barwidth neg Median moveto % median - Barwidth dup add 0 rlineto - \pst@number\pslinewidth SLW - \pst@usecolor\pslinecolor - \tx@setStrokeTransparency - \tx@setStrokeTransparency - \@nameuse{psls@solid} -}}% -\def\beginplot@Boxplot{\init@pscode} -\def\endplot@Boxplot{% - \psBoxplot@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi% - \pst@stroke - \end@SpecialObj} -\def\psBoxplot{\def\pst@par{}\pst@object{psBoxplot}} -\def\psBoxplot@i#1{% - \leavevmode - \pst@killglue - \begingroup - \addbefore@par{barwidth=40pt,arrowlength=0.75}% - \addto@par{plotstyle=Boxplot}% - \use@par - \@nameuse{beginplot@\psplotstyle}% - \addto@pscode{ - /D {} def - [ #1 ] /NArray ED - NArray aload length /m ED - /xUnit \pst@number\psxunit def - /yUnit \pst@number\psyunit def - }% - \@nameuse{endplot@\psplotstyle}% - \ignorespaces% -} - % the datafile must be a matrix with % /dotmatrix [ % ..... @@ -3696,6 +1488,11 @@ % \define@key[psset]{pstricks-add}{colorType}[0]{\def\psk@colorType{#1}} \psset[pstricks-add]{colorType=0} % 0-> two color mode 1->wavelength mode (400..700nm) +% 0-> two color mode +% 1-> wavelength mode (400..700nm) +% 2-> wavelength mode inverse +% 3-> gray color mode +% 4-> gray color mode invers \def\psMatrixPlot{\def\pst@par{}\pst@object{psMatrixPlot}} \def\psMatrixPlot@i#1#2#3{% \pst@killglue% @@ -3722,6 +1519,12 @@ \or Min sub dMaxMin div neg 1 add 300 mul 400 add tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor + \or + Min sub dMaxMin div neg 1 add 300 mul 400 add + tx@addDict begin wavelengthToGRAY end setgray + \or + Min sub dMaxMin div neg 1 add 300 mul 400 add + tx@addDict begin wavelengthToGRAY end neg 1 add setgray \fi x \psk@xStep\space mul \pst@number\psxunit mul \ifPst@ChangeOrder #1 y sub 1 add \else y \fi \psk@yStep\space mul \pst@number\psyunit mul Dot% @@ -3791,15 +1594,14 @@ \begingroup% \def\psk@chartValues{#1}% \def\psk@chartSepValues{#2}% only valid for a pie chart - \pst@dimm=\z@\relax% sum of all entries (for a pie) - \pst@cnta=1\relax% number of entries - \pst@dimn=\z@\relax% greatest entry + \pst@dimm=\z@ % sum of all entries (for a pie) + \pst@cnta=1 % number of entries + \pst@dimn=\z@ % greatest entry \psforeach{\chart@tempA}{#1}{% - \global\advance\pst@cnta by \@ne% % no of entries - \global\advance\pst@dimm by \chart@tempA\p@% % sum of all entries + \global\advance\pst@cnta by \@ne % % no of entries + \global\advance\pst@dimm by \chart@tempA\p@ % % sum of all entries \pst@dima=\chart@tempA\p@% - \ifdim\pst@dima>\pst@dimn\relax - \global\pst@dimn=\pst@dima\fi% + \ifdim\pst@dima>\pst@dimn \global\pst@dimn=\pst@dima\fi% }% \addbefore@par{dimen=outer}% \begin@SpecialObj% @@ -3825,8 +1627,9 @@ \global\advance\pst@cnta by \@ne% \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart \global\@chartSepfalse% - \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax - \global\@chartSeptrue\fi}% + \if$\psk@chartSepValues$\else + \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta \global\@chartSeptrue\fi}% + \fi \if@chartSep% \pswedge(\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}% \else% @@ -3838,7 +1641,7 @@ \fi% \def\chart@alpha{0}% \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0\relax% - \psforeach{\chart@tempA}{\psk@chartValues}{% + \psForeach{\chart@tempA}{\psk@chartValues}{% \global\advance\pst@dimm by \chart@tempA\p@% \global\advance\pst@dimn by \chart@alpha\p@% \def\pst@tempB{\pst@number\chart@ColorIndex}% @@ -3851,9 +1654,10 @@ \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi% \fi% \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart - \global\@chartSepfalse% - \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax% - \global\@chartSeptrue\fi}% + \global\@chartSepfalse + \if$\psk@chartSepValues$\else + \psForeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta \global\@chartSeptrue\fi}% + \fi \if@chartSep% \pswedge[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]% (\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}% @@ -4080,30 +1884,10 @@ ArrowFill=true, ArrowInside={}, ArrowInsidePos=0.5, ArrowInsideNo=1, ArrowInsideOffset=0, - arrowLW=0, - dashNo=0.2,linecap=0, - xyAxes=true, - xlabelPos=bottom, ylabelPos=left, - trigLabels=false,trigLabelBase=0, - xDecimals={},yDecimals={}, - xlogBase={},ylogBase={}, - labelFontSize={},mathLabel, - logLines=none, - ignoreLines=0, - nStep=1,nStart=0,nEnd={}, - xStep=0,yStep=0,xStart={},xEnd={},yStart={},yEnd={},comma=false, - decimalSeparator=., - plotNo=1,plotNoMax=1, - xAxisLabel=x,yAxisLabel=y, - yAxisLabelPos={},xAxisLabelPos={}, - llx=\z@, lly=\z@, urx=\z@, ury=\z@,% prevents rounding errors randomPoints=1000,color=false, method={},whichabs={},whichord={}, plotfuncx={},plotfuncy={},buildvector=false, -% algebraic=false, % individuelly set Derive={},adamsorder=4, - VarStep=false, PlotDerivative=none, VarStepEpsilon=default, - varsteptol=.001, Tnormal=false, braceWidth=2\pslinewidth, bracePos=0.5, @@ -4111,92 +1895,7 @@ braceWidthOuter=10\pslinewidth, chartNodeI=0.75, chartNodeO=1.5, - IQLfactor=1.5, - showOriginTick - } - \psset{% -%%%% pstricks %%%%%%%% -% opacity=1, -% blendmode=0, -% shapealpha=0.6, - unit=1cm,% - swapaxes=false,% - showpoints=false,% - border=0pt, bordercolor=white,% - doubleline=false, doublesep=1.25\pslinewidth,% - doublecolor=white,% - shadow=false, shadowsize=3pt, shadowangle=-45, shadowcolor=darkgray,% - linewidth=.8pt,% - linecolor=black,% - maxdashes=11, dash=5pt 3pt, dashadjust=true, % - dotsep=3pt,% - linestyle=solid,% - fillcolor=white,% - hatchwidth=.8pt, hatchsep=4pt, hatchcolor=black, hatchangle=45,% - hatchsepinc=0pt,hatchwidthinc=0pt,% - fillstyle=none,% - nArrows=2,% - arrows=-, arrowscale=1, arrowsize=1.5pt 2, arrowlength=1.4, arrowinset=.4,% - tbarsize=2pt 5,% - bracketlength=.15, rbracketlength=.15,% - liftpen=0, linetype=0,% - gangle=0,% - curvature=1 .1 0,% - dotsize=2pt 2,% - dotangle=0, dotscale=1, dotstyle=*,% - linearc=0pt,% - framearc=0,% - cornersize=relative,% - dimen=middle,% - gridwidth=.8pt, griddots=0, gridcolor=black,% - subgridwidth=.4pt, subgridcolor=gray, subgriddots=0, subgriddiv=5,% - gridlabels=10pt, gridlabelcolor=black,% - framesep=3pt, boxsep=true,% - trimode=U,% - arcsep=0,radius=.25cm,% - ref=c,rot=0,labelsep=5pt,refangle=0,% - intSeparator={,},% -%%%%%%%%% pst-plot %%%%%%%%%%%%% - labelFontSize={},% - StepType=lower, % alternative SumType=upper - plotstyle=line,plotpoints=50,% -% barwidth=0.25cm,% individuell set - ticksize=-4pt 4pt, - tickstyle=full, ticks=all,% - subticksize=0.75,subticks=1,tickcolor=black,% - ticklinestyle=solid,subticklinestyle=solid,% - subtickcolor=gray,% - tickwidth=0.5\pslinewidth,subtickwidth=0.25\pslinewidth,% - labels=all,Ox=0,Dx=1,dx=0,Oy=0,Dy=1,dy=0,% - xlabelFactor=\relax,ylabelFactor=\relax,% - showorigin=true,% - axesstyle=axes,% - ChangeOrder=false,% - arrowscale=1,% - %%%%%%%%% pst-node %%%%%%%%%% - lineAngle=0, - nodealign=false, - href=0, - vref=.7ex, - framesize=10pt, - nodesep=0pt, - arm=10pt, - offset=0pt, - angle=0, - arcangle=8, - ncurv=.67, - loopsize=1cm, - boxsize=.4cm, - nrot=0, - npos=, - tpos=0.5, - shortput=none, - colsep=1.5cm, - rowsep=1.5cm, - mcol=c, - mnode=R, - emnode=none% -}} + }} % \resetOptions % diff --git a/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty b/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty index 8c1c405bea0..99efb8098ed 100644 --- a/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty +++ b/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty @@ -1,7 +1,7 @@ -%% $Id: pstricks-add.sty 150 2009-11-14 09:25:53Z herbert $ +%% $Id: pstricks-add.sty 288 2010-02-11 15:43:29Z herbert $ % \RequirePackage{pstricks} -\ProvidesPackage{pstricks-add}[2009/03/17 v. 0.13 package wrapper for +\ProvidesPackage{pstricks-add}[2010/02/11 v. 0.14 package wrapper for pstricks-add.tex (hv)] \input{pstricks-add.tex} \ProvidesFile{pstricks-add.tex} @@ -10,9 +10,6 @@ \ProvidesFile{pstricks-add.pro} [2009/03/17 v. 0.22, PostScript prologue file (hv)] \@addtofilelist{pstricks-add.pro}}{}% -\input{pst-fp.tex} -\ProvidesFile{pst-fp.tex} - [\filedate\space v\fileversion\space `PST-fp' (hv)] \InputIfFileExists{pstricks-add.cfg}{% \PackageInfo{pstricks-add}{Local config file pstricks-add.cfg used} }{} -- cgit v1.2.3