\HeaderA{MathFun}{Miscellaneous Mathematical Functions}{MathFun}
\aliasA{abs}{MathFun}{abs}
\aliasA{sqrt}{MathFun}{sqrt}
\keyword{math}{MathFun}
\begin{Description}\relax
These functions compute miscellaneous mathematical functions.
The naming follows the standard for computer languages
such as C or Fortran.
\end{Description}
\begin{Usage}
\begin{verbatim}
abs(x)
sqrt(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a numeric or \code{\LinkA{complex}{complex}} vector or array.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
These are generic functions: methods can be defined for them
individually or via the \code{\LinkA{Math}{Math}}
group generic.  For complex arguments (and the default method), \code{z},
\code{abs(z) == \LinkA{Mod}{Mod}(z)} and \code{sqrt(z) == z\textasciicircum{}0.5}.

\code{abs(x)} returns an \code{\LinkA{integer}{integer}} vector when \code{x} is
\code{integer} or \code{\LinkA{logical}{logical}}.
\end{Details}
\begin{Section}{S4 methods}
Both are S4 generic and members of the
\code{\LinkA{Math}{Math}} group generic.
\end{Section}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{Arithmetic}{Arithmetic}} for simple, \code{\LinkA{log}{log}} for logarithmic,
\code{\LinkA{sin}{sin}} for trigonometric, and \code{\LinkA{Special}{Special}} for
special mathematical functions.

\sQuote{\LinkA{plotmath}{plotmath}} for the use of \code{sqrt} in plot annotation.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
require(stats) # for spline
require(graphics)
xx <- -9:9
plot(xx, sqrt(abs(xx)),  col = "red")
lines(spline(xx, sqrt(abs(xx)), n=101), col = "pink")
\end{ExampleCode}
\end{Examples}

