MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: What function to use to find matrix condition number?

  • To: mathgroup at
  • Subject: [mg114427] Re: What function to use to find matrix condition number?
  • From: Daniel Lichtblau <danl at>
  • Date: Sat, 4 Dec 2010 06:12:54 -0500 (EST)

Nasser M. Abbasi wrote:
> This is version 8:
> I'd like to use LinearAlgebra`MatrixConditionNumber to find
> condition number of some matrix.
> btw, This command lists the functions in linear algebra.
> Names["LinearAlgebra`*"]
> But Mathematica says this package is now obsolete, and
> functionality is now in the kernel.
> <<LinearAlgebra`
> General::obspkg: {At Line = 3, the input was:,
> <<LinearAlgebra`,LinearAlgebra`} is now obsolete. The
> legacy version being loaded may conflict with current
> Mathematica functionality. See the Compatibility Guide for
> updating information. >>
> But When I follow the above, I get to page, where at the bottom
> it shows 3 functions, one of them is MatrixConditionNumber,
> but it does not show what replaced it in the kernel, instead
> it points to a link to MathSource article:
> "These functions were available in previous versions of Mathematica
> and are now available on the web at
> ?
> So, is there no build-in function to compute condition number now
> in Mathematica?
> I know I can find the max eigenvalue, divide it by the min
> eigenvalue (absolute values), and this gives me the condition
> number. But should not such a function be part of the system?

Actually it is the singular values you should divide. This gives the l_2 
condition number. If the matrix is real and symmetric (or complex and 
Hermitian) then the eigenvalue quotients you mention will also work.

> Or may be I overlooked it? I did search for it, can't find it
> in the documenation center.
> btw, I did also try the natural language interface also, and I asked
> W/ALpha by typing
>       = matrix condition number
> but it replied back with a chemical formula C16 H13 C1 N2 O, named diazepam, which is not what I wanted.
> thanks,
> --Nasser

You can get a good estimate of the l_infinity condition number from the 
third element in the result of LUDecomposition.

In[14]:= mat = RandomReal[1,{4,4}];

In[16]:= LUDecomposition[mat][[3]]
Out[16]= 13.1224

See Documentation Center page for LUDecomposition, More Information. 
Also if you type "condition number" into the search pane then 
LUDecomposition and SingularValueList are listed second and third in the 
results. That said, I agree with you that a dedicated function for this 
could be useful.

Daniel Lichtblau
Wolfram Research

  • Prev by Date: Re: Using a Correlation Matrix to reduce risk
  • Next by Date: Re: Changing Graph style
  • Previous by thread: Re: What function to use to find matrix condition number?
  • Next by thread: [Please Help] How to get coefficient list from a Series Command