Hello all,
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
c[p,q,r]:=sin(lam[p]*xi)*sin(A*beta[q]*eta)*(1+g[r]*sin(B*g[r]*zeta)/Bi-cos(B*g[r]*zeta))*((Bi*(lam[p]^2+beta[q]^2+g[r]^2)+lam[p]^2*v*L/alpha)*sin(lam[p]*xinot)+(lam[p]*(lam[p]^2+beta[q]^2+g[r]^2)-Bi*lam[p]*v*L/alpha)*cos(lam[p]*xinot))/(lam[p]*xi*A*beta[q]*eta*B*g[r]*zeta*Bi*NX[p]*NY[q]*NZ[r]*((lam[p]^2+beta[q]^2+g[r]^2)^2+lam[p]^2*v^2*L^2/alpha^2))
end
end
end:
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.