# [Numpy-discussion] second 2d fft gives the same result as fft+ifft

David Goldsmith d_l_goldsmith at yahoo.com
Tue Jun 9 14:01:57 EDT 2009

```--- On Tue, 6/9/09, Matthieu Brucher <matthieu.brucher at gmail.com> wrote:

> Hi,
>
> Is it really ?
> You only show the imaginary part of the FFT, so you can't
> be sure of
> what you are saying.

Indeed, is there not a "label" for a function f which satisfies

Im(iFFT(f)) = Im(FFT^2(f)), Re(iFFT(f)) != Re(FFT^2(f))?

(And similarly if Im and Re roles are reversed.)  Seems like the class of such functions (if any exist) might have some interesting properties...

DG

> Don't forget that the only difference between FFT and iFFT
> is (besides
> of teh scaling factor) a minus sign in the exponent.
>
> Matthieu
>
> 2009/6/9 bela <bela.mihalik at gmail.com>:
> >
> > I tried to calculate the second fourier transformation
> of an image with the
> > following code below:
> >
> >
> ---------------------------------------------------------------
> > import pylab
> > import numpy
> >
> > ### Create a simple image
> >
> > fx = numpy.zeros( 128**2 ).reshape(128,128).astype(
> numpy.float )
> >
> > for i in xrange(8):
> >        for j in xrange(8):
> >                fx[i*8+16][j*8+16] = 1.0
> >
> > ### Fourier Transformations
> >
> > Ffx = numpy.copy( numpy.fft.fft2( fx ).real )   # 1st
> fourier
> > FFfx = numpy.copy( numpy.fft.fft2( Ffx ).real )  #
> 2nd fourier
> > IFfx = numpy.copy( numpy.fft.ifft2( Ffx ).real )   #
> inverse fourier
> >
> > ### Display result
> >
> > pylab.figure( 1, figsize=(8,8), dpi=125 )
> >
> > pylab.subplot(221)
> > pylab.imshow( fx, cmap=pylab.cm.gray )
> > pylab.colorbar()
> > pylab.title( "fx" )
> >
> > pylab.subplot(222)
> > pylab.imshow( Ffx, cmap=pylab.cm.gray )
> > pylab.colorbar()
> > pylab.title( "Ffx" )
> >
> > pylab.subplot(223)
> > pylab.imshow( FFfx, cmap=pylab.cm.gray )
> > pylab.colorbar()
> > pylab.title( "FFfx" )
> >
> > pylab.subplot(224)
> > pylab.imshow( IFfx, cmap=pylab.cm.gray )
> > pylab.colorbar()
> > pylab.title( "IFfx" )
> >
> > pylab.show()
> >
> ---------------------------------------------------------------
> >
> > On my computer FFfx is the same as IFfx..... but why?
> >
> > I uploaded a screenshot about my result here:
> > http://server6.theimagehosting.com/image.php?img=second_fourier.png
> >
> > Bela
> >
> >
> > --
> > View this message in context: http://www.nabble.com/second-2d-fft-gives-the-same-result-as-fft%2Bifft-tp23945026p23945026.html
> > Sent from the Numpy-discussion mailing list archive at
> Nabble.com.
> >
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion at scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
>
>
>
> --
> Information System Engineer, Ph.D.
> Website: http://matthieu-brucher.developpez.com/
> Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92