Hi,

I have a 4-D function that I have found an analytic expression for in Maple, but I want to generate a numerical 4-D array, which I can export for use in Matlab. However, I don't think I'm using a very good solution, because it is extremely slow (several minutes for even 10x10x10x10 elements). My code is

NumRange:=10:

NumElements:=10:

dx:=2*NumRange/(NumElements-1):

A:=Array(1..NumElements,1..NumElements,1..NumElements,1..NumElements,[seq([seq([seq([seq(evalf(rho(ws1,ws2,ws1p,ws2p)),ws2p=-NumRange..NumRange,dx)],ws1p=-NumRange..NumRange,dx)],ws2=-NumRange..NumRange,dx)] , ws1=-NumRange..NumRange,dx)],datatype=float);

Rho is an exponential with 10 terms in the exponents.

I also tried using four for-loops but that was even slower!

Thanks for any input