State the representation

Goal: reconstruct a field and explain every scale factor. Use \(N\) samples on \(x_j=2\pi j/N\), without repeating the periodic endpoint. In the mathematical chapters, our coefficients are normalized:

\[c_k=\frac1N\sum_{j=0}^{N-1}u_j e^{-ikx_j},\qquad u_j=\sum_{k\in\mathcal K_N}c_k e^{ikx_j}.\]

An FFT is an efficient way of evaluating these sums, not a different basis. For integer \(m\) strictly below Nyquist, the signal \(u=\mu+A\cos(mx+\varphi)\) has

\[c_0=\mu,\qquad c_m=\frac A2e^{i\varphi},\qquad c_{-m}=\frac A2e^{-i\varphi}.\]

A positive phase therefore gives a positive imaginary part at \(+m\) under this forward-transform sign convention. A real field need not have real Fourier coefficients. Its coefficients obey Hermitian symmetry, \(c_{-k}=\overline{c_k}\).

Predict a phase, then inspect its coefficients

This experiment uses one cosine to isolate the transform convention. Set the phase to 0°, 90° and −90° before looking at the bars. Predict the sign of each imaginary coefficient. The cosine amplitude is 0.6 and its mean is 0.2; changing phase should not change its mean-square value.

Interactive experiment / normalized complex DFT

Round-trip max error 1.71e-15. Mean-square in physical space 0.220000, in Fourier space 0.220000. A real N=16 signal needs 9 stored r2c coefficients in 1D. Interactive controls appear when the experiment is ready.

Samples and reconstructed periodic cosine
Default settings. Download the default data (CSV). The equations and worked example below explain the result.
Real and imaginary normalized Fourier coefficients by signed mode
Default settings. Download the default data (CSV). The equations and worked example below explain the result.

Direct O(N²) DFT in the browser, not OpenPFC execution or a speed comparison. CSV rows contain sample index j and FFT-bin index k in the same numeric order; those are different spaces.

Check the normalization with Parseval

With the normalized coefficients above,

\[\frac1N\sum_j|u_j|^2=\sum_k|c_k|^2.\]

Our one-cosine experiment therefore has mean-square \(0.2^2+0.6^2/2=0.22\), independent of phase. A successful round trip alone can conceal a convention mismatch if the forward and inverse compensate for each other. Check a known coefficient and Parseval as well.

OpenPFC’s HeFFTe CPU path uses an unscaled forward transform and a fully scaled inverse. In 1D, its raw output is \(F_k=Nc_k\); for an \(N_x\times N_y\times N_z\) grid, \(F_{\boldsymbol k}=V c_{\boldsymbol k}\) with \(V=N_xN_yN_z\). The inverse divides by \(V\). Divide by \(V\) when reporting normalized coefficients, and avoid applying that factor a second time. HeFFTe scaling documentation describes the corresponding forward/inverse pairs.

Full complex arrays and real-to-complex storage

An even full complex array has signed indices \(0,1,\ldots,N/2,-N/2+1,\ldots,-1\). A real-to-complex transform stores \(0,\ldots,N/2\) along its compressed axis; the other half follows by symmetry. In 1D, DC and Nyquist coefficients are real. At a multidimensional DC or Nyquist plane, coefficients can still be complex: their conjugate partners also negate the transverse indices. Only modes that are self-conjugate on every axis must be real.

For Parseval with x-compressed storage, weight interior x coefficients by 2 and the x=0 and even-grid x=Nyquist planes by 1, while summing all stored transverse indices. The course model’s grid has \(V=16N\) real cells and \(16(N/2+1)\) complex coefficients. Its y/z-varying coefficients are zero.

For first derivatives, review the real Nyquist convention. Our reaction–diffusion operator uses the even multiplier \(-k^2\) and retains modes far below Nyquist, avoiding that first-derivative ambiguity.

Checkpoint: find the missing factor

A 32 × 4 × 4 transform of μ + A cos x returns raw F₀ = 102.4 and F₁ = 89.6. What are μ and A?

The global real cell count is \(V=512\). Thus \(\mu=102.4/512=0.2\) and \(c_1=89.6/512=0.175\). A zero-phase real cosine has \(A=2c_1=0.35\). Dividing by the local rank’s cell count would make the reported amplitude depend on rank count. The scale belongs to the global transform.