Basic Examples (4)

Calculate the κ of a matrix w.r.t. 2-norm:

({{"[◼]", "MatrixConditionNumber" }})[{{2,1},{4,3}}]

For a 3×3 matrix:

({{"[◼]", "MatrixConditionNumber" }})[{{2,-1,1},{1,0,1},{3,-1,4}}]

Condition number computed with machine precision:

({{"[◼]", "MatrixConditionNumber" }})[{{2.,-1.,1.},{1.,0.,1.},{3.,-1.,4.}}]

Symbolic calculation:

({{"[◼]", "MatrixConditionNumber" }})[{{a,0},{0,d}}]

Condition number of a complex matrix:

({{"[◼]", "MatrixConditionNumber" }})[{{π,(1/3)},{I,5}}]

Scope (5)

Calculate the condition number corresponding to other norms:

({{"[◼]", "MatrixConditionNumber" }})[mat={{.913I,.659},{.457,-.33}}]

({{"[◼]", "MatrixConditionNumber" }})[mat,Norm->1]

({{"[◼]", "MatrixConditionNumber" }})[mat,Norm->"Frobenius"]

({{"[◼]", "MatrixConditionNumber" }})[mat,Norm->Infinity]

For any matrix A, κ(λ A)=κ(A)

Simplify[
({{"[◼]", "MatrixConditionNumber" }})[λ{{3,4},{-2,5}}]==({{"[◼]", "MatrixConditionNumber" }})[{{3,4},{-2,5}}],
Assumptions->λ∈Reals
]

or for any complex constant as well:

({{"[◼]", "MatrixConditionNumber" }})[(2+3I){{3,4},{-2,5}}]==({{"[◼]", "MatrixConditionNumber" }})[{{3,4},{-2,5}}]

For a diagonal matrix D=diag((Subscript[d, i])), κ(D)=(((max_i) (Subscript[d, i]))/((min_i)(Subscript[d, i]))):

({{"[◼]", "MatrixConditionNumber" }})[DiagonalMatrix[diag={4+I,2,-I,-3}]]==((Max[Abs/@diag])/(Min[Abs/@diag]))

Efficient of large computations depend on the efficiency of very efficient Norm:

m=RandomReal[{1,9},{100,100}];

({{"[◼]", "MatrixConditionNumber" }})[m]//Timing

Condition number of sparse matrices:

SparseArray[{{1,1}->2,{1,3}->1,{2,2}->3,{3,3}->4,{4,4}->5},{4,4}]

({{"[◼]", "MatrixConditionNumber" }})@%

Condition number of structured matrices:

SymmetrizedArray[{{1,1}->2,{1,2}->1},{2,2},Symmetric[All]]

({{"[◼]", "MatrixConditionNumber" }})@%

IdentityMatrix[n] always has condition number 1:

({{"[◼]", "MatrixConditionNumber" }})/@Table[IdentityMatrix[n],{n,1,10}]

Condition number of HilbertMatrix grows exponentially:

N@*({{"[◼]", "MatrixConditionNumber" }})/@Table[HilbertMatrix[n],{n,1,10}]

Properties and Relations (1)

MatrixConditionNumber requires the first argument to be a square matrix:

({{"[◼]", "MatrixConditionNumber" }})[{{1,2}}]