Fourier Analysis in Java?
I am a physicist working on Fourier series and transforms, and I am too lazy to do it by hand. So I decided that I would program a "Fourier" class to transform a function.
The problem is that it is very difficult to do with object oriented programming (though I suppose one could make a function an object and tranform it). The algorithms I have seen for fourier analysis are all done in C or Perl or some other procedural programming language.
Is it possible to create a fourier class that simply transforms a given function?
[545 byte] By [
compadrea] at [2007-10-2 18:17:19]

> I am a physicist working on Fourier series and
> transforms, and I am too lazy to do it by hand. So I
> decided that I would program a "Fourier" class to
> transform a function.
>
> The problem is that it is very difficult to do with
> object oriented programming (though I suppose one
> could make a function an object and tranform it). The
> algorithms I have seen for fourier analysis are all
> done in C or Perl or some other procedural
> programming language.
>
> Is it possible to create a fourier class that simply
> transforms a given function?
You don't mention DFT or FFT so do I take it that you want to provide a function as an equation and get an equation form for the Fourier transform? If so then I have never even seen this in C or C++.
If you just want FFT implementations then there are plenty of open source FFT implementations out there. Some, the inefficient ones, use a Comples class an other just use arrays to hold the data.
My favourite open source implementation is half way down the page of http://sepwww.stanford.edu/oldsep/hale/FftLab.html. For simplicity of use it takes some beating. The limitiations are that it is only for radix 2 and is one dimentional. Google will find you 3 dimentional Java FFT implementtions.
In terms of speed, my Java FFT implementation is about the same speed as my C++ implemention and just slightly slower than my 'C' and FORTRAN implementations though the difference may be a function of how I measure the time taken and not due to the implementation language.