complex(base)
complex()所属R语言包:base
Complex Vectors
复杂的矢量图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Basic functions which support complex arithmetic in R.
支持复杂运算的基本功能,在R
用法----------Usage----------
complex(length.out = 0, real = numeric(), imaginary = numeric(),
modulus = 1, argument = 0)
as.complex(x, ...)
is.complex(x)
Re(z)
Im(z)
Mod(z)
Arg(z)
Conj(z)
参数----------Arguments----------
参数:length.out
numeric. Desired length of the output vector, inputs being recycled as needed.
数字。所需的输出向量的长度,输入需要被回收。
参数:real
numeric vector.
数字向量。
参数:imaginary
numeric vector.
数字向量。
参数:modulus
numeric vector.
数字向量。
参数:argument
numeric vector.
数字向量。
参数:x
an object, probably of mode complex.
可能的模式complex对象。
参数:z
an object of mode complex, or one of a class for which a methods has been defined.
模式complex,或一个类的方法已经被定义的对象。
参数:...
further arguments passed to or from other methods.
通过进一步的论据或其他方法。
Details
详情----------Details----------
Complex vectors can be created with complex. The vector can be specified either by giving its length, its real and imaginary parts, or modulus and argument. (Giving just the length generates a vector of complex zeroes.)
complex可以创建复杂的矢量。向量可以指定给它的长度,它的实部和虚部,或模和论证。 (仅仅给出长度生成一个复杂的零向量。)
as.complex attempts to coerce its argument to be of complex type: like as.vector it strips attributes including names. All forms of NA and NaN are coerced to a complex NA, for which both the real and imaginary parts are NA.
as.complex试图强迫其参数是复杂的类型:喜欢as.vector它去掉,包括名称的属性。 NA和NaN强迫所有形式的一个复杂的NA,其中实部和虚部分NA。
Note that is.complex and is.numeric are never both TRUE.
请注意,is.complex和is.numeric是从来都TRUE。
The functions Re, Im, Mod, Arg and Conj have their usual interpretation as returning the real part, imaginary part, modulus, argument and complex conjugate for complex values. The modulus and argument are also called the polar coordinates. If z = x + i y with real x and y, for r = Mod(z) = √(x^2 + y^2), and φ = Arg(z), x = r*cos(φ) and y = r*sin(φ). They are all internal generic primitive functions: methods can be defined for them individually or via the Complex group generic.
职能Re,Im,Mod,Arg和Conj返回的实部,虚部,模数,参数和复共轭他们通常的解释复杂的值。模数和参数也被称为极坐标。 z = x + i y如果真正的x和y,r = Mod(z) = √(x^2 + y^2),φ = Arg(z),x = r*cos(φ)和y = r*sin(φ)。他们都是内部通用的原始功能:可以定义为他们单独或通过Complex组通用方法。
In addition, the elementary trigonometric, logarithmic, exponential, square root and hyperbolic functions are implemented for complex values.
此外,小学三角函数,对数,指数,平方根和双曲函数实现复杂的值。
Internally, complex numbers are stored as a pair of double precision numbers, either or both of which can be NaN or plus or minus infinity.
内部,复杂的数字存储为一对双精度数,或者两者都可以NaN或加或负无穷大。
S4方法----------S4 methods----------
as.complex is primitive and can have S4 methods set.
as.complex是原始的,可以有S4方法。
Re, Im, Mod, Arg and Conj constitute the S4 group generic Complex and so S4 methods can be set for them individually or via the group generic.
Re,Im,Mod,Arg和Conj构成S4组通用Complex“S4方法可以为他们单独或通过组通用。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
举例----------Examples----------
require(graphics)
0i ^ (-3:3)
matrix(1i^ (-6:5), nrow=4) #- all columns are the same[ - 所有列是相同的]
0 ^ 1i # a complex NaN[一个复杂的NaN的]
## create a complex normal vector[#创建一个复杂的法向量]
z <- complex(real = stats::rnorm(100), imaginary = stats::rnorm(100))
## or also (less efficiently):[#或(效率较低):]
z2 <- 1:2 + 1i*(8:9)
## The Arg(.) is an angle:[()#arg是一个角度:]
zz <- (rep(1:4,len=9) + 1i*(9:1))/10
zz.shift <- complex(modulus = Mod(zz), argument= Arg(zz) + pi)
plot(zz, xlim=c(-1,1), ylim=c(-1,1), col="red", asp = 1,
main = expression(paste("Rotation by "," ", pi == 180^o)))
abline(h=0,v=0, col="blue", lty=3)
points(zz.shift, col="orange")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|