5.44.1 Norms of a vector: maxnorm l1norm l2norm
norm
The instructions to compute the different norm of a vector are:
-
maxnorm returns the l∞ norm of a
vector,
defined as the maximum of the absolute values of its
coordinates.
Input:
maxnorm([3,-4,2])
Output:
4
Indeed: x=3, y=-4, z=2 and 4=max(|x|,|y|,|z|).
- l1norm returns the l1 norm of a
vector defined as the sum of the absolute values of its
coordinates.
Input:
l1norm([3,-4,2])
Output:
9
Indeed: x=3, y=-4, z=2 and 9=|x|+|y|+|z|.
- norm or l2norm returns the
l2 norm of a vector defined as the square root
of the sum of the squares of its
coordinates.
Input:
norm([3,-4,2])
Output:
sqrt(29)
Indeed: x=3, y=-4, z=2 and 29=|x|2+|y|2+|z|2.