Message Boards Message Boards

GROUPS:

[solved] Kernel crashes during calculation of determinant of a matrix

Posted 23 days ago
226 Views
|
3 Replies
|
3 Total Likes
|

Dear all,

after a long bug search in my code, I have figured out that the following matrix leads to a kernel crash without error message during calculation of the determinant:

Also related functions like Inverse[] and LinearSolve[] crashes. What's going on here, how can I prevent it?

m = {{1000.05`, 0.`, 0.`, 0.`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, 0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 1.`}, {0.`, 
    1000.05`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`, 0.`, 0.`,
     0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`}, {0.`, -1000.`, 
    2000.05`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`, 0.`, 0.`,
     0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`}, {0.`, 0.`, -1000.`, 
    2000.05`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`, 0.`, 0.`,
     0.`, 0.`, 0.`, 0.`, 0.`, 0.`}, {-1000.`, 0.`, 0.`, -1000.`, 
    2000.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`, 0.`, 0.`, 
    0.`, 0.`, 0.`, 0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, 
    2000.05`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`,
     0.`, 0.`, 0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, -1000.`, 
    2000.05`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`,
     0.`, 0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -1000.`, 
    2000.05`, -1000.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`,
     0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -1000.`, 1000.05`,
     0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.05`, 
    0.`}, {0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.060000000000000005`, -0.01`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, 0.`}, {0.`, 0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.01`, 0.07`, -0.01`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`}, {0.`, 0.`, 0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.01`, 0.07`, -0.01`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`}, {0.`, 0.`, 0.`, 0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.01`, 0.07`, -0.01`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`}, {-0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.01`, 0.07`, -0.01`, 0.`, 0.`, 0.`, 0.`, 0.`}, {0.`, 0.`, 
    0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.01`, 
    0.07`, -0.01`, 0.`, 0.`, 0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 
    0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.01`, 
    0.07`, -0.01`, 0.`, 0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.01`, 
    0.07`, -0.01`, 0.`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.01`, 
    0.07`, -0.01`, 0.`}, {0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, -0.05`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, -0.01`, 
    0.060000000000000005`, 0.`}, {1.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 
    0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`}};
Det[m]

I'm using Mathematica 10.0.2 (x64) on Windows 10

3 Replies
Posted 23 days ago

Hi Martin,

Looks like the problem was fixed in a later version.

$Version
(* 12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020) *)

Det[m]
(* -1.70567*10^12 *)
In[11]:= m2 = Rationalize[m];
Det[m2]

Out[12]= -(873303244870245693606726965155785607800007/\
512000000000000000000000000000)

Thank you both. Good to know that it was solved later, but also good, that I can solve the problem even with Rationalize[] and then N afterwards.

Det[Rationalize[m]] // N

-1.70567*10^12

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract