help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: matrix determinant calculation


From: Hui Zhang
Subject: Re: matrix determinant calculation
Date: Thu, 26 May 2005 15:49:29 -0500

Thank you all for replying.

My problem originates from calling inv function of octave in my own perl
program. For A=[1 2 3; 4 5 6; 7 8 9], Octave gives back inv(A) just as for
other nonsingular matrices without any warning. In my program,
det(A)=6e-16 is not small enough to be zero, and entry 9e+15 in inv(A) is
not big enough to be inf. I believe it is also true for most of
scientific/engineering computation. Considering all the entries in A are
integers, in my opinion det(a)=6e-16 is not an acceptable answer.

To detect singularity might be hard. However i believe that it is feasible
and might be a standard computational problem in CS. Matlab returns 0 for
det(A) and issues a warning for inv(A).

if A=[1 2 4;2 4 8; 3 6 5], octave gives out a warning for inv(A)
and returns "ans = 0" for det(A).  

you mentioned another better method to test singularity. My question is
why not call it first in det or inv function?

Best regards,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hui Zhang     Ph.D. Candidate & Research Assistant
VLSI System Design Lab
Department of Electrical and Computer Engineering
State University of New York at Stony Brook
Stony Brook, NY 11794-2350
Tel: 631-632-1068  Email: address@hidden
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Thu, 26 May 2005, A Scotte Hodel wrote:

> Others have explained why the computed result is reasonable.
> 
> If you're interested in further details on numerical roundoff and the 
> associated problems, I recommend "Matrix Computations" by Golub and Van 
> Loan.  It's an excellent text and reference.  I strongly recommend it.
> 
> When testing for singularity on a computer, it's better to use the 
> singular value decomposition (developed by Prof Golub in the 50's) than 
> a determinant calculation.  The ratio of largest singular value over 
> the smallest singular value is called the two-norm condition of a 
> matrix, and is a good measure of how hard it is to accurately invert a 
> matrix on a computer.  Being *close* to singular is just as bad as 
> *being* singular, on a computer.
> 
> I hope this is useful to you.
> 
> On May 26, 2005, at 12:49 AM, Hui Zhang wrote:
> 
> > hi, i am not sure the following problem is already reported or not.
> > It happens both version 2.1.50 (sparc-sun-solaris2.8) and
> > version 2.1.57 (i686-pc-linux-gnu).
> >
> > octave:1> a=[1,2,3;4,5,6;7,8,9]
> > a =
> >
> >   1  2  3
> >   4  5  6
> >   7  8  9
> >
> > octave:2> det(a)
> > ans =  6.6613e-16
> >
> > THE ANS is WRONG.
> >
> >
> > Best regards,
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Hui Zhang     Ph.D. Candidate & Research Assistant
> > VLSI System Design Lab
> > Department of Electrical and Computer Engineering
> > State University of New York at Stony Brook
> > Stony Brook, NY 11794-2350
> > Tel: 631-632-1068  Email: address@hidden
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]