Beispiel #1
0
        // inverts the Fourier transform of the Cooley-Tukey algorhitm via conjugating before and after the transform
        /// <summary>
        /// Calculates the inverse Fourier transformation using the CT algorithm.
        /// The inversion is accounted by complex conjugation of the whole array before and after the transformation with the CT algorithm.
        /// </summary>
        /// <returns>Inverse Fourier transformed array</returns>
        /// <param name="f">Array to be inverse Fourier transformed</param>
        public static ComplexNumber[] ICT(ComplexNumber[] f)
        {
            // Complex conjugation of the whole array
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = f[i].Conjugate();
            }

            f = FFT.CT(f);

            // Complex conjugation of the whole array again and resizing the parameters
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = f[i].Conjugate();
                f[i] = f[i] / f.Length;
            }
            return(f);
        }
Beispiel #2
0
        /// <summary>
        /// Simulates on timestep of the time evolution by performing the splitstep fourier method only once.
        /// </summary>
        /// <param name="FT">Algorithm which will be used for the Fouriertransformation</param>
        public void splitStepFourier(string FT)
        {
            int size = this.psi.Length;


            // psi=psi.*exp(-0.5*1i*dt*(V+(g1d/hbar)*abs(psi).ˆ2));
            for (int i = 0; i < size; i++)
            {
                psi[i] = psi[i] * ComplexNumber.Exp(-0.5 * ComplexNumber.ImaginaryOne * deltaT
                                                    * (V[i] + g1D / PhysConst.hbar
                                                       * Math.Pow(psi[i].Norm(), 2)));
            }
            // decides which algorithm will be used for the FT
            switch (FT)
            {
            case "DFT":
                psi = FFT.DFT(psi);
                break;

            case "CT":
                psi = FFT.CT(psi);
                break;

            case "BR":
                psi = FFT.BR(psi, reversedBits);
                break;

            default:
                break;
            }

            psi = FFT.Shift(psi); // shift the lower half with the upper one to restore normal order
            for (int i = 0; i < size; i++)
            {
                psi[i] = psi[i] / size;
            }


            // psi_k=psi_k*exp(-0.5*dt*1i*(hbar/m)*kˆ2)
            for (int i = 0; i < size; i++)
            {
                psi[i] = psi[i] * ComplexNumber.Exp(-0.5 * ComplexNumber.ImaginaryOne * deltaT * PhysConst.hbar / mass * Math.Pow(K[i], 2));
            }


            psi = FFT.Shift(psi); // shifts again, so that the result of the IFT will be normal orderd
            // decides which algorithm will be used for the IFT
            switch (FT)
            {
            case "DFT":
                psi = FFT.IDFT(psi);
                break;

            case "CT":
                psi = FFT.ICT(psi);
                break;

            case "BR":
                psi = FFT.IBR(psi, reversedBits);
                break;

            default:
                break;
            }

            for (int i = 0; i < size; i++)
            {
                psi[i] = psi[i] * size;
            }

            //psi = psi.* exp(-0.5 * 1i * dt * (V + (g1d / hbar) * abs(psi).ˆ2));
            for (int i = 0; i < size; i++)
            {
                psi[i] = psi[i] * ComplexNumber.Exp(-0.5 * ComplexNumber.ImaginaryOne * deltaT
                                                    * (V[i] + g1D / PhysConst.hbar
                                                       * Math.Pow(psi[i].Norm(), 2)));
            }
        }