I'm running into a bit of a problem finding an efficient way of forming the expansion coefficient for an eigenfunction expansion. The way I currently have it coded works, and it doesn't take terribly long (about 30 seconds or so). However, I have to run a lot of different evaluations, so all that time begins to add up. In addition, the memory usage balloons until I am pretty much frozen and unable to complete the calculations.
So, here's the block of code that's causing me problems:
for p to P do
for q to Q do
for r to R do
The parameters lam, beta, and g are eigenvalues and NX, NY, and NZ are normalization constants, all previously calculated. With this expansion coefficient, I then add over p, q, and r to get the solution to the PDE I originally set out to solve. I use about 100 terms for lam and NX, and about 20 terms for beta, g, NY, and NZ, so I do expect calculations to take some time. Also, c is dependent on an unspecified variable t, so I suppose that forces the coefficient to be symbolic.
Is there a more efficient way to create the coefficient c? Maple Help suggests using seq instead of for loops, but I can't seem to figure out how to apply that here, at least not in a method that seems as straightforward to me as what I currently have.
I appreciate your help, and please let me know if I need to clarify something.