表示方法
如果是向量范数,则P范数则表示为(比绝对值多了两条竖线):
[||x||_p = sqrt[p]{(x_1^p+x_2^p+...+x_n^p)} ag{1}
]
公式(1)中(x = (x_1,x_2,...,x_n))。如果(p=2),实际上就是最常见的欧氏距离(欧几里德范数)。如果(p=0),称为0范数,结果等于1。
欧氏距离
初中学过,在一个平面直角坐标系中,计算(x1)和(x2)两点之间的距离,用下面的公式(欧氏距离):
[d = sqrt{x_1^2 +x_2^2} ag{2}
]
公式(2)求得的长度称为欧几里德长度,也叫欧几里德范数。
例子
计算机处理数据的方式通常是一个矩阵。在矩阵中表达两点之间的距离就需要用到范数的概念了。比如,有下面的一个矩阵,求其2范数。
[egin{bmatrix}
1 & 3 & 4 \
5 & 6 & 9 \
2 & 7 & 8 \
end{bmatrix}
]
解
[||x||_2 = sqrt{1^2+3^2+4^2+5^2+6^2+9^2+2^2+7^2+8^2}
]