TITLE(complex @@ Complex Vectors)
USAGE(
complex(n=0, real=numeric(), imag=numeric())
as.complex(z)
is.complex(z)
BLANK
Re(z)
Im(z)
Mod(z)
Arg(z)
Conj(z)
)
ALIAS(complex)
ALIAS(as.complex)
ALIAS(is.complex)
ALIAS(Re)
ALIAS(Im)
ALIAS(Mod)
ALIAS(Arg)
ALIAS(Conj)
DESCRIPTION(
These are basic functions which support complex arithmetic in R.
Complex vectors can be created with LANG(complex).
The vector can be specified either by giving its length,
or its real and imaginary parts (or both).
PARA
Note that LANG(is.complex) and LANG(is.numeric) are never both LANG(TRUE).
PARA
The functions LANG(Re), LANG(Im), LANG(Mod), LANG(Arg) and LANG(Conj)
have their usual interpretation as returning the real part,
imaginary part, modulus, argument and complex conjugate for
complex values.
In addition, the elementary trigonometric, logarithmic and
exponential functions are available for complex values.
)
EXAMPLES(
# create a complex normal vector
z <- complex(real=rnorm(100), imag=rnorm(100))
# or also (less efficiently):
z2 <- 1:2 + 1i*(8:9)
)
