performance tuning – Determinant of 11×11 Matrix consumes immense amount of memory


I’m trying to take the determinant of an 11×11 matrix, constructed out of some functions I’ve defined

lagz(n_, m_, z_, zbar_) := 
 1/Sqrt(Pi*a^2*n!*m!)* E^(z*zbar/(2.*a^4)) * (a)^(m + n)*
  D( E^(-(z*zbar)/a^4), {z, n}, {zbar, m})
lagnlz(n_, l_, z_, zbar_) := 
 Sqrt(n!/(Pi*a^2*(n + l)!))* (z/a)^l LaguerreL(n, l, z*zbar/a^2)*
  E^(-z*zbar/(2.*a^2))

lag(n_, l_, r_, (Theta)_) := 
 lagnlz(n, l, z, zbar) /. {z -> r*E^(I*(Theta)), 
   zbar -> r*E^(-I*(Theta))}
lagcc(n_, l_, r_, (Theta)_) := 
 lagnlz(n, l, z, zbar) /. {z -> r*E^(-I*(Theta)), 
   zbar -> r*E^(I*(Theta))}

The main functions are lag and lagcc, functions of n, l, z, and zbar (n and l are integers that specificy the function and z and zbar are coordinates). I pick which of these enter the matrix with the following code:

MaxEn = 5;
MaxState = Binomial(MaxEn + 1, 2);
nlBasis = {{0, 0}};
part = 10;
For(En = 1, En < MaxEn, En++, 
 instances = 
  FindInstance(2 n + l == En && n + l >= 0 && n >= 0, {n, l}, 
   Integers, En + 1);
 For(iter = 1, iter <= En + 1, iter++,
  nlBasis = Join(nlBasis, {{n, l}} /. instances((iter)))
  )
 )
nlBasis // MatrixForm;
(CapitalOmega) = .0001;
stateEnergy = 
  Table(2*nlBasis((i, 1)) + 
    nlBasis((i, 2)) *(1 - (CapitalOmega)), {i, 1, MaxState});
stateEnergy // MatrixForm;
lowest = Ordering(stateEnergy, part); 

The variable in the above code named “part” determines the size of the matrix (for part = 10 corresponds to a 10×10 matrix). Also, each row is a function of a different set of coordinates z and zbar (meaning z1, zbar1, …). Actually to be more clear, I substitute z and zbar for x and theta. I then construct the matrix with the code:

Table( lag(nlBasis((lowest((j)), 1)), nlBasis((lowest((j)), 2)), 
  Subscript(x, i), Subscript((Theta), i)), {i, 1, part}, {j, 1, 
  part})

All of this runs very quickly. I use the Subscript(x,i) and Subscript(theta,i) as variables However, when I try to find the determinant of this matrix, it takes a relatively long time (on the order of a few minutes). For the 11×11 case, it takes much longer and often just Aborts mid computation. Is there any reason this determinant takes so long to compute, and is there any way to make it faster? Ultimately, I intend to find the maximum of this determinant in all 2*part variables. I was thinking perhaps it’s the symbolic aspect of this determinant that is taking so long and that if the numbers were already plugged in, it might find the determinant faster. However, I don’t know how to make the “FindMaximum” function plug in the coordinates into the matrix before it computes the determinant, unless it is doing this already and it’s still this slow. Regardless, I’m curious as to why this takes so long and if there is any way to speed this up.