Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

funny problem about the precision of matrix transpose and inverse.

$
0
0
>> A=[
-3.40411799,-0.37565809,7.34175377,-1.17789516
-3.87102015,-0.13046468,8.34873435,-1.33945295
-3.87102015,0.13046468,8.34873435,-1.33945295
-3.40411799,0.37565809,7.34175377,-1.17789516
-2.52662896,0.57554158,5.44924934,-0.87426582
-1.34439119,0.70600626,2.89948501,-0.46518713
0.00000000,0.75131617,-0.00000000,0.00000000
1.34439119,0.70600626,-2.89948501,0.46518713
2.52662896,0.57554158,-5.44924934,0.87426582
3.40411799,0.37565809,-7.34175377,1.17789516
3.87102015,0.13046468,-8.34873435,1.33945295
3.87102015,-0.13046468,-8.34873435,1.33945295
3.40411799,-0.37565809,-7.34175377,1.17789516
2.52662896,-0.57554158,-5.44924934,0.87426582
1.34439119,-0.70600626,-2.89948501,0.46518713
-0.00000000,-0.75131617,0.00000000,-0.00000000
-1.34439119,-0.70600626,2.89948501,-0.46518713
-2.52662896,-0.57554158,5.44924934,-0.87426582
-3.40411799,-0.37565809,7.34175377,-1.17789516
];

>>inv(A'*A)

ans =

  1.0e+014 *

    0.2346 0.0000 -0.1170 -1.4075
    0.0000 0.0000 -0.0000 -0.0000
   -0.1170 -0.0000 -0.0141 0.2507
   -1.4075 -0.0000 0.2507 5.6301

>> T=A'; inv(T*A)

ans =

  1.0e+014 *

   -0.1759 0.0000 -0.0816 -0.0000
    0.0000 0.0000 -0.0000 -0.0000
   -0.0816 -0.0000 0.0346 0.4516
   -0.0000 -0.0000 0.4516 2.8149


Look, it's funny that the two results are different. How can that be?

Then, I tried

>> A'*A-T*A

ans =

  1.0e-013 *

         0 0 -0.5684 -0.0711
         0 0.0089 0 0
   -0.5684 0 0 -0.1421
   -0.0711 0 -0.1421 0

not equals to zero.

Viewing all articles
Browse latest Browse all 19628

Trending Articles