| Line 37... |
Line 37... |
| 37 |
\details{
|
37 |
\details{
|
| 38 |
Complex vectors can be created with \code{complex}. The vector can be
|
38 |
Complex vectors can be created with \code{complex}. The vector can be
|
| 39 |
specified either by giving its length, its real and imaginary parts, or
|
39 |
specified either by giving its length, its real and imaginary parts, or
|
| 40 |
modulus and argument. (Giving just the length generates a vector of
|
40 |
modulus and argument. (Giving just the length generates a vector of
|
| 41 |
complex zeroes.)
|
41 |
complex zeroes.)
|
| 42 |
|
42 |
|
| 43 |
\code{as.complex} attempts to coerce its argument to be of complex
|
43 |
\code{as.complex} attempts to coerce its argument to be of complex
|
| 44 |
type: like \code{\link{as.vector}} it strips attributes including names.
|
44 |
type: like \code{\link{as.vector}} it strips attributes including names.
|
| 45 |
|
45 |
|
| 46 |
Note that \code{is.complex} and \code{is.numeric} are never both
|
46 |
Note that \code{is.complex} and \code{is.numeric} are never both
|
| 47 |
\code{TRUE}.
|
47 |
\code{TRUE}.
|
| 48 |
|
48 |
|
| 49 |
The functions \code{Re}, \code{Im}, \code{Mod}, \code{Arg} and
|
49 |
The functions \code{Re}, \code{Im}, \code{Mod}, \code{Arg} and
|
| 50 |
\code{Conj} have their usual interpretation as returning the real
|
50 |
\code{Conj} have their usual interpretation as returning the real
|
| 51 |
part, imaginary part, modulus, argument and complex conjugate for
|
51 |
part, imaginary part, modulus, argument and complex conjugate for
|
| 52 |
complex values. Modulus and argument are also called the \emph{polar
|
52 |
complex values. Modulus and argument are also called the \emph{polar
|
| 53 |
coordinates}. If \eqn{z = x + i y} with real \eqn{x} and \eqn{y},
|
53 |
coordinates}. If \eqn{z = x + i y} with real \eqn{x} and \eqn{y},
|
| 54 |
\code{Mod}\eqn{(z) = \sqrt{x^2 + y^2}}, and for
|
54 |
for \eqn{r = \code{Mod}(z) = \sqrt{x^2 + y^2}}, and
|
| 55 |
\eqn{\phi= \code{Arg}(z)}, \eqn{x = \code{Mod}(z)\cos(\phi)} and
|
55 |
\eqn{\phi = \code{Arg}(z)}, \eqn{x = r*\cos(\phi)} and \eqn{y = r*\sin(\phi)}.
|
| 56 |
\eqn{y = \code{Mod}(z)\sin(\phi)}.
|
- |
|
| 57 |
They are all generic functions: methods can be defined
|
56 |
They are all generic functions: methods can be defined
|
| 58 |
for them individually or via the \code{\link{Complex}} group generic.
|
57 |
for them individually or via the \code{\link{Complex}} group generic.
|
| 59 |
|
58 |
|
| 60 |
In addition, the elementary trigonometric, logarithmic and exponential
|
59 |
In addition, the elementary trigonometric, logarithmic and exponential
|
| 61 |
functions are available for complex values.
|
60 |
functions are available for complex values.
|