Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Scilab 6.0.2
Change language to: Français - Português - 日本語 - Русский

# cond

condition number of a matrix

### Syntax

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

### Arguments

X

real or complex matrix. For the `c = cond(X,p)` syntax, `X` must be square.

p

1 | 2 | %inf | "inf" | "fro": Used norm. Default value = 2.

c

positive decimal number: 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 the condition number in p-norm : `norm(X, p) * norm(inv(X), p)`. `p` possible values are:

 1 : condition number in 1-norm. 2 : condition number in 2-norm. %inf | "inf" : condition number in infinite norm "fro" : condition number in Frobenius norm

### Examples

```// Condition number of a non-square matrix
cond([1 0 -1 ; 0 1 -1])

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

• rcond — inverse condition number
• svd — singular value decomposition
• norm — norms of a vector or a matrix

### History

 Version Description 5.4.0 cond(X) now accepts non square matrix. New input argument p introduced. 6.0.2 cond([]) now returns 0 instead of 1.