Skip to main content
1 of 6
L.K.
  • 693
  • 1
  • 7
  • 17

Speeding and optimizing the Graphics Plot

I am having a Hermitian Matrix(HCK[k]) depending on a parameter $k$.

My job is to plot the Eigenvalues of the matrix as the parameter $k$ is changed.

But I am facing some problems.
(i) My Mathematica file size, which is of around whopping 90Mb, when HCK[k] is around $284\times284$.
(ii) This part of code is very slow as the size of HCK[k] is increasing.

kdel = 0.00001; (* offset *)
kIn = -\[Pi] - kdel;  (*Initial value of k *)
kFin = \[Pi] + kdel;  (*Final value of k *)
kInc = 0.001; (*Increment of k*)

eigeng = 
 ParallelTable[Eigenvalues[HCF[k]], {k, kIn, kFin, kInc}];


kList = ParallelTable[k, {k, kIn, kFin, kInc}];


kFList = ParallelTable[kList, {i, Transpose@eigeng}];

dataToPlot = Flatten[{kFList\[Transpose], eigeng}\[Transpose], {{1, 3}, {2}}];

Graphics[{Point[{#1, #2}]} & @@@ dataToPlot, Frame -> True,
...(* for the aesthetic of plot, i.e. axis title, range and bla bla*)]

(i) Is there a way the size issue can be overcome?
(ii) Is there a way the code can be sped up a little bit?(I checked my rest of the code, it is very fast, which I did by breaking and evaluating it into small cells).

L.K.
  • 693
  • 1
  • 7
  • 17