summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex343
1 files changed, 199 insertions, 144 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex
index 0ff8c958520..7ec64df937c 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-parsing.tex
@@ -20,7 +20,7 @@ units.
It should be noted that all
calculations must not exceed $\pm16383.99999$ at \emph{any} point,
-because the underlying algorithms relie on \TeX{} dimensions. This
+because the underlying algorithms rely on \TeX{} dimensions. This
means that many of the underlying algorithms are necessarily
approximate. It also means that some of the algorithms are not very
fast. \TeX{} is, after all, a typesetting language and not ideally
@@ -51,10 +51,7 @@ engine is the following:
In the following, the special properties of this command are
explained. The exact syntax of mathematical expressions is explained
- in Section~\ref{pgfmath-syntax}. Note that unlike the rest of the
- manual, the examples show the result of the calculation (that is,
- the value of the macro |\pgfmathresult|), not what is displayed in
- the document.
+ in Section~\ref{pgfmath-syntax}.
\begin{itemize}
\item
@@ -62,12 +59,12 @@ engine is the following:
\emph{without units}. This is true regardless of whether the
\meta{expression} contains any unit specification. But, any units
specified will be converted to points first.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2pt+3.4pt}
+\begin{codeexample}[]
+\pgfmathparse{2pt+3.4pt} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2cm+3.4cm}
+\begin{codeexample}[]
+\pgfmathparse{2cm+3.4cm} \pgfmathresult
\end{codeexample}
\item If no units are specified \emph{at any point} in the
@@ -77,13 +74,13 @@ engine is the following:
but can be changed with |\pgfmathsetresultunitscale|. Note that
the result will still be a number \emph{without} units.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2pt+3.4pt}
+\begin{codeexample}[]
+\pgfmathparse{2pt+3.4pt} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
+\begin{codeexample}[]
\pgfmathsetresultunitscale{1cm}
-\pgfmathparse{2+3.4}
+\pgfmathparse{2+3.4} \pgfmathresult
\end{codeexample}
\pgfmathsetresultunitscale{1pt}
@@ -96,8 +93,8 @@ engine is the following:
\item The parser handles numbers with or without units regardless
of the operation.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{54pt/3cm*2.1}
+\begin{codeexample}[]
+\pgfmathparse{54pt/3cm*2.1} \pgfmathresult
\end{codeexample}
\item the parser can cope with \TeX{} registers, including those
@@ -105,31 +102,31 @@ engine is the following:
\makeatletter
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
+\begin{codeexample}[]
\pgf@x=12.34pt
\c@pgf@counta=5
-\pgfmathparse{\pgf@x+\c@pgf@counta*6}
+\pgfmathparse{\pgf@x+\c@pgf@counta*6} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
+\begin{codeexample}[]
\pgf@x=56.78pt
-\pgfmathparse{\pgf@x+\the\pgf@x}
+\pgfmathparse{\pgf@x+\the\pgf@x} \pgfmathresult
\end{codeexample}
\item \TeX{} dimension registers can be multiplied without the |*|
operator by preceding them with a number (\emph{not} a function),
or a count register.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
+\begin{codeexample}[]
\c@pgf@counta=-4
\pgf@x=10pt
-\pgfmathparse{.5\pgf@x-\c@pgf@counta\pgf@x}%
+\pgfmathparse{.5\pgf@x-\c@pgf@counta\pgf@x} \pgfmathresult
\end{codeexample}
\item Parenthesis can be used to group operations.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{(4pt+0.5)*3}
+\begin{codeexample}[]
+\pgfmathparse{(4pt+0.5)*3} \pgfmathresult
\end{codeexample}
\item functions are recognized, so it is possible to parse
@@ -137,19 +134,19 @@ engine is the following:
radians, multiplied by 60''. The argument of most functions can
be any expression.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{sin(pi/2 r)*60}
+\begin{codeexample}[]
+\pgfmathparse{sin(pi/2 r)*60} \pgfmathresult
\end{codeexample}
\item Scientific notation in the form |1.234e+4| is recognised (but
the restriction on the range of values still applies). The exponent
symbol can be upper or lower case (i.e., |E| or |e|).
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{1.234567891e-2}
+\begin{codeexample}[]
+\pgfmathparse{1.234567891e-2} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{1.234567891e4}
+\begin{codeexample}[]
+\pgfmathparse{1.234567891e4} \pgfmathresult
\end{codeexample}
\end{itemize}
\end{command}
@@ -211,8 +208,8 @@ magnitude faster than calling the parser.
\end{command}
\begin{command}{\pgfmathsetcounter\marg{counter}\marg{expression}}
- Sets the value of the \meta{counter}, to the \emph{truncated} value
- specified by \meta{expression}.
+ Sets the value of the \LaTeX{} \meta{counter}, to the \emph{truncated}
+ value specified by \meta{expression}.
\end{command}
\begin{command}{\pgfmathaddtocounter\marg{counter}\marg{expression}}
@@ -233,6 +230,15 @@ magnitude faster than calling the parser.
is a decimal \emph{without} units.
\end{command}
+\begin{command}{\pgfmathsetlengthmacro\marg{macro}\marg{expression}}
+ Defines \meta{macro} as the value of \meta{expression}
+ \LaTeX{}\emph{in points}.
+\end{command}
+
+\begin{command}{\pgfmathtruncatemacro\marg{macro}\marg{expression}}
+ Defines \meta{macro} as the truncated value of \meta{expression}.
+\end{command}
+
\subsection{Syntax for mathematical expressions}
@@ -240,53 +246,55 @@ magnitude faster than calling the parser.
\label{pgfmath-syntax}
The syntax for the expressions recognized by |\pgfmathparse| and
-friends is based on the syntax recognized by \textsc{matlab}. The
-following operations and functions are currently recognized:
+friends is straightfoward, and the following operations and
+functions are currently recognized:
\begin{math-operator}{\mvar{x}\ +\ \mvar{y}}
Adds \mvar{y} to \mvar{x}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{4+2pt}
+\begin{codeexample}[]
+\pgfmathparse{4+2pt} \pgfmathresult
\end{codeexample}
\end{math-operator}
\begin{math-operator}{\mvar{x}\ -\ \mvar{y}}
Subtracts \mvar{y} from \mvar{x}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{155.35-4cm}
+\begin{codeexample}[]
+\pgfmathparse{155.35-4cm} \pgfmathresult
\end{codeexample}
\end{math-operator}
\begin{math-operator}{\mvar{x}\ *\ \mvar{y}}
Multiplies \mvar{x} by \mvar{y}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{3.9pt*4.56}
+\begin{codeexample}[]
+\pgfmathparse{3.9pt*4.56} \pgfmathresult
\end{codeexample}
\end{math-operator}
\begin{math-operator}{\mvar{x}\ /\ \mvar{y}}
Divides \mvar{x} by \mvar{y}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{-31.6pt/17}
+\begin{codeexample}[]
+\pgfmathparse{-31.6pt/17} \pgfmathresult
\end{codeexample}
\end{math-operator}
\begin{math-operator}{\mvar{x}\ {\char94}\ \mvar{y}}
-Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can be negative.
+Raises \mvar{x} to the power \mvar{y}. For greatest accuracy \mvar{y}
+should be an integer. If \mvar{y} is not an integer the actual
+calculation will be an approximation of $e^{y\ln(x)}$.
{
\catcode`\^=7
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2.3^4}
+\begin{codeexample}[]
+\pgfmathparse{2.3^4} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2^-4}
+\begin{codeexample}[]
+\pgfmathparse{2^-4} \pgfmathresult
\end{codeexample}
}
\end{math-operator}
@@ -302,8 +310,8 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
resulting in zero, and the second equality is therefore evaluating
|0==9|.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{3*5 == 15}
+\begin{codeexample}[]
+\pgfmathparse{3*5==15} \pgfmathresult
\end{codeexample}
\end{math-operator}
@@ -314,8 +322,8 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
This evaluates to |1| if \mvar{x} is greater than \mvar{y}, or |0| if
\mvar{x} is smaller or equal to \mvar{y}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{17 > 4.2*1.97+4}
+\begin{codeexample}[]
+\pgfmathparse{17>4.2*1.97+4} \pgfmathresult
\end{codeexample}
\end{math-operator}
@@ -325,18 +333,19 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
This evaluates to |1| if \mvar{x} is smaller than \mvar{y}, or |0| if
\mvar{x} is greater or equal to \mvar{y}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2 < -5.2/-3.6-2}
+\begin{codeexample}[]
+\pgfmathparse{2<-5.2/-3.6-2} \pgfmathresult
\end{codeexample}
\end{math-operator}
\begin{math-function}{mod(\mvar{x},\mvar{y})}
- This evaluates \mvar{x} modulo \mvar{y}. This function cannot be
- nested inside itself or the functions |max|, |min| or |veclen|.
+ This evaluates \mvar{x} modulo \mvar{y} (using truncated division).
+ This function cannot be nested inside itself or the functions |max|,
+ |min| or |pow|.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{mod(20,6)}
+\begin{codeexample}[]
+\pgfmathparse{mod(20,6)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -344,10 +353,10 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
\begin{math-function}{max(\mvar{x},\mvar{y})}
This evaluates to the maximum of \mvar{x} or \mvar{y}. This function
cannot be nested inside itself or the functions |min|, |mod| or
- |veclen|.
+ |pow|.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{max(17,23)}
+\begin{codeexample}[]
+\pgfmathparse{max(17,23)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -355,24 +364,24 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
\begin{math-function}{min(\mvar{x},\mvar{y})}
This evaluates to the minimum of \mvar{x} or \mvar{y}. This function
cannot be nested inside itself or the functions |max|, |mod| or
- |veclen|.
+ |pow|.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{min(17,23)}
+\begin{codeexample}[]
+\pgfmathparse{min(17,23)} \pgfmathresult
\end{codeexample}
\end{math-function}
-\begin{math-function}{abs(\mvar{x})}
+\begin{math-function}{abs(\mvar{x})}
Evaluates the absolute value of $x$.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{abs(-5)}
+\begin{codeexample}[]
+\pgfmathparse{abs(-5)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{-abs(4*-3)}
+\begin{codeexample}[]
+\pgfmathparse{-abs(4*-3)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -383,12 +392,12 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
rounding. So |1.5| is rounded to |2|, but |-1.5| is rounded to |-2|
(\emph{not} |0|).
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{round(32.5/17)}
+\begin{codeexample}[]
+\pgfmathparse{round(32.5/17)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{round(398/12)}
+\begin{codeexample}[]
+\pgfmathparse{round(398/12)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -397,12 +406,12 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Rounds \mvar{x} down to the nearest integer.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{floor(32.5/17)}
+\begin{codeexample}[]
+\pgfmathparse{floor(32.5/17)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{floor(398/12)}
+\begin{codeexample}[]
+\pgfmathparse{floor(398/12)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -411,12 +420,12 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Rounds \mvar{x} up to the nearest integer.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{ceil(32.5/17)}
+\begin{codeexample}[]
+\pgfmathparse{ceil(32.5/17)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{ceil(398/12)}
+\begin{codeexample}[]
+\pgfmathparse{ceil(398/12)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -425,24 +434,41 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
{
\catcode`\^=7
- Maclaurin series for $e^\textrm{\mvar{x}}$.
+ Maclaurin series for $e^x$.
}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{exp(1)}
+\begin{codeexample}[]
+\pgfmathparse{exp(1)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{exp(2.34)}
+\begin{codeexample}[]
+\pgfmathparse{exp(2.34)} \pgfmathresult
+\end{codeexample}
+
+\end{math-function}
+
+
+\begin{math-function}{ln(\mvar{x})}
+{
+\catcode`\^=7
+
+ An approximation for for $\ln(\textrm{\mvar{x}})$.
+}
+\begin{codeexample}[]
+\pgfmathparse{ln(10)} \pgfmathresult
+\end{codeexample}
+
+\begin{codeexample}[]
+\pgfmathparse{ln(exp(5))} \pgfmathresult
\end{codeexample}
\end{math-function}
\begin{math-function}{pow(\mvar{x},\mvar{y})}
- Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can be negative.
+ Raises \mvar{x} to the power \mvar{y}.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{pow(2,7)}
+\begin{codeexample}[]
+\pgfmathparse{pow(2,7)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -451,28 +477,22 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Calculates $\sqrt{\textrm{\mvar{x}}}$.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{sqrt(10)}
+\begin{codeexample}[]
+\pgfmathparse{sqrt(10)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{sqrt(8765.432)}
+\begin{codeexample}[]
+\pgfmathparse{sqrt(8765.432)} \pgfmathresult
\end{codeexample}
\end{math-function}
\begin{math-function}{veclen(\mvar{x},\mvar{y})}
- Evaluates the Euclidean distance from |(0,0)| to |(|\mvar{x}|,|\mvar{y}|)|.
- This function cannot be nested inside itself, or the functions |max|,
- |min| or |mod|.
-
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{veclen(15,14)}
-\end{codeexample}
+ Calculates $\sqrt{\left(\textrm{\mvar{x}}^2+\textrm{\mvar{y}}^2\right)}$.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{veclen(3,4)}
+\begin{codeexample}[]
+\pgfmathparse{veclen(12,5)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -481,12 +501,12 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
The constant $\pi=3.14159$.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{pi}
+\begin{codeexample}[]
+\pgfmathparse{pi} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{pi r}
+\begin{codeexample}[]
+\pgfmathparse{pi r} \pgfmathresult
\end{codeexample}
\end{math-constant}
@@ -499,16 +519,16 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
converts 2 radians to degrees, but |3-4+6r|, converts 6 radians to
degrees and adds the result to |-1|.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2*pi r-pi r}
+\begin{codeexample}[]
+\pgfmathparse{2*pi r-pi r} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2*pi/8 r}
+\begin{codeexample}[]
+\pgfmathparse{2*pi/8 r} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{sin(3*pi/2r)*60}
+\begin{codeexample}[]
+\pgfmathparse{sin(3*pi/2r)*60} \pgfmathresult
\end{codeexample}
\end{math-operator}
@@ -517,8 +537,8 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Convert \mvar{x} to radians. \mvar{x} is assumed to be in degrees.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{rad(90)}
+\begin{codeexample}[]
+\pgfmathparse{rad(90)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -527,8 +547,8 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Convert \mvar{x} to degrees. \mvar{x} is assumed to be in radians.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{deg(3*pi/2)}
+\begin{codeexample}[]
+\pgfmathparse{deg(3*pi/2)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -538,11 +558,11 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Sine of \mvar{x}. By employing the |r| operator, \mvar{x} can be in
radians.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{sin(60)}
+\begin{codeexample}[]
+\pgfmathparse{sin(60)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
+\begin{codeexample}[]
\pgfmathparse{sin(pi/3 r)}
\end{codeexample}
@@ -553,12 +573,12 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Cosine of \mvar{x}. By employing the |r| operator, \mvar{x} can be in
radians.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{cos(60)}
+\begin{codeexample}[]
+\pgfmathparse{cos(60)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{cos(pi/3 r)}
+\begin{codeexample}[]
+\pgfmathparse{cos(pi/3 r)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -568,32 +588,67 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Tangent of \mvar{x}. By employing the |r| operator, \mvar{x} can be in
radians.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{tan(45)}
+\begin{codeexample}[]
+\pgfmathparse{tan(45)} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{tan(2*pi/8 r)}
+\begin{codeexample}[]
+\pgfmathparse{tan(2*pi/8 r)} \pgfmathresult
+\end{codeexample}
+
+\end{math-function}
+
+
+\begin{math-function}{sec(\mvar{x})}
+
+ Secant of \mvar{x}. By employing the |r| operator, \mvar{x} can be in
+ radians.
+
+\begin{codeexample}[]
+\pgfmathparse{sec(45)} \pgfmathresult
+\end{codeexample}
+
+\end{math-function}
+
+\begin{math-function}{cosec(\mvar{x})}
+
+ Cosecant of \mvar{x}. By employing the |r| operator, \mvar{x} can be in
+ radians.
+
+\begin{codeexample}[]
+\pgfmathparse{cosec(30)} \pgfmathresult
+\end{codeexample}
+
+\end{math-function}
+
+\begin{math-function}{cot(\mvar{x})}
+
+ Cotangent of \mvar{x}. By employing the |r| operator, \mvar{x} can be in
+ radians.
+
+\begin{codeexample}[]
+\pgfmathparse{cot(15)} \pgfmathresult
\end{codeexample}
\end{math-function}
\begin{math-function}{asin(\mvar{x})}
- Arcsine of \mvar{x}. The result is in degrees.
+ Arcsine of \mvar{x}. The result is in degrees and in the range $\pm90^\circ$.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{asin(0.7071)}
+\begin{codeexample}[]
+\pgfmathparse{asin(0.7071)} \pgfmathresult
\end{codeexample}
\end{math-function}
\begin{math-function}{acos(\mvar{x})}
- Arccosine of \mvar{x} in degrees.
+ Arccosine of \mvar{x} in degrees. The result is in the range $\pm90^\circ$.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{acos(0.5)}
+
+\begin{codeexample}[]
+\pgfmathparse{acos(0.5)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -602,8 +657,8 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Arctangent of $x$ in degrees.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{atan(1)}
+\begin{codeexample}[]
+\pgfmathparse{atan(1)} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -612,16 +667,16 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Generates a pseudo-random number between 0 and 1.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{rnd}
+\begin{codeexample}[]
+\pgfmathparse{rnd} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{2*rnd}
+\begin{codeexample}[]
+\pgfmathparse{2*rnd} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{-rnd+5}
+\begin{codeexample}[]
+\pgfmathparse{-rnd+5} \pgfmathresult
\end{codeexample}
\end{math-function}
@@ -630,12 +685,12 @@ Raises \mvar{x} to the power \mvar{y}. \mvar{y} should be an integer, but it can
Generates a pseudo-random number between -1 and 1.
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{rand}
+\begin{codeexample}[]
+\pgfmathparse{rand} \pgfmathresult
\end{codeexample}
-\begin{codeexample}[post=\tt\footnotesize\pgfmathresult]
-\pgfmathparse{rand*15}
-\end{codeexample}
+\begin{codeexample}[]
+\pgfmathparse{rand*15} \pgfmathresult
+\end{codeexample}
\end{math-function}