Why is FFT of (A+B) different from FFT(A) + FFT(B)?
I solved it!! The problem was the calculation of the Nonl term: Nonl[i*Ny+j][0] = dh[i*Ny+j][0]*dh[i*Ny+j][0]*dh[i*Ny+j][0]; Nonl[i*Ny+j][1] = 0.0; That needs to be changed to: Nonl[i*Ny+j][0] = dh[i*Ny+j][0]*dh[i*Ny+j][0]*dh[i*Ny+j][0] -3.0*dh[i*Ny+j][0]*dh[i*Ny+j][1]*dh[i*Ny+j][1]; Nonl[i*Ny+j][1] = -dh[i*Ny+j][1]*dh[i*Ny+j][1]*dh[i*Ny+j][1] +3.0*dh[i*Ny+j][0]*dh[i*Ny+j][0]*dh[i*Ny+j][1]; In other words: I need to consider dh as a complex function (even though it should be real). Basically, because of stupid rounding … Read more