0
|
10138 Views
|
7 Replies
|
6 Total Likes
View groups...
Share
GROUPS:

# Problem for diagonalisation of a complex 6*6 matrix

Posted 10 years ago
 Hi, I have a question about a strange behavior I found in mathematica. If I try to get the eigenvalues of the following complex 6*6 matrix : a = 1; b = 100; c = 10^10; N[Eigenvalues[({{0, 0, 0, a, -I*a, b}, {0, 0, 0, a, -I*a, b}, {0, 0, 0, a, -I*a, b}, {a, a, a, c, 0, 0}, {-I*a, -I*a, -I*a, 0, c, 0}, {b, b, b, 0, 0, c}})]]  gives me this result : {1.*10^10, 1.*10^10, 1.*10^10, -3.*10^-6, 0., 0.}  but if I just add a dot to a variable, like a=1.; the result is completely wrong : {1.*10^10 + 2.95915*10^-53 I, 1.*10^10 - 4.03437*10^-38 I, 1.*10^10 - 3.68514*10^-14 I, -2.00004*10^-6 + 4.03437*10^-38 I, -1.*10^-6 + 1.73907*10^-53 I, -6.60625*10^-10 - 5.08267*10^-9 I}  This is a simple case, I found worse results for a more complicate 6*6 matrix, but is there at least a reason for the big discrepancy here ? Thanks, Jonathan
7 Replies
Sort By:
Posted 10 years ago
 Mathematica allows you to do arbitrary precision, but it's not always clear how that's implemented. So yes you can use higher precision numbers if that will help. It will likely affect the execution speed.
Posted 10 years ago
 This looks like standard case of floating point error. If we subtract the two results and use Chop we get: {0, 0, 0, -9.9996*10^-7, 1.*10^-6, 6.60625*10^-10 + 5.08267*10^-9 I} This is pretty close to a vector of 0s, so the results aren't far apart. I wouldn't say it's completely wrong. Do you believe that the floating point error is too high? If so are you mixing symbolic and numerical computations? Symbolic manipulations on floating point numbers aren't always the most numerical stable way to calculate something. You can always improve the accuracy/precision of the results by staying with symbolic evaluation or using higher precision numbers.
Posted 10 years ago
 It appears to be entirely numeric, whether exact or approximate. Given the difference in scales of the inputs, I would not expect a computation at machine precision to do well in such circumstances. The scale factor of 10 and the error of around 10^(-6) are consistent with working at 16 digits of precision (machine double, that is).
Posted 10 years ago
 Hi thanks, actually there is a direct way to define with precision the parameters with  as given in http://reference.wolfram.com/language/ref/Accuracy.html. If you also define a parameter called zero for 0 and the others like a = 150; b = 10050; c = 10^1050; zero = 050; you get the result I expected, and the execution speed is not so bad.
Posted 10 years ago
 If you can use exact rational numbers as input, Mathematica can do the calculation exactly (as you saw originally). So, use 11/10 instead of 1.1. If you must use decimal points, get the rational representation using Rationalize[].
Posted 10 years ago
 Ok thanks, actually I need a better precision especially for the very small eigenvalues, do you know if quadruple precision is supported by mathematica ?
Posted 9 years ago
 Hi Jonathan, in fact the matrix is rather simple, so you can solve it as a symbolic matrix: (mat = {{0, 0, 0, a, -I*a, b}, {0, 0, 0, a, -I*a, b}, {0, 0, 0, a, -I*a, b}, {a, a, a, c, 0, 0}, {-I*a, -I*a, -I*a, 0, c, 0}, {b, b, b, 0, 0, c}}) // MatrixForm {ev, evec} = Eigensystem[mat]; ev {0, 0, c, c, 1/2 (c - Sqrt[12 b^2 + c^2]), 1/2 (c + Sqrt[12 b^2 + c^2])} Replacing the symbols with exact numbers results in: s1 = ev /. { a -> 1, b -> 100, c -> 10^10} {0, 0, 10000000000, 10000000000, 1/2 (10000000000 - 200 Sqrt[2500000000000003]), 1/2 (10000000000 + 200 Sqrt[2500000000000003])} Replacing the symbols with numeric arguments gives: s2 = ev /. { a -> 1., b -> 100., c -> 1. 10^10} {0, 0, 1.*10^10, 1.*10^10, -2.86102*10^-6, 1.*10^10}