Scilab 5.4.1
Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

# cond

condition number

### Calling Sequence

```c = cond(X)
c = cond(X, p)```

### Arguments

X

real or complex matrix. If c = cond(X, p), X must be real or complex square matrix.

p

scalar or string (type of norm) (default value = 2).

c

real scalar, the condition number.

### Description

c = cond(X)

returns condition number in 2-norm.`cond(X)` is the ratio of the largest singular value of `X` to the smallest.

c = cond(X, p)

returns condition number in p-norm : `norm(X, p) * norm(inv(X), p)`. If `p` is specified, `p` can be equal to :

• p = 1. `cond(X, p)` returns condition number in 1-norm.

• p = 2. `cond(X, p)` returns condition number in 2-norm.

• p = %inf or 'inf'. `cond(X, p)` returns condition number in infinity norm.

• p = 'fro'. `cond(X, p)` returns condition number in Frobenius norm.

### Examples

```A=testmatrix('hilb',6);
// condition number in 2-norm
cond(A)
cond(A, 2)

// condition number in 1-norm
cond(A, 1)

// condition number in infinity norm
cond(A, %inf)

// condition number in Frobenius norm
cond(A, 'fro')```

 Version Description 5.4.0 Calling `cond(X)`, where `X` is non square matrix, is now managed. For example: ```X = [1 0; 1 -1; 0 1]; cond(X)``` Calling `cond(X, p)` allows to calculate p-norm condition number. For example: ```X = [1 -6 0; 1 0 -4;1 0 2]; cond(X, 1) // condition number in 1-norm (p = 1)```