vec.norm {LambertW} | R Documentation |
Computes the L^p norm of an n-dimensional (real/complex) vector
vec.norm(x, p=2)
x |
n-dimensional vector (possibly complex values) |
p |
which norm? default: p=2 (Euclidean norm) |
The L^p norm of a vector x
in C^n equals
<=ft|<=ft| x right|right|_p = ( sum_{i=1}^n <=ft| x_i right|^p )^{1/p},
where <=ft| x_i right| is the absolute value of x_i. For p=2 we get the Euclidean norm; for p=1 the so called Manhattan distance.
the norm of x
Georg M. Goerg
a = c(3,-4) # Pythagoras vec.norm(a) # did not know Manhattan vec.norm(a, p=1) ### unit circle ?! x = exp(1i*runif(10, -pi,pi)) plot(x) sapply(x, vec.norm) # indeed it is