Menu

#596 matrixpower malfunction: result contains complex numbers

No version
open
nobody
None
5
2013-10-24
2013-10-24
hiasl
No

Hi all!

This concerns Version 4.2 as available on sourceforge on 2013-OCT-24.

Unfortunately I couldn't find out, at which point this behavior starts, but here's the calculation where I get an error:

x=[1 6 3 7; 1/6 1 1/2 1; 1/3 2 1 1/2; 1/7 1 2 1]
x^1

And this is the result I get: (The result shouldn't contain complex numbers)

ans =
1.0000e+000 +4.6381e-018i 6.0000e+000 +2.0446e-017i 3.0000e+000 -6.7292e-017i 7.0000e+000 +3.3525e-017i
1.6667e-001 +3.7483e-018i 1.0000e+000 +1.8849e-017i 5.0000e-001 -2.8804e-017i 1.0000e+000 +-0.0000e+000i
3.3333e-001 +4.0324e-018i 2.0000e+000 +1.7858e-017i 1.0000e+000 -5.7608e-017i 5.0000e-001 +2.8197e-017i
1.4286e-001 -1.1363e-018i 1.0000e+000 +3.9664e-018i 2.0000e+000 +1.1522e-016i 1.0000e+000 -1.1279e-016i

I'm using different values for the exponent, all values are non negative integers. I used 1 as exponent here to show an obvious example of a wrong result.

I tried different 4x4 matrices which worked perfectly fine. The matrix I use is equivalent to this pattern (maybe this helps in some way...):

(The spaces disappear in HTML, therefore the hyphens...)

┌---------------------┐
| 1------a----b----c |
| 1/a---1----d----e |
| 1/b---1/d--1----f |
| 1/c---1/e--1/f--1 |
└---------------------┘

I also tried a 2x2 matrix using the pattern. -Also worked without a problem...

I'm runnning FreeMat on:
OS: Windows 8.1 Pro (x64) Build: 9600.16404.amd64fre.winblue_gdr.130913-2141
CPU: Intel Core i5 M450

Hope this helps,
Cheers, Mathias

Discussion


Log in to post a comment.