Accelerating the pace of engineering and science

Documentation Center

• Trial Software
• Product Updates

norm

Compute the norm of a matrix, a vector, or a polynomial

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

```norm(M, <1 | 2 | Frobenius | Infinity | Spectral>)
norm(v, <Frobenius | Infinity | kv>)
norm(p, <kp>)
norm(f, <vars>, <kp>)
```

Description

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 = (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 AHA and the infinity-norm (maximum row sum)

can be computed. The 1-norm 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 = (vi), 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 1-norm is the sum norm

,

the Infinity-norm is the maximum norm

(this is the limit of the k-norms as k tends to infinity).

 Note:   For row vectors, the 1-norm is the maximum norm, whilst the Infinity-norm 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.

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 ci, 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 floating-point numbers. Coefficients containing symbolic numerical expressions such as PI+1, sqrt(2) etc. are accepted. Internally, they are converted to floating-point numbers. Cf. Example 3.

For indices k> 1, 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 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 1-norm and the infinity-norm produce floating-point 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 floating-point 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.

Examples

Example 1

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:`

Example 2

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:`

Example 3

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)```

`delete p:`

Example 4

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: 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:`

Parameters

 M A matrix of domain type Dom::Matrix(...) v A vector (a 1-dimensional matrix) kv A positive integer as index of the vector norm. p A polynomial generated by poly f vars A list of identifiers or indexed identifiers, interpreted as the indeterminates of f kp 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.

Options

 Frobenius Computes the Frobenius norm for vectors and matrices. Infinity Computes the Infinity norm for vectors and matrices. Spectral Computes the Spectral norm for matrices.

Return Values

Arithmetical expression.

f, p

See Also

MuPAD Functions

Was this topic helpful?