MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Strange Det function behavior.

  • To: mathgroup at
  • Subject: [mg65477] Re: Strange Det function behavior.
  • From: Paul Abbott <paul at>
  • Date: Mon, 3 Apr 2006 06:59:55 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <e0o513$1to$>
  • Sender: owner-wri-mathgroup at

In article <e0o513$1to$1 at>,
 "Alexander" <beginning.physst at> wrote:

> 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.

It is not suprising that this is is time-consuming. Effectively you are 
computing the _symbolic_ determinant of n x n matrices involving t.


 mat[n_] := Table[a[i,j], {i, n}, {j, n}]
 rat[n_] := Table[i/j, {i, n}, {j, n}]
 sign[n_] := Table[(-1)^(i + j), {i, n}, {j, n}]

then, effectively, the determinant you are computing can be expressed as

 Det[ mat[n] t + rat[n] ] == Det[ mat[n] ] t^n + Total[
  Map[Reverse, Minors[ mat[n] ], {0, 1}] * rat[n] * sign[n], 2] t^(n-1)

as you can easily confirm for small n. Note that 

  Map[Reverse, Minors[mat], {0,1}] 

makes the (i,j)-th element of Minors[mat] correspond to deleting the 
i-th row and j-th column of mat (from the online help for Minors). 

The important point about the right-hand side of this expression is that 
no symbolic matrix computations are required. Hence your original 
function can be written as 

 f[n_Integer] := 
  Module[ { m = Table[Random[], {i, n}, {j, n}]}, Det[m] t^n + 
   Total[Map[Reverse, Minors[m], {0, 1}] * rat[n] * sign[n], 2] t^(n-1)]

Now the time to compute f[n] is quite reasonable.

> 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.

Are you sure? I think that the determinant has not been expanded out.

> 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 might have been better spending this time on obtaining a better 
representation for the original function!


Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    

  • Prev by Date: Re: Typing special symbols in text mode?
  • Next by Date: Re: simplify a trig expression
  • Previous by thread: Re: Strange Det function behavior.
  • Next by thread: Re: Convex Hull 3D