Re: Bug in symbolic inversion of matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg2637] Re: Bug in symbolic inversion of matrices
- From: withoff (David Withoff)
- Date: Thu, 30 Nov 1995 21:01:47 -0500
In article <49dp5g$8a6 at dragonfly.wri.com> chapman at bonnie.drea.dnd.ca (David M.F. Chapman) writes: > I have not been following this newsgroup, so I apologize if the following is > old hat: > > We have found a probable bug involving the symbolic inversion of matrices. > Up to size 6x6 works fine, but starting with 7x7, all the memory is gobbled > up and the abort calculation command does not work. Funny thing, it only > acts up when the result is printed, so it may have more to do with that > aspect than the inversion itself. I will send the annotated notebook > documenting this bug to anyone interested. (I have already sent a copy to > Wolfram Research.) > ************************************************************************** ***** > Dave Chapman DREA phone: (902) 426-3100 x228 > dave.chapman at drea.dnd.ca FAX: (902) 426-9654 > > I suspect that your computer is just running out of memory. Formatting an expression often requires a lot more memory than storing it in an internal form. Here is an example. In[1]:= m = Inverse[{{a11, a12, a13}, {a21, a22, a23}, {a31, a32, a33}}] ; In[2]:= ByteCount[m] Out[2]= 3748 In[3]:= ByteCount[PrintForm[m]] Out[3]= 46256 This is also true outside of Mathematica. A double-precision number, for example, is typically stored in 8 bytes of memory, but it requires 16 bytes to store the 16 decimal digits in the printed base-10 representation of the number. Formatting also eliminates the possibility of saving memory by sharing common subexpressions, since, although it is ok for the program internally to use pointers to common subexpressions, it is not ok to do that on a printed page. Depending on the details of your example, formatting the 7 x 7 matrix could require perhaps 10 times as much memory as formatting the 6 x 6 matrix, which would explain why formatting a 6 x 6 matrix works fine, but formatting a 7 x 7 matrix doesn't. Of course the fact that Mathematica and/or computers in general behave badly when they are about to run out of memory is itself arguably a bug, but that is a separate issue. Dave Withoff Wolfram Research