数学

范数与单位球

范数给每个向量赋予长度。L1、L2 和 L∞ 的单位球分别是一个菱形、一个圆和一个正方形。

5 分钟难度 1/3交互演示区域不展示广告。
||u||₁1.900||u||₂1.389||u||∞1.200SelectedL2 = 1.389

||u||₂ = sqrt(1.20² + 0.70²) = 1.389

L2 is the ordinary Euclidean length.

All three unit balls have norm 1, but their shapes differ. On the axes the three norms agree; off the axes they measure distance differently. The selected norm is highlighted and the vector stays fixed as you switch norms.

你看到的是什么

1

L1 范数是 |x| + |y|。它的单位球是菱形,因为坐标距离之和为 1 的点构成边界。

2

L2 范数是 sqrt(x² + y²),即通常的欧几里得长度。它的单位球是圆。

3

L∞ 范数是 max(|x|, |y|)。它的单位球是正方形。三种范数在坐标轴上的值相同。

为什么重要

范数定义距离和误差。L1 鼓励稀疏,L2 是标准欧氏距离,L∞ 控制最坏坐标误差。

复杂度与细节

在二维中,每个范数对每个向量的计算都是 O(1)。

常见问题

为什么单位球形状不同?+

单位球是范数为 1 的向量集合。不同公式产生不同边界:菱形、圆或正方形。

应该使用哪种范数?+

普通距离用 L2;关注稀疏性或稳健绝对误差时用 L1;关注最大坐标误差时用 L∞。