Compute the norm of a matrix, a vector, or a polynomial
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
1 | 2 | Frobenius | Infinity | Spectral>) norm(
Frobenius | Infinity | kv>) norm(
norm(M, kM) computes the norm of index
norm(v, kv) computes the norm of index
norm(p, kp) computes the norm of index
In MuPAD®, there is no difference between matrices and vectors: a vector is a matrix of dimension 1×n or n×1, respectively.
For an m×n matrix
M = (Mij) with min(m, n)
> 1, only the 1-norm
(maximum column sum)
the Frobenius norm
the spectral norm
where ϕ is the largest eigenvalue of AH A and the infinity-norm (maximum row sum)
can be computed. The 1-norm
Infinity-norm are operator norms with respect
to the corresponding norms on the vector spaces the matrix is acting
v = (vi),
represented by matrices of dimension 1×n or n×1,
norms with arbitrary positive integer indices k as
Infinity can be computed. For integers k >
1, the vector norms are given by
for column vectors as well as for row vectors.
For indices 1,
Frobenius, the vector norms are given by the
corresponding matrix norms. For column vectors, the 1-norm is the
Infinity-norm is the maximum norm
(this is the limit of the k-norms as k tends to infinity).
For row vectors, the 1-norm is the maximum norm, whilst the
is the sum norm.
The Frobenius norm coincides with
norm(v, 2) for
both column and row vectors.
Cf. Example 2.
Matrices and vectors may contain symbolic entries. No internal float conversion is applied.
p with coefficients ci,
the norms are given by
Also multivariate polynomials are accepted by
The coefficients with respect to all indeterminates are taken into
For polynomials, only numerical norms can be computed. The coefficients
of the polynomial must not contain symbolic parameters that cannot
be converted to floating-point numbers. Coefficients containing symbolic
numerical expressions such as
are accepted. Internally, they are converted to floating-point numbers.
Cf. Example 3.
norm(p, k) always
returns a floating-point number. The 1-norm
produces an exact result if all coefficients are integers or rational
numbers. The infinity-norm
an exact result, if the coefficient of largest magnitude is an integer
or a rational number. In all other cases, also the 1-norm
and the infinity-norm
produce floating-point numbers. Cf. Example 3.
For polynomials over the coefficient ring
If the coefficient ring of the polynomial is a domain, it must
implement the method
"norm". This method must return
the norm of the coefficients as a number or as a numerical expression
that can be converted to a floating-point number via
float. With the coefficient
the maximum norm ;
k) computes .
A polynomial expression
f is internally converted
to the polynomial
poly(f). If a list of indeterminates
is specified, the norm of the polynomial
poly(f, vars) is
For polynomials and polynomial expressions, the norms are computed by a function of the system kernel.
We compute various norms of a 2×3 matrix:
M := matrix([[2, 5, 8], [-2, 3, 5]]): norm(M) = norm(M, Infinity), norm(M, 1), norm(M, Frobenius), norm(M, Spectral)
norm produces exact symbolic
M := matrix([[2/3, 63, PI],[x, y, z]]): norm(M)
A column vector
col and a row vector
col := matrix([x1, PI]): row := matrix([[x1, PI]]): col, row
norm(col, 2) = norm(row, 2)
norm(col, 3) = norm(row, 3)
Note that the norms of index 1 and
exchanged meanings for column and row vectors:
norm(col, 1) = norm(row, Infinity)
norm(col, Infinity) = norm(row, 1)
delete col, row:
The norms of some polynomials are computed:
p := poly(3*x^3 + 4*x, [x]): norm(p), norm(p, 1)
If the coefficients are not integers or rational numbers, automatic conversion to floating-point numbers occurs:
p := poly(3*x^3 + sqrt(2)*x + PI, [x]): norm(p), norm(p, 1)
Floating point numbers are always produced for indices greater than 1:
p := poly(3*x^3 + 4*x + 1, [x]): norm(p, 1), norm(p, 2), norm(p, 5), norm(p, 10), norm(p)
The norms of some polynomial expressions are computed:
norm(x^3 + 1, 1), norm(x^3 + 1, 2), norm(x^3 + PI)
The following call yields an error, because the expression is
regarded as a polynomial in
x. Consequently, symbolic
coefficients 6 y and 9 y2 are
found which are not accepted:
f := 6*x*y + 9*y^2 + 2: norm(f, [x])
Error: Invalid argument. [norm]
As a bivariate polynomial with the indeterminates
the coefficients are 6, 9,
and 2. Now, norms can be
norm(f, [x, y], 1), norm(f, [x, y], 2), norm(f, [x, y])
A matrix of domain
A vector (a 1-dimensional matrix)
A positive integer as index of the vector norm.
A list of identifiers or indexed identifiers, interpreted as
the indeterminates of
The index of the norm of the polynomial: a real number greater or equal than 1. If no index is specified, the maximum norm (of index infinity) is computed.
Computes the Frobenius norm for vectors and matrices.
Computes the Infinity norm for vectors and matrices.
Computes the Spectral norm for matrices.