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.
norm(M
, <1  2  Frobenius  Infinity  Spectral
>) norm(v
, <Frobenius  Infinity  kv
>) norm(p
, <kp
>) norm(f
, <vars
>, <kp
>)
norm(M, kM)
computes the norm of index kM
of
the matrix M
.
norm(v, kv)
computes the norm of index kv
of
the vector v
.
norm(p, kp)
computes the norm of index kp
of
the polynomial p
.
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
= (M_{ij}) with min(m, n)
> 1, only the 1norm
(maximum column sum)
,
the Frobenius norm
,
the spectral norm
,
where ϕ is the largest eigenvalue of A^{H} A and the infinitynorm (maximum row sum)
can be computed. The 1norm
and the Infinity
norm are operator norms with respect
to the corresponding norms on the vector spaces the matrix is acting
upon.
For vectors v
= (v_{i}),
represented by matrices of dimension 1×n or n×1,
norms with arbitrary positive integer indices k as
well 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, Infinity
,
and Frobenius
, the vector norms are given by the
corresponding matrix norms. For column vectors, the 1norm is the
sum norm
,
the Infinity
norm is the maximum norm
(this is the limit of the knorms as k tends to infinity).
Note:
For row vectors, the 1norm is the maximum norm, whilst the 
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.
For matrix and vector norms, also refer to the help page of Dom::Matrix
(note that
the function matrix
generates
matrices of type Dom::Matrix()
).
For polynomials p
with coefficients c_{i},
the norms are given by
.
Also multivariate polynomials are accepted by norm
.
The coefficients with respect to all indeterminates are taken into
account.
For polynomials, only numerical norms can be computed. The coefficients
of the polynomial must not contain symbolic parameters that cannot
be converted to floatingpoint numbers. Coefficients containing symbolic
numerical expressions such as PI+1
, sqrt(2)
etc.
are accepted. Internally, they are converted to floatingpoint numbers.
Cf. Example 3.
For indices k> 1
, norm(p, k)
always
returns a floatingpoint number. The 1norm
produces an exact result if all coefficients are integers or rational
numbers. The infinitynorm norm(p)
produces
an exact result, if the coefficient of largest magnitude is an integer
or a rational number. In all other cases, also the 1norm
and the infinitynorm
produce floatingpoint numbers. Cf. Example 3.
For polynomials over the coefficient ring IntMod(m)
, norm
produces
an error.
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 floatingpoint number via float
. With the coefficient
norms
, norm(p)
computes
the maximum norm
; norm(p,
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
computed.
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)
For matrices, norm
produces exact symbolic
results:
M := matrix([[2/3, 63, PI],[x, y, z]]): norm(M)
norm(M, 1)
norm(M, Frobenius)
delete M:
A column vector col
and a row vector row
are
considered:
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 Infinity
have
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 floatingpoint 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)
delete 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 y^{2} are
found which are not accepted:
f := 6*x*y + 9*y^2 + 2: norm(f, [x])
Error: The argument is invalid. [norm]
As a bivariate polynomial with the indeterminates x
and y
,
the coefficients are 6, 9,
and 2. Now, norms can be
computed:
norm(f, [x, y], 1), norm(f, [x, y], 2), norm(f, [x, y])
delete f:

A matrix of domain
type 

A vector (a 1dimensional matrix) 

A positive integer as index of the vector norm. 

A polynomial generated
by 
 

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. 
Arithmetical expression.
f
, p