norm
Computes the norm of a number, vector, or matrix.
Syntax

norm(x[, kind[, param]])

x
is a number, a vector, or a matrix 
kind
is a string 
param
is an integer

Description
If x
is a number, a vector, or a matrix, then norm(x, kind, param)
returns the norm of x
. kind
specifies the kind of norm, and if it denotes a parameterised norm type, then param
specifies the value of the parameter.
The following norm kinds are supported (with abbreviations):

Euclidean norm (Euclidean)

Frobenius norm (Frobenius)

pnorm (p) *

max norm (max)

sum norm (sum)

knorm (k) *

max column sum norm (max column sum)

max row sum norm (max row sum)

spectral norm (spectral)
An asterisk (*) indicates that the norm accepts a parameter.
The Euclidean and Frobenius norms are equal for numbers, vectors, and matrices. The p
norm is a generalisation that sums the entries’ absolute values raised to the power of p
and then computes the p
th root of the sum. The k
norm, on the other hand, computes the sum of the k
greatest absolute values. The spectral norm returns the greatest singular value.
If omitted, kind
defaults to "Euclidean"
and the parameter to 2
.
If x
is a (real or complex) number, norm(x, kind, param)
is always equal to abs(x)
. If x
is a vector, the spectral norm is not applicable. For other norms, a vector is treated like a column matrix.
Examples
A ≔ ❨❨5, 0, 1, 2❩, ❨−3, 2, 3, 4❩, ❨4, 2, 0, 1❩, ❨3, 6, 2, 0❩❩
⎛ 5 0 1 2⎞ ⎜−3 2 3 4⎟ ⎜ 4 2 0 1⎟ ⎝ 3 6 2 0⎠
NormTypes ≔ '("Euclidean", "Frobenius", "p", "max", "sum", "k", "max column sum", "max row sum", "spectral");
NormTypes @ (x ↦ norm(A, x))
11.7473401245 11.7473401245 11.7473401245 6 38 11 15 12 8.79887871437