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

  • 1
    Can you give us an example of such a function? Without it it's hard to know what specifically will help your case. – b3m2a1 Mar 11 at 10:08
  • yes. A typical example takes a form like Sum[Sum[Exp[I * Subscript[a, ij]*t], {i, 1, 65000}], {j, 1, 200}] – Dario Rosa Mar 11 at 10:19
  • 1
    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. – J. M. is computer-less Mar 11 at 10:31
  • You are right. Let me simplify the thing: I can create a small piece of code that realizes an example and post it – Dario Rosa Mar 11 at 10:35
  • 1
    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... – Henrik Schumacher Mar 11 at 12:37

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.