1
$\begingroup$

I have a following matrix.

m = {{-0.576 Cos[y], 0, 0, 0. + 0.06 I, 0, 0.369858, 0, 0, 0,    0, -0.0906385, 0, 0, -0.265868, 0.0366083, 0.0157771, -0.185737,    0.0349767, 0.0435434, -0.276945, (0.288 - 0.498831 I) Sin[y],    0. - 0.03 I, 0.03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0}, {0, -0.576 Cos[y], 0. - 0.03 I, 0, 0, 0, -0.170921, 0, 0, 0, 0,    0.234664, 0.234164, 0, 0, -0.185737, 0.205344, -0.239136, -0.249447,    0.143353, 0. + 0.03 I, (0.288 - 0.498831 I) Sin[y], 0, -0.03,    0.0519615, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0,    0. + 0.03 I, -0.576 Cos[y], 0, 0, 0, 0, 0.369858, 0, 0, 0,    0.234164, -0.0357261, 0, 0, 0.0349767, -0.239136, -0.0707859,    0.185737, 0.248295, -0.03, 0, (0.288 - 0.498831 I) Sin[y],    0. - 0.03 I, 0. - 0.0519615 I, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0}, {0. - 0.06 I, 0, 0, -0.576 Cos[y], 0, 0, 0,    0, -0.244138, -0.0422717, -0.265868, 0, 0, 0.216359, 0.0211358,    0.0435434, -0.249447, 0.185737, 0.0660567, 0.159894, 0, 0.03,    0. + 0.03 I, (0.288 - 0.498831 I) Sin[y], 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, -0.576 Cos[y], 0, 0,    0, -0.0422717, -0.195326, 0.0366083, 0, 0,    0.0211358, -0.195326, -0.276945, 0.143353, 0.248295, 0.159894,    0.293945, 0, -0.0519615, 0. + 0.0519615 I,    0, (0.288 - 0.498831 I) Sin[y], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0}, {0.369858, 0, 0, 0, 0, -0.576 Cos[y], 0, 0, 0. + 0.06 I,    0, -0.0906385, 0, 0, 0.265868, -0.0366083, 0.0157771, 0.185737,    0.0349767, -0.0435434, 0.276945, 0, 0, 0, 0,    0, (0.288 + 0.498831 I) Sin[y], 0. - 0.03 I, 0.03, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0}, {0, -0.170921, 0, 0, 0, 0, -0.576 Cos[y],    0. - 0.03 I, 0, 0, 0, 0.234664, -0.234164, 0, 0, 0.185737, 0.205344,    0.239136, -0.249447, 0.143353, 0, 0, 0, 0, 0,    0. + 0.03 I, (0.288 + 0.498831 I) Sin[y], 0, -0.03, 0.0519615, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0.369858, 0, 0, 0,    0. + 0.03 I, -0.576 Cos[y], 0, 0, 0, -0.234164, -0.0357261, 0, 0,    0.0349767, 0.239136, -0.0707859, -0.185737, -0.248295, 0, 0, 0, 0,    0, -0.03, 0, (0.288 + 0.498831 I) Sin[y], 0. - 0.03 I,    0. - 0.0519615 I, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0,    0, -0.244138, -0.0422717, 0. - 0.06 I, 0, 0, -0.576 Cos[y], 0,    0.265868, 0, 0, 0.216359,    0.0211358, -0.0435434, -0.249447, -0.185737, 0.0660567, 0.159894, 0,    0, 0, 0, 0, 0, 0.03, 0. + 0.03 I, (0.288 + 0.498831 I) Sin[y], 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, -0.0422717, -0.195326, 0,    0, 0, 0, -0.576 Cos[y], -0.0366083, 0, 0, 0.0211358, -0.195326,    0.276945, 0.143353, -0.248295, 0.159894, 0.293945, 0, 0, 0, 0, 0,    0, -0.0519615, 0. + 0.0519615 I, 0, (0.288 + 0.498831 I) Sin[y], 0,    0, 0, 0, 0, 0, 0, 0, 0, 0}, {-0.0906385, 0, 0, -0.265868,    0.0366083, -0.0906385, 0, 0, 0.265868, -0.0366083, -0.576 Cos[y], 0,    0, 0. + 0.06 I, 0, 0.0911964, 0, 0.356683, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, -0.576 Sin[y], 0. - 0.03 I, 0.03, 0, 0, 0, 0, 0, 0,    0}, {0, 0.234664, 0.234164, 0, 0, 0, 0.234664, -0.234164, 0, 0,    0, -0.576 Cos[y], 0. - 0.03 I, 0, 0, 0, -0.208851, 0,    0.0722586, -0.286706, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0. + 0.03 I, -0.576 Sin[y], 0, -0.03, 0.0519615, 0, 0, 0, 0, 0}, {0,    0.234164, -0.0357261, 0, 0, 0, -0.234164, -0.0357261, 0, 0, 0,    0. + 0.03 I, -0.576 Cos[y], 0, 0, 0.356683, 0, 0.343409, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, -0.03, 0, -0.576 Sin[y], 0. - 0.03 I,    0. - 0.0519615 I, 0, 0, 0, 0, 0}, {-0.265868, 0, 0, 0.216359,    0.0211358, 0.265868, 0, 0, 0.216359, 0.0211358, 0. - 0.06 I, 0,    0, -0.576 Cos[y], 0, 0, 0.0722586, 0, -0.00936269, -0.319789, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03, 0. + 0.03 I, -0.576 Sin[y], 0, 0,    0, 0, 0, 0}, {0.0366083, 0, 0, 0.0211358, -0.195326, -0.0366083, 0,    0, 0.0211358, -0.195326, 0, 0, 0, 0, -0.576 Cos[y], 0, -0.286706,    0, -0.319789, 0.293945, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.0519615,    0. + 0.0519615 I, 0, -0.576 Sin[y], 0, 0, 0, 0,    0}, {0.0157771, -0.185737, 0.0349767, 0.0435434, -0.276945,    0.0157771, 0.185737, 0.0349767, -0.0435434, 0.276945, 0.0911964, 0,    0.356683, 0, 0, 1.02645, 0, 0, 0. + 0.53 I, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0. - 0.265 I, 0.265, 0, 0}, {-0.185737,    0.205344, -0.239136, -0.249447, 0.143353, 0.185737, 0.205344,    0.239136, -0.249447, 0.143353, 0, -0.208851, 0,    0.0722586, -0.286706, 0, 1.02645, 0. - 0.265 I, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0. + 0.265 I, 0, 0, -0.265,    0.458993}, {0.0349767, -0.239136, -0.0707859, 0.185737, 0.248295,    0.0349767, 0.239136, -0.0707859, -0.185737, -0.248295, 0.356683, 0,    0.343409, 0, 0, 0, 0. + 0.265 I, 1.02645, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, -0.265, 0, 0, 0. - 0.265 I,    0. - 0.458993 I}, {0.0435434, -0.249447, 0.185737, 0.0660567,    0.159894, -0.0435434, -0.249447, -0.185737, 0.0660567, 0.159894, 0,    0.0722586, 0, -0.00936269, -0.319789, 0. - 0.53 I, 0, 0, 1.02645, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.265,    0. + 0.265 I, 0, 0}, {-0.276945, 0.143353, 0.248295, 0.159894,    0.293945, 0.276945, 0.143353, -0.248295, 0.159894, 0.293945,    0, -0.286706, 0, -0.319789, 0.293945, 0, 0, 0, 0, 1.02645, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.458993, 0. + 0.458993 I,    0, 0}, {(0.288 + 0.498831 I) Sin[y], 0. - 0.03 I, -0.03, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.576 Cos[y], 0, 0,    0. - 0.06 I, 0, 0.369858, 0, 0, 0, 0, -0.0906385, 0, 0, -0.265868,    0.0366083, 0.0157771, -0.185737, 0.0349767,    0.0435434, -0.276945}, {0. + 0.03 I, (0.288 + 0.498831 I) Sin[y], 0,    0.03, -0.0519615, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0.576 Cos[y], 0. + 0.03 I, 0, 0, 0, -0.170921, 0, 0, 0, 0, 0.234664,    0.234164, 0, 0, -0.185737, 0.205344, -0.239136, -0.249447,    0.143353}, {0.03, 0, (0.288 + 0.498831 I) Sin[y], 0. - 0.03 I,    0. - 0.0519615 I, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0. - 0.03 I, 0.576 Cos[y], 0, 0, 0, 0, 0.369858, 0, 0, 0,    0.234164, -0.0357261, 0, 0, 0.0349767, -0.239136, -0.0707859,    0.185737, 0.248295}, {0, -0.03,    0. + 0.03 I, (0.288 + 0.498831 I) Sin[y], 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0. + 0.06 I, 0, 0, 0.576 Cos[y], 0, 0, 0,    0, -0.244138, -0.0422717, -0.265868, 0, 0, 0.216359, 0.0211358,    0.0435434, -0.249447, 0.185737, 0.0660567, 0.159894}, {0, 0.0519615,    0. + 0.0519615 I, 0, (0.288 + 0.498831 I) Sin[y], 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.576 Cos[y], 0, 0,    0, -0.0422717, -0.195326, 0.0366083, 0, 0,    0.0211358, -0.195326, -0.276945, 0.143353, 0.248295, 0.159894,    0.293945}, {0, 0, 0, 0, 0, (0.288 - 0.498831 I) Sin[y],    0. - 0.03 I, -0.03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.369858, 0,    0, 0, 0, 0.576 Cos[y], 0, 0, 0. - 0.06 I, 0, -0.0906385, 0, 0,    0.265868, -0.0366083, 0.0157771, 0.185737, 0.0349767, -0.0435434,    0.276945}, {0, 0, 0, 0, 0, 0. + 0.03 I, (0.288 - 0.498831 I) Sin[y],    0, 0.03, -0.0519615, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.170921, 0,    0, 0, 0, 0.576 Cos[y], 0. + 0.03 I, 0, 0, 0, 0.234664, -0.234164,    0, 0, 0.185737, 0.205344, 0.239136, -0.249447, 0.143353}, {0, 0, 0,    0, 0, 0.03, 0, (0.288 - 0.498831 I) Sin[y], 0. - 0.03 I,    0. - 0.0519615 I, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.369858, 0,    0, 0, 0. - 0.03 I, 0.576 Cos[y], 0, 0, 0, -0.234164, -0.0357261, 0,    0, 0.0349767, 0.239136, -0.0707859, -0.185737, -0.248295}, {0, 0, 0,    0, 0, 0, -0.03, 0. + 0.03 I, (0.288 - 0.498831 I) Sin[y], 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.244138, -0.0422717, 0. + 0.06 I,    0, 0, 0.576 Cos[y], 0, 0.265868, 0, 0, 0.216359,    0.0211358, -0.0435434, -0.249447, -0.185737, 0.0660567,    0.159894}, {0, 0, 0, 0, 0, 0, 0.0519615, 0. + 0.0519615 I,    0, (0.288 - 0.498831 I) Sin[y], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, -0.0422717, -0.195326, 0, 0, 0, 0, 0.576 Cos[y], -0.0366083, 0,    0, 0.0211358, -0.195326, 0.276945, 0.143353, -0.248295, 0.159894,    0.293945}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.576 Sin[y],    0. - 0.03 I, -0.03, 0, 0, 0, 0, 0, 0, 0, -0.0906385, 0,    0, -0.265868, 0.0366083, -0.0906385, 0, 0, 0.265868, -0.0366083,    0.576 Cos[y], 0, 0, 0. - 0.06 I, 0, 0.0911964, 0, 0.356683, 0,    0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0. + 0.03 I, -0.576 Sin[y], 0,    0.03, -0.0519615, 0, 0, 0, 0, 0, 0, 0.234664, 0.234164, 0, 0, 0,    0.234664, -0.234164, 0, 0, 0, 0.576 Cos[y], 0. + 0.03 I, 0, 0,    0, -0.208851, 0, 0.0722586, -0.286706}, {0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0.03, 0, -0.576 Sin[y], 0. - 0.03 I, 0. - 0.0519615 I, 0, 0, 0,    0, 0, 0, 0.234164, -0.0357261, 0, 0, 0, -0.234164, -0.0357261, 0, 0,    0, 0. - 0.03 I, 0.576 Cos[y], 0, 0, 0.356683, 0, 0.343409, 0,    0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.03,    0. + 0.03 I, -0.576 Sin[y], 0, 0, 0, 0, 0, 0, -0.265868, 0, 0,    0.216359, 0.0211358, 0.265868, 0, 0, 0.216359, 0.0211358,    0. + 0.06 I, 0, 0, 0.576 Cos[y], 0, 0, 0.0722586,    0, -0.00936269, -0.319789}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0.0519615, 0. + 0.0519615 I, 0, -0.576 Sin[y], 0, 0, 0, 0, 0,    0.0366083, 0, 0, 0.0211358, -0.195326, -0.0366083, 0, 0,    0.0211358, -0.195326, 0, 0, 0, 0, 0.576 Cos[y], 0, -0.286706,    0, -0.319789, 0.293945}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0. - 0.265 I, -0.265, 0, 0, 0.0157771, -0.185737, 0.0349767,    0.0435434, -0.276945, 0.0157771, 0.185737, 0.0349767, -0.0435434,    0.276945, 0.0911964, 0, 0.356683, 0, 0, 1.02645, 0, 0, 0. - 0.53 I,    0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0. + 0.265 I, 0,    0, 0.265, -0.458993, -0.185737, 0.205344, -0.239136, -0.249447,    0.143353, 0.185737, 0.205344, 0.239136, -0.249447, 0.143353,    0, -0.208851, 0, 0.0722586, -0.286706, 0, 1.02645, 0. + 0.265 I, 0,    0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.265, 0, 0,    0. - 0.265 I, 0. - 0.458993 I, 0.0349767, -0.239136, -0.0707859,    0.185737, 0.248295, 0.0349767,    0.239136, -0.0707859, -0.185737, -0.248295, 0.356683, 0, 0.343409,    0, 0, 0, 0. - 0.265 I, 1.02645, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, -0.265, 0. + 0.265 I, 0, 0,    0.0435434, -0.249447, 0.185737, 0.0660567,    0.159894, -0.0435434, -0.249447, -0.185737, 0.0660567, 0.159894, 0,    0.0722586, 0, -0.00936269, -0.319789, 0. + 0.53 I, 0, 0, 1.02645,    0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.458993,    0. + 0.458993 I, 0, 0, -0.276945, 0.143353, 0.248295, 0.159894,    0.293945, 0.276945, 0.143353, -0.248295, 0.159894, 0.293945,    0, -0.286706, 0, -0.319789, 0.293945, 0, 0, 0, 0, 1.02645}};

