fft issues



dlakelan wrote:
> dlakelan wrote:
>> I am trying to use the maxima fft routines to do some numerical 
>> solutions of PDEs that I derived using maxima. I want to discretize the 
>> space, and then use the fft to calculate derivatives and second 
>> derivatives etc in space.
>>
>> There are some irregularities that I'm experiencing in the whole process.

Well, I tried all sorts of thinking about this, and I still can not 
figure out how to do a derivative using maxima's fft and get an 
consistently scaled answer. The shape looks fine, but the scale doesn't 
make any sense to me. Here's a very simple sample case. What should the 
scale factor be to give the right scale for the derivative with respect 
to the spatial variable x which is defined as k/n  (so that the samples 
are from 0 to 1-1/n and the function is periodic with period x = 1)

any help would be appreciated. as far as I can tell I can't make this 
make sense in maxima, nor in octave...

n:256;
data : float(makelist(cos(2*%pi*k/n),k,0,n-1));

array(rept,flonum,n);
array(impt,flonum,n);

fillarray(rept,data);
fillarray(impt,[0.0]);

fft(rept,impt);

coefs: makelist(-k,k,0,n-1); /* times some scale factor, what is it?*/

fillarray(impt,-listarray(impt)*coefs);
fillarray(rept,listarray(impt)*coefs);

ift(impt,rept); /* swap due to factor of %i in derivative*/

listarray(impt); /* should be derivative times some scale factor */