Library: | math |
See also: | cdiv cmul csub cadd |
Quantlet: | cabs | |
Description: | computes absolute value of a complex array |
Usage: | y = cabs(x) | |
Input: | ||
x | n x p x d1 x ... x dn complex array | |
Output: | ||
y | n x p x d1 x ... x dn array |
library("math") z = complex(3, 4) cabs(z) z = complex(4*matrix(2,2,2), 3*matrix(2,2,2)) cabs(z)
Contents of y ;; Pythagoras in complex plane [1,] 5 Contents of y [,,1,1,1,1,1,1] [1,] 5 5 [2,] 5 5 [,,2,1,1,1,1,1] [1,] 5 5 [2,] 5 5
library("math") library("plot") n = 100 t =(0:n)/n phi = t*2*pi xr = sqrt(t).*sin(phi) xi = t^2.*cos(phi) z = complex(xr, xi) dat = setmask(sin(phi)~cabs(z), "line", "blue") gc = setmask( #(0.2, 0.7)' + grcircle(0.3), "line", "red") leye = setmask( #(0.1, 0.75)' + grcircle(0.05), "line", "green") reye = setmask( #(0.3, 0.75)' + grcircle(0.05), "line", "green") nose = setmask( #(0.2, 0.65)' + grcircle(0.02), "line", "magenta") plot(dat, gc, leye, reye, nose)
a curly graph with a "ghost face"