Re: Strange Det function behavior.

*To*: mathgroup at smc.vnet.net*Subject*: [mg65466] Re: [mg65445] Strange Det function behavior.*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Mon, 3 Apr 2006 06:59:31 -0400 (EDT)*References*: <200604020900.FAA01592@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 2 Apr 2006, at 11:00, Alexander wrote: > Dear MathGroup! > > Suppose we have defined the following function: > > f[x_Integer] := Det[ Table[ Random[]*t + i/j, {i, x}, {j, x} ] ]; > > Now try to make a table for different values of argument (matrix > dimension): > > Table[f[i], {i, 12}] // TableForm > > It takes a considerable time on my Celeron 1700 with Mathematica 5.2 > under WinXP to make such a table. > > Once we made this table we see very strange bihavior, all results > before x=12 dimension are polynoms, > but starting from x=12 result become very big and very > strange, and in fact it's not even a polynom. > > I spend several hours try to understand why system acts so strange, > and > finally came to idea that the answer is in numbers representation and > inner > system algorithms used to evaluate Det function. > > It would be very interesting to see explanations of this result. > > Thanks for your answers! > > Alexander. > This is because you are essentially trying to do algebra using numerical precision numbers and in general this will not work because of round off errors (or at least it will not work without a good deal of extra care). All you need to do to get the right answer is: f[x_Integer] := Det[Table[Rationalize[Random[], 0]*t + i/j, {i, x}, {j, x}]]; and then evaluate N[Table[Expand[f[i]], {i, 12}]] // TableForm You can also use N[Table[Expand[f[i]], {i, 12}],6] // TableForm if you want 6 digits of precision in your answers or simply Table[Expand[f[i]], {i, 12}] // TableForm if you prefer exact answers. Andrzej Kozlowski

**References**:**Strange Det function behavior.***From:*"Alexander" <beginning.physst@mail.ru>