From: Peter Langfelder <peter.langfelder_at_gmail.com>

Date: Wed, 16 Mar 2011 09:59:12 -0700

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Mar 2011 - 17:01:33 GMT

Date: Wed, 16 Mar 2011 09:59:12 -0700

On Wed, Mar 16, 2011 at 8:28 AM, Feng Li <m_at_feng.li> wrote:

> Dear R,

*>
**> If I have remembered correctly, a square matrix is singular if and only if
**> its determinant is zero. I am a bit confused by the following code error.
**> Can someone give me a hint?
**>
**>> a <- matrix(c(1e20,1e2,1e3,1e3),2)
**>> det(a)
**> [1] 1e+23
**>> solve(a)
**> Error in solve.default(a) :
**> system is computationally singular: reciprocal condition number = 1e-17
**>
*

You are right, a matrix is mathematically singular iff its determinant is zero. However, this condition is useless in practice since in practice one cares about the matrix being "computationally" singular, i.e. so close to singular that it cannot be inverted using the standard precision of real numbers. And that's what your matrix is (and the error message you got says so).

a = 1e20 * matrix (c(1, 1e-18, 1e-17, 1e-17), 2, 2)

Peter

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Mar 2011 - 17:01:33 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 16 Mar 2011 - 17:50:22 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*