vec.norm {LambertW}R Documentation

Lp norm of a vector

Description

Computes the L^p norm of an n-dimensional (real/complex) vector

Usage

vec.norm(x, p=2)

Arguments

x n-dimensional vector (possibly complex values)
p which norm? default: p=2 (Euclidean norm)

Details

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.

Value

the norm of x

Author(s)

Georg M. Goerg

Examples

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 

[Package LambertW version 0.1.9 Index]