fourier transform time

*To*: mathgroup at smc.vnet.net*Subject*: [mg36425] fourier transform time*From*: "Steve Story" <sbstory at unity.ncsu.edu>*Date*: Fri, 6 Sep 2002 03:16:57 -0400 (EDT)*Organization*: NC State University*Sender*: owner-wri-mathgroup at wolfram.com

For my PDE class we have been calculating Fourier transforms. The instructor arrived today with a printout of two plots of a certain Fourier transform, done with a different CAS. The first plot was to 30 terms, the second was to 120 terms. Curious, I translated the functions into Mathematica (4.0 on Windows2000 on a PIII 700) to see how much time this required to process. I was Staggered at how much time it took. Here's the code: L = 2; f[x_] := UnitStep[x - 1]; b[n_] := (2/L)*Integrate[f[x]*Sin[n*Pi*x/L], {x, 0, L}]; FS[N_, x_] := Sum[b[n]*Sin[n*Pi*x/L], {n, 1, N}]; Timing[Plot[FS[30, x], {x, 0, 2}]] Out[23]= {419.713 Second, \[SkeletonIndicator]Graphics\[SkeletonIndicator]} In this case the number of terms is 30. The time required per number of terms seems to fit the following polynomial: y = 0.3926x^2 + 2.2379x This is a large amount of time. I understand that the code is not optimized, and was more or less copied from the code in the other CAS, but is this a reasonable amount of time, or is something going wrong? I don't use Mathematica because of the speed, but should it be this slow? Just curious, Steve Story