1
$\begingroup$

I have to plot some functions of one variable. The problem is that these functions are given by very huge summations of some sine and cosine functions and, as a result, I easily exceed the memory. I was wondering if you have some suggestions in order to reduce the memory used by this kind of plotting.

Here is an example of code

m = RandomVariate[GaussianOrthogonalMatrixDistribution[1/60, 65000]];
dataRMT = Eigenvalues[m // N];

SFFRMT[t_] = Total[Exp[-(I t) dataRMT]] Total[Exp[(I t) dataRMT]];

M = 300;
Table[(m = 
RandomVariate[GaussianOrthogonalMatrixDistribution[1/60, 65000]];
   dataRMT = Eigenvalues[m // N];
   SFFRMT[t_] = 
SFFRMT[t] + 
 Total[Exp[-(I t) dataRMT]] Total[Exp[(I t) dataRMT]];), {i, 1, 
   M}];

LogLogPlot[Evaluate[SFFRMT[T]], {T, 0.1, 10^8}]

Thank you.

Cheers

$\endgroup$
  • 1
    $\begingroup$ Can you give us an example of such a function? Without it it's hard to know what specifically will help your case. $\endgroup$ – b3m2a1 Mar 11 '18 at 10:08
  • $\begingroup$ yes. A typical example takes a form like Sum[Sum[Exp[I * Subscript[a, ij]*t], {i, 1, 65000}], {j, 1, 200}] $\endgroup$ – Dario Rosa Mar 11 '18 at 10:19
  • 1
    $\begingroup$ That's not a function other people can plot. If you don't give an example of something other people can easily feed into Plot[], then you won't be able to get much help. $\endgroup$ – J. M. is away Mar 11 '18 at 10:31
  • $\begingroup$ You are right. Let me simplify the thing: I can create a small piece of code that realizes an example and post it $\endgroup$ – Dario Rosa Mar 11 '18 at 10:35
  • 1
    $\begingroup$ Note that you perform also quite a lot symbolic computations by adding more and more symbolic expressions to SFFRMT[t]. That's also not very efficient. Sorry, apart from that, I have no helpful comments. I use to ask people if they really need all the eigenvalues when I see them having performance problems... $\endgroup$ – Henrik Schumacher Mar 11 '18 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.