As you can see it is a mixture of symbolic terms in y and floating point numbers.

If I try to compute the characteristic polynomial it fails (it returns 0.)

CharacteristicPolynomial[m, x]
(*0.*)

I believe this to be somehow related to some precision issue, but am unsure how to solve it. Or is it something else?


EDIT 1

If I add the following

m = SetPrecision[m, 20];

It actually runs. But I wonder, if I instead replace y with e.g. 0.01 I do not require this extra step. So what is going on in the background? Is everything converted to machine precision automatically if only floating point numbers appear in an expression?

$\endgroup$
8
  • $\begingroup$ For comparison, what is the result of Collect[Det[m - x IdentityMatrix[Length[m]]], x]? $\endgroup$ Commented May 21, 2015 at 8:08
  • $\begingroup$ @J.M. It is also 0. $\endgroup$
    – NOhs
    Commented May 21, 2015 at 8:12
  • $\begingroup$ One last check: could you tell me the result of Eigenvalues[m]? $\endgroup$ Commented May 21, 2015 at 8:17
  • $\begingroup$ @J.M. Unable to find all roots of the characteristic polynomial. It is actually working if I use reference.wolfram.com/language/ref/SetPrecision.html to artificially increase the precision of my numbers. But if I replace y by some value (e.g. 0.01) I do not have to do this. Why? $\endgroup$
    – NOhs
    Commented May 21, 2015 at 8:20
  • 2
    $\begingroup$ The presence of machine numbers is infectious. So if there is a possibility for catastrophic cancellation, say, then that could indeed be the cause of an unexpected result of 0.0. $\endgroup$ Commented May 21, 2015 at 15:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.