Science SPORE Prize
November 2011
The Open Source Physics Project is supported by NSF DUE0442581.

Fourier Tool
post and replies
Return to the Fourier Tool thread
Login to post to this thread
Is the Fourier Tool functioning?
 Sep 8, 2012 at 5:16AM

Ivo Gienal
9 Posts

When I open the Fourier Tool with the predefined method _tools.showFourierTools(.....) I get a Window, that looks the same as a Data Tool Window and I can not see, how I can apply a Fourier transformation. This would be nice, when simulating an anharmonic oscillator (F ~ x^3) and then apply a Fourier transformation to the data.
Attached File: Cubic_Oscillating.zip

Re: Is the Fourier Tool functioning?  Sep 08 2012 9:38AM

Wolfgang
110 Posts

The Fourier Tool is currently not functioning.

Re: Re: Is the Fourier Tool functioning?  Sep 11 2012 1:40AM

Carlos Trallero
4 Posts

Dear Wolfang,
I submitted another post on developing nonlinear optics curriculum using OSP.
For this I'd really like to have fft capabilities.
Is there a way of doing Fourier transforms from EJS?
According to your notes in Simulations in Physics, Chapter 9, it is possible to use Java with OSP libraries to do FFT. However, I couldn't implement this in EJS.
Thanks for the time Carlos

Re: Re: Re: Is the Fourier Tool functioning?  Sep 11 2012 3:16AM

Francisco Esquembre
215 Posts

Carlos,
OSP has three FFTjava classes that you can readily use from EJS. The source code for the three classes are attached to this post. To use, say the FFTReal class, you need to fully qualify its name, as in org.opensourcephysics.numerics.FFTReal myFFT = new org.opensourcephysics.numerics.FFTReal(100);
(Or add an import for org.opensourcephysics.numerics.FFTReal in your simulation information window.)
That's it. Then use the myFFT object as the class allows.
Paco
PS: I'll see why the FourierTool does not do what it is supposed to do...
Attached File: Archive.zip

Re: Re: Re: Re: Is the Fourier Tool functioning?  Sep 12 2012 10:49AM

Carlos Trallero
4 Posts

Dear Francisco,
Thanks for your reply.
These java files, how do I incorporate them into EJS?
I tried importing fft libraries in the custom part of the code but it didn't work.
In the EJS distribution file there is a sample for Fourier analysis but it is full fft program. I couldn't find and example where other libraries are imported.
Thanks again Carlos

Re: Re: Re: Re: Re: Is the Fourier Tool functioning?  Sep 12 2012 12:06PM

Francisco Esquembre
215 Posts

Carlos,
These Java files are already into EJS. Just write code similar to what I wrote and it will compile and run. I sent you the files for you to see how they work. The Javadoc(umentation) in these files explain what you an expect from it.
Yes. A little bit of Java is needed. (But only a little bit.)
Paco

Re: Re: Re: Re: Re: Re: Is the Fourier Tool functioning?  Sep 13 2012 1:21AM

Ivo Gienal
9 Posts

Dear Paco
As I'm also interested in using FFT in certain ejs Simulations, could you please post or send me the Javadoc(umentation) to.
Thanks
Ivo
gienal@sunrise.ch

Re: Re: Re: Re: Re: Re: Re: Is the Fourier Tool functioning?  Sep 13 2012 4:50AM

Francisco Esquembre
215 Posts

Ivo,
What I call Javadoc is actually the comments included (with a special  Javadoc  format) in the Java files that I attached to my post. I think that you can learn how to use these classes and methods by reading these comments.
I did not create those files, so I can't be of further use myself.
Paco

Re: Re: Re: Is the Fourier Tool functioning?  Sep 11 2012 6:57AM

Wolfgang
110 Posts

Carlos
The Apache Commons Mathematics library is distributed with EJS and this library contains a FFT package. You will, of course, need to access this library using ordinary Java code rather than EJS drag and drop elements but this is not hard to do. For example, I use the Apache library to do linear algebra in my falling chain model.
http://www.compadre.org/osp/items/detail.cfm?ID=11056

Re: Re: Re: Re: Is the Fourier Tool functioning?  Sep 12 2012 10:44AM

Carlos Trallero
4 Posts

Dear Wolfang,
Is the ejs available?
the main issue I have is how to incorporate the fft tool into EJS. That is, I don't know where to input the fft code, import xxx library etc...
I'm familiar with other languages but not Java, that is why I would like to stick with EJS.
Thanks for your reply.
Carlos

Re: Re: Re: Re: Re: Is the Fourier Tool functioning?  Sep 12 2012 1:32PM

Wolfgang
110 Posts

The information dialog available in the upper right hand corner of the EJS tool allows you to import compiled classes and jar files into your EJS models. See the attached screens shot to see how to import the Apache linear algebra classes into an EJS model.
Attached File: EJS_Import.jpg

Re: Re: Is the Fourier Tool functioning?  Oct 01 2012 5:03PM

Wolfgang
110 Posts

Fourier analysis has been added to the standard Data Tool. This new functionality will be available in the next release of EJS but you can already test it using the standalone Data Tool program.
http://www.opensourcephysics.org/items/Detail.cfm?ID=7331

