det(x) is non zero
18 views (last 30 days)
Show older comments
>> A=[2 1
6 3]
A =
2 1
6 3
>> det(A)
ans =
-3.3307e-16
I want to make det(a)=0 det(a)=0
0 Comments
Answers (1)
John D'Errico
on 5 Dec 2016
It is time for you to learn what are floating point numbers. Also, why det is a dangerous thing to use in general.
det is computed using linear algebra, since the simple method that you learn for pencil and paper will grind to a halt for only slightly larger matrices. Therefore it is computed using floating point numbers,even though the elements are integers.
If you ABSOLUTELY need a zero result here, then you need to learn how to use symbolic tools. But they will also rapidly fail for larger matrices, as I said above. (Have fun trying to compute the symbolic determinant of a 10x10 matrix or larger.)
Anyway, needing det to return a result is a bad thing. NEVER test for a zero determinant to test if a matrix is singular. Det is just bad news. Yes, I know they taught you about determinants in that first class on linear algebra. Sadly, even some books get this wrong. The authors and MANY teachers simply never took a course on numerical analysis. They learned from someone else to use det. Unfortunately use of the determinant is a disease that will never go away, because there is always someone out there promoting it for you to use, because someone told them to use it.
And, yes, beginning books on linear algebra teach you about determinants. The problem is, they forget to then teach you why it is bad. So, instead of using det, learn to use other tools to discover if your matrix is singular.
Use rank or cond for this purpose. If you understand what a svd is, then svd can be even more informative, but only if you truly understand the svd.
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!