diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex | 97 |
1 files changed, 94 insertions, 3 deletions
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 7e765d5035c..22fb1b8aa57 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 718 2018-01-30 09:11:28Z herbert $ +%% $Id: pstricks-add-doc.tex 721 2018-02-03 20:37:57Z herbert $ % \documentclass[11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small, headinclude=false,footinclude=false,oneside]{pst-doc} @@ -12,6 +12,15 @@ %} \makeatother +\usepackage{siunitx} +\sisetup{add-decimal-zero, + round-mode=places, + round-precision=2, + output-decimal-marker={,}, + detect-all} + + + %\input{data/pstricks-add-doc.data} \usepackage[utf8]{inputenc} @@ -1785,7 +1794,8 @@ vertical lines of the step function in the output. With setting the optional argument \Lkeyword{saveSumValue} -it is possible to calculate the area under the rectangles. The value is saved in a macro \Lcs{pstAreaA}, +it is possible to calculate the area under the rectangles. The value is calculated on PostScript level and then +later saved in a macro \Lcs{pstAreaA}, for the next call of \Lcs{psStep} in the macro \Lcs{pstAreaB} and so on. The values are calculated on PostScript level, the reason why two \LaTeX\ runs are needed. for every \Lcs{psStep} there will be an external file \verb|\jobname-area#.tex| which has the definition of the macros \nxLcs{pstArea?}. @@ -1846,9 +1856,90 @@ why we have to choose \Lcs{pstAreaJ} and so on: \rput[l](0.2,2){\textcolor{blue}{Lowersum: \pstAreaM}}% \end{pspicture} \end{lstlisting} -\clearpage %-------------------------------------------------------------------------------------- + +The values for the Riemann sum can also be calculatet on \LaTeX\ level, but it needs +the package xparse and fp from the new \LaTeX3 kernel. It is not available for running \TeX. + +\begin{BDef} +\Lcs{psRiemannSum}\Largr{$x_0,x_1$}\Largb{n}\Largb{f(\#1)} +\end{BDef} + +The variable name in the last argument must be \#1! +After using the above macro the following four macros are defined: + +\begin{BDef} +\Lcs{psLeftSumValue}\\ +\Lcs{psRightSumValue}\\ +\Lcs{psMiddleSumValue}\\ +\Lcs{psDiffSumValue} +\end{BDef} + +They all sum up the Riemann sum for the rectangle of width $dx$ and the height of the left, right +or middle value of the function $f(x)$. \Lcs{psDiffSumValue} sums up the absolute value of rextangles +in difference to the other three macros which takes a negative area into account. + +%\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)}% +\psset{linewidth=0.1pt}% +\psRiemannSum(0,9){18}{sqrt(#1)*sin(#1)} +\psStep[algebraic,linecolor=magenta,StepType=upper,saveSumValue](0,9){18}{sqrt(x)*sin(x)}% +\rput[l](0.2,2.5){\textcolor{magenta}{Uppersum: \psRightSumValue}}% +\psStep[algebraic,linecolor=blue,saveSumValue](0,9){18}{sqrt(x)*sin(x)}% +\rput[l](0.2,2){\textcolor{blue}{Lowersum: \psLeftSumValue}}% +\end{pspicture} +%\end{LTXexample} + +\begin{lstlisting} +\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)}% +\psset{linewidth=0.1pt}% +\psRiemannSum(0,9){18} +\psStep[algebraic,linecolor=magenta,StepType=upper,saveSumValue](0,9){18}{sqrt(x)*sin(x)}% +\rput[l](0.2,2.5){\textcolor{magenta}{Uppersum: \psRightSumValue}}% +\psStep[algebraic,linecolor=blue,saveSumValue](0,9){18}{sqrt(x)*sin(x)}% +\rput[l](0.2,2){\textcolor{blue}{Lowersum: \psLeftSumValue}}% +\end{pspicture} +\end{lstlisting} + + +With package \texttt{siunitx} it is possible to round the values: + +\begin{lstlisting} +\usepackage{siunitx} +\sisetup{add-decimal-zero, + round-mode=places, + round-precision=2, + output-decimal-marker={,}, + detect-all} +[...] +\psRiemannSum(0,9){18}{sqrt(#1)*sin(#1)}% +\num{\psLeftSumValue}\\ +\num{\psRightSumValue}\\ +\num{\psMiddleSumValue}\\ +\num{\psDiffSumValue} +\end{lstlisting} + +\psRiemannSum(0,9){18}{sqrt(#1)*sin(#1)}% +\num{\psLeftSumValue}\\ +\num{\psRightSumValue}\\ +\num{\psMiddleSumValue}\\ +\num{\psDiffSumValue} + + +\clearpage + + + + + + \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, |