← All exhibits

Fourier

Represent a sampled contour with complex Fourier coefficients and measure the error caused by discarding frequencies.

Computing new parameters. The previous result is shown until ready.
Visualization controls
-1-111Re zIm zBand-limited · N=256 · K=16
Input contourReconstructionSelected mode
Cycles per second. Playback evaluates the saved coefficients; it does not recompute the DFT or alter experiment results.

Current reconstruction: (1.19600, -1.9909e-15)

Coefficient Re
1.01678
Coefficient Im
-1.1371e-16
Amplitude
1.01678
Phase (rad)
-1.1183e-16
All coefficients and retained frequencies

Selected order: 0, +1, -1, +2, -2, +3, -3, +4, -4, +5, -5, +6, -6, +7, -7, +8. Exact amplitude ties use 0, +1, −1, +2, −2 order. Nyquist is always −N/2.

Complex DFT coefficients: forward normalization 1/N
kRe cₖIm cₖ|cₖ|Phase (rad)Retained
-6.7335e-8-2.0433e-166.7335e-8-3.14159No
7.7700e-82.4772e-157.7700e-83.1882e-8No
-1.2217e-7-8.8634e-171.2217e-7-3.14159No
1.4633e-75.2589e-161.4633e-73.5939e-9No
1.8133e-77.4756e-161.8133e-74.1227e-9No
2.7405e-71.8702e-172.7405e-76.8244e-11No
3.8575e-83.2418e-173.8575e-88.4038e-10No
-5.3672e-85.6216e-165.3672e-83.14159No
-1.4501e-7-1.3683e-161.4501e-7-3.14159No
1.6376e-71.0950e-171.6376e-76.6869e-11No
1.7802e-81.1727e-151.7802e-86.5872e-8No
1.0799e-72.6368e-161.0799e-72.4417e-9No
-8.8478e-92.6281e-168.8478e-93.14159No
-8.3319e-8-5.8764e-178.3319e-8-3.14159No
3.0128e-8-1.4897e-163.0128e-8-4.9446e-9No
-6.5586e-7-5.0676e-166.5586e-7-3.14159No
5.4565e-83.4998e-165.4565e-86.4140e-9No
7.1581e-87.2728e-167.1581e-81.0160e-8No
-3.4410e-7-1.3683e-163.4410e-7-3.14159No
-1.9759e-81.8605e-161.9759e-83.14159No
3.6373e-7-1.9559e-163.6373e-7-5.3774e-10No
1.7477e-77.3812e-161.7477e-74.2233e-9No
7.4935e-8-2.0687e-167.4935e-8-2.7606e-9No
-3.8022e-82.3809e-163.8022e-83.14159No
1.1099e-65.7940e-161.1099e-65.2203e-10No
6.5595e-9-1.1059e-166.5595e-9-1.6859e-8No
4.2420e-77.0777e-164.2420e-71.6685e-9No
8.6747e-7-1.0842e-178.6747e-7-1.2498e-11No
1.2039e-71.3834e-161.2039e-71.1492e-9No
9.0788e-85.1391e-169.0788e-85.6606e-9No
5.8865e-76.6310e-165.8865e-71.1265e-9No
1.9809e-88.1228e-161.9809e-84.1005e-8No
7.6536e-7-6.2450e-177.6536e-7-8.1596e-11No
2.5677e-7-2.6064e-162.5677e-7-1.0151e-9No
9.0429e-8-7.7542e-169.0429e-8-8.5749e-9No
-2.2392e-78.0101e-162.2392e-73.14159No
1.4353e-7-2.1281e-151.4353e-7-1.4827e-8No
-5.5837e-86.1713e-165.5837e-83.14159No
1.1784e-78.5869e-171.1784e-77.2869e-10No
4.8693e-7-1.3444e-174.8693e-7-2.7610e-11No
9.8526e-82.0079e-169.8526e-82.0380e-9No
-6.4386e-7-2.8666e-166.4386e-7-3.14159No
7.6105e-8-3.0618e-167.6105e-8-4.0231e-9No
-8.6078e-8-2.4026e-168.6078e-8-3.14159No
2.5414e-7-1.6133e-162.5414e-7-6.3482e-10No
-1.7960e-7-4.8746e-161.7960e-7-3.14159No
5.3557e-8-5.3603e-165.3557e-8-1.0009e-8No
-2.2696e-75.6379e-172.2696e-73.14159No
9.3922e-82.7582e-169.3922e-82.9367e-9No
-7.0153e-8-8.7604e-177.0153e-8-3.14159No
4.2174e-71.0061e-164.2174e-72.3857e-10No
2.0775e-7-2.3939e-162.0775e-7-1.1523e-9No
2.0577e-73.7990e-162.0577e-71.8462e-9No
-1.8279e-72.3592e-161.8279e-73.14159No
-1.3712e-83.1225e-171.3712e-83.14159No
5.0734e-82.2204e-165.0734e-84.3767e-9No
2.3893e-77.4073e-162.3893e-73.1002e-9No
-9.4637e-8-9.1073e-179.4637e-8-3.14159No
1.1878e-7-3.0358e-161.1878e-7-2.5557e-9No
-1.3423e-71.6046e-161.3423e-73.14159No
3.6461e-71.7000e-163.6461e-74.6626e-10No
-9.4608e-81.2056e-169.4608e-83.14159No
1.9514e-77.8930e-171.9514e-74.0449e-10No
1.4374e-72.0817e-161.4374e-71.4483e-9No
-6.8083e-81.1536e-166.8083e-83.14159No
-1.3594e-71.1796e-161.3594e-73.14159No
-9.3526e-73.0878e-169.3526e-73.14159No
-1.7936e-8-1.3357e-161.7936e-8-3.14159No
1.6066e-71.4832e-161.6066e-79.2319e-10No
-1.4232e-61.2490e-161.4232e-63.14159No
2.3550e-81.6306e-162.3550e-86.9243e-9No
8.3634e-89.9747e-178.3634e-81.1927e-9No
2.6175e-7-5.3776e-172.6175e-7-2.0545e-10No
8.2282e-83.3827e-178.2282e-84.1111e-10No
1.9248e-79.0206e-171.9248e-74.6866e-10No
2.8507e-6-7.0256e-172.8507e-6-2.4645e-11No
-1.1576e-8-4.5450e-161.1576e-8-3.14159No
2.8293e-81.3531e-162.8293e-84.7825e-9No
4.9809e-61.9776e-164.9809e-63.9703e-11No
1.3356e-73.7297e-161.3356e-72.7925e-9No
2.2367e-78.9512e-162.2367e-74.0020e-9No
3.4416e-62.6021e-183.4416e-67.5606e-13No
3.6956e-81.2143e-153.6956e-83.2858e-8No
1.3025e-72.6021e-161.3025e-71.9978e-9No
3.5284e-71.0929e-163.5284e-73.0974e-10No
1.0877e-71.0061e-161.0877e-79.2500e-10No
2.0538e-71.0148e-162.0538e-74.9410e-10No
-3.3766e-71.0148e-163.3766e-73.14159No
-2.4253e-8-2.0123e-162.4253e-8-3.14159No
-1.5041e-7-1.1926e-161.5041e-7-3.14159No
2.2922e-6-4.0332e-172.2922e-6-1.7595e-11No
6.1406e-8-8.5435e-176.1406e-8-1.3913e-9No
-1.1856e-72.0383e-171.1856e-73.14159No
-1.2969e-69.7145e-171.2969e-63.14159No
-1.0480e-8-4.8139e-171.0480e-8-3.14159No
-2.0542e-7-8.6736e-182.0542e-7-3.14159No
2.7642e-6-1.5005e-162.7642e-6-5.4285e-11No
1.4091e-94.7705e-171.4091e-93.3855e-8No
1.0213e-79.2374e-171.0213e-79.0445e-10No
-7.2937e-6-1.9993e-167.2937e-6-3.14159No
2.9976e-81.8215e-162.9976e-86.0765e-9No
1.1676e-7-8.8037e-171.1676e-7-7.5399e-10No
1.6612e-53.5562e-171.6612e-52.1408e-12No
4.3807e-8-7.2425e-174.3807e-8-1.6533e-9No
1.0711e-78.4568e-171.0711e-77.8958e-10No
-3.5171e-5-6.9389e-183.5171e-5-3.14159No
1.7140e-75.7680e-171.7140e-73.3653e-10No
1.2359e-83.9465e-171.2359e-83.1933e-9No
7.8387e-57.3726e-177.8387e-59.4053e-13No
6.4624e-8-5.9848e-176.4624e-8-9.2609e-10No
4.1703e-82.3896e-164.1703e-85.7301e-9No
-0.000184267-2.2421e-160.000184267-3.14159No
8.0879e-99.5843e-178.0879e-91.1850e-8No
3.1503e-8-3.9899e-173.1503e-8-1.2665e-9No
0.000457149-1.5396e-170.000457149-3.3678e-14No
-2.0115e-7-1.2100e-162.0115e-7-3.14159No
-6.6724e-9-1.6480e-176.6724e-9-3.14159No
-0.001212195.0741e-170.001212193.14159No
-1.9484e-81.1493e-171.9484e-83.14159No
3.3578e-8-1.5135e-163.3578e-8-4.5075e-9No
0.003692662.0383e-170.003692665.5199e-15No
-9.3883e-96.3860e-179.3883e-93.14159Yes
8.8426e-87.9472e-178.8426e-88.9874e-10Yes
-0.0133995-7.1341e-170.0133995-3.14159Yes
1.3008e-7-1.4767e-161.3008e-7-1.1352e-9Yes
7.7261e-8-9.1615e-187.7261e-8-1.1858e-10Yes
0.1257811.2306e-160.1257819.7834e-16Yes
4.3103e-8-3.1821e-174.3103e-8-7.3826e-10Yes
1.3314e-7-5.8654e-161.3314e-7-4.4054e-9Yes
1.01678-1.1371e-161.01678-1.1183e-16Yes
9.9002e-8-5.3980e-169.9002e-8-5.4524e-9Yes
2.5850e-8-2.2936e-162.5850e-8-8.8728e-9Yes
0.06845938.3213e-170.06845931.2155e-15Yes
9.6021e-8-3.5730e-169.6021e-8-3.7211e-9Yes
1.4127e-7-1.8811e-161.4127e-7-1.3315e-9Yes
-0.00162763-6.0607e-170.00162763-3.14159Yes
9.4698e-8-5.0958e-189.4698e-8-5.3810e-11Yes
3.4545e-8-8.8796e-173.4545e-8-2.5705e-9No
0.00135307-1.1514e-160.00135307-8.5097e-14No
7.6158e-8-9.3241e-177.6158e-8-1.2243e-9No
6.9485e-85.5511e-176.9485e-87.9889e-10No
-0.0002793425.6379e-170.0002793423.14159No
1.2427e-8-9.7361e-171.2427e-8-7.8345e-9No
-1.6438e-7-3.0358e-171.6438e-7-3.14159No
0.000112667-1.4442e-160.000112667-1.2818e-12No
1.2888e-91.1709e-161.2888e-99.0855e-8No
-9.3771e-81.0257e-169.3771e-83.14159No
-3.8763e-58.0665e-173.8763e-53.14159No
5.7979e-83.3827e-175.7979e-85.8343e-10No
-1.8047e-82.9057e-171.8047e-83.14159No
1.6136e-5-1.0842e-171.6136e-5-6.7190e-13No
-9.7548e-9-4.7705e-179.7548e-9-3.14159No
1.4190e-77.9364e-171.4190e-75.5931e-10No
-7.2029e-61.8171e-167.2029e-63.14159No
7.3707e-89.5410e-177.3707e-81.2945e-9No
1.1121e-7-4.8963e-161.1121e-7-4.4027e-9No
3.0956e-61.4658e-163.0956e-64.7353e-11No
6.7268e-81.8345e-166.7268e-82.7271e-9No
4.1217e-8-1.9646e-164.1217e-8-4.7664e-9No
-5.6294e-7-1.8822e-165.6294e-7-3.14159No
2.2026e-72.8363e-162.2026e-71.2877e-9No
4.0945e-8-6.3317e-174.0945e-8-1.5464e-9No
1.0546e-7-1.9386e-161.0546e-7-1.8381e-9No
-9.0978e-8-2.2551e-179.0978e-8-3.14159No
-4.3365e-85.5077e-174.3365e-83.14159No
-8.3417e-7-1.4095e-168.3417e-7-3.14159No
-8.9119e-8-3.6863e-178.9119e-8-3.14159No
7.2162e-8-2.2855e-167.2162e-8-3.1672e-9No
1.2814e-64.9006e-171.2814e-63.8244e-11No
-2.5778e-7-7.5027e-172.5778e-7-3.14159No
-3.8652e-8-1.5179e-163.8652e-8-3.14159No
9.3121e-7-2.0470e-169.3121e-7-2.1982e-10No
6.3900e-8-1.1015e-166.3900e-8-1.7239e-9No
8.2327e-8-1.8215e-178.2327e-8-2.2125e-10No
-6.0215e-78.3093e-166.0215e-73.14159No
8.6559e-8-5.8113e-178.6559e-8-6.7137e-10No
2.0581e-8-7.0083e-162.0581e-8-3.4052e-8No
1.2168e-62.3419e-171.2168e-61.9246e-11No
2.5996e-7-3.4694e-172.5996e-7-1.3346e-10No
1.3739e-7-1.3878e-171.3739e-7-1.0101e-10No
4.4750e-64.6838e-174.4750e-61.0467e-11No
4.9256e-8-3.4868e-164.9256e-8-7.0789e-9No
3.1708e-8-2.6368e-163.1708e-8-8.3157e-9No
4.5069e-63.5215e-164.5069e-67.8136e-11No
1.8470e-7-2.6021e-171.8470e-7-1.4089e-10No
4.8649e-81.0235e-164.8649e-82.1038e-9No
2.2937e-6-4.3195e-162.2937e-6-1.8831e-10No
4.7208e-84.5103e-174.7208e-89.5541e-10No
6.9386e-8-4.9353e-166.9386e-8-7.1128e-9No
-3.8155e-7-1.1709e-163.8155e-7-3.14159No
2.8158e-7-8.6736e-182.8158e-7-3.0804e-11No
1.0027e-97.2858e-171.0027e-97.2659e-8No
-1.3378e-6-2.7148e-161.3378e-6-3.14159No
-1.5459e-7-2.7669e-161.5459e-7-3.14159No
5.3975e-99.6277e-175.3975e-91.7838e-8No
-5.4918e-7-1.7954e-165.4918e-7-3.14159No
2.1928e-7-8.4134e-162.1928e-7-3.8368e-9No
-1.6525e-75.2042e-181.6525e-73.14159No
3.1153e-7-4.1286e-163.1153e-7-1.3253e-9No
-1.8475e-7-2.2551e-171.8475e-7-3.14159No
6.3785e-82.6888e-176.3785e-84.2154e-10No
1.2019e-7-1.6827e-161.2019e-7-1.4000e-9No
3.0036e-7-2.0643e-153.0036e-7-6.8728e-9No
-1.3391e-8-3.7470e-161.3391e-8-3.14159No
-1.0154e-7-6.2016e-161.0154e-7-3.14159No
-2.7801e-7-1.2056e-162.7801e-7-3.14159No
2.3200e-7-2.6021e-172.3200e-7-1.1216e-10No
9.8591e-82.8970e-169.8591e-82.9384e-9No
4.2974e-72.2551e-164.2974e-75.2477e-10No
3.0936e-9-2.7409e-163.0936e-9-8.8598e-8No
2.2207e-7-1.4381e-152.2207e-7-6.4759e-9No
-2.0425e-77.3379e-162.0425e-73.14159No
7.4284e-83.3220e-167.4284e-84.4720e-9No
-4.7391e-82.8189e-164.7391e-83.14159No
4.1770e-75.1088e-164.1770e-71.2231e-9No
-9.5227e-82.9317e-169.5227e-83.14159No
-1.9859e-7-1.7694e-161.9859e-7-3.14159No
-5.0696e-7-7.9841e-165.0696e-7-3.14159No
7.4780e-89.2374e-177.4780e-81.2353e-9No
3.5460e-7-1.1319e-163.5460e-7-3.1921e-10No
5.1951e-9-2.6992e-155.1951e-9-5.1958e-7No
-4.1239e-8-4.0202e-164.1239e-8-3.14159No
3.0631e-73.5388e-163.0631e-71.1553e-9No
-4.6014e-73.0965e-164.6014e-73.14159No
5.8577e-86.8305e-165.8577e-81.1661e-8No
1.0943e-71.8692e-161.0943e-71.7081e-9No
5.0367e-75.2475e-175.0367e-71.0419e-10No
2.4198e-9-2.4850e-162.4198e-9-1.0269e-7No
3.9682e-72.3245e-163.9682e-75.8578e-10No
2.3196e-74.5276e-162.3196e-71.9519e-9No
1.1818e-73.8337e-161.1818e-73.2440e-9No
5.4321e-7-4.7662e-165.4321e-7-8.7741e-10No
4.4752e-7-1.1449e-154.4752e-7-2.5583e-9No
2.3178e-8-1.3878e-172.3178e-8-5.9874e-10No
1.2150e-6-2.0687e-161.2150e-6-1.7026e-10No
6.6509e-8-8.7604e-166.6509e-8-1.3172e-8No
9.0854e-8-7.8453e-169.0854e-8-8.6351e-9No
7.6073e-71.9858e-157.6073e-72.6104e-9No
2.2799e-7-1.1709e-172.2799e-7-5.1359e-11No
-1.8251e-8-7.4593e-171.8251e-8-3.14159No
1.2916e-7-2.6541e-161.2916e-7-2.0548e-9No
2.6551e-7-2.2573e-162.6551e-7-8.5018e-10No
8.2050e-8-5.6162e-178.2050e-8-6.8448e-10No
-6.0056e-76.0910e-166.0056e-73.14159No
-2.6258e-8-2.6021e-172.6258e-8-3.14159No
-6.5769e-8-2.5023e-166.5769e-8-3.14159No
-4.1447e-7-3.3957e-164.1447e-7-3.14159No
2.2561e-7-1.8865e-162.2561e-7-8.3617e-10No
2.5998e-88.7105e-162.5998e-83.3505e-8No
1.1665e-7-2.7333e-161.1665e-7-2.3431e-9No
-2.0412e-71.9353e-162.0412e-73.14159No
-1.0867e-71.4756e-161.0867e-73.14159No
-4.0938e-9-5.0546e-164.0938e-9-3.14159No
2.3294e-75.1012e-172.3294e-72.1899e-10No
1.0742e-7-4.0387e-171.0742e-7-3.7596e-10No
2.2467e-7-1.1154e-152.2467e-7-4.9645e-9No

Frequency +1 is retained and highlighted in the vector chain. A positive frequency rotates counterclockwise. DC is a constant translation.

The trail is a visualization of the stored Fourier sum. Complete reconstruction concerns the N sample positions; the curve between them is trigonometric interpolation. Undefined phases below 4.37e-12 are omitted from the phase plot.

Draw or enter a local contour

Draw a single stroke in the panel, or enter coordinates below. Open strokes are closed with a straight segment before sampling. Nothing is uploaded.

xy−22

0 / 4,096 input points. Dashed copper segment indicates closure. The drawing frame spans −2.4 to 2.4 horizontally; keyboard coordinates may range from −4 to 4.

See discrete orthogonality

These 256 vectors are the actual terms of the finite geometric sum. Change the integer frequency difference to compare cancellation with coincident modes.

ReIm
1N∑j=0N−1e2πi(k−ℓ)j/N\frac{1}{N}\sum_{j=0}^{N-1}e^{2\pi i(k-\ell)j/N}

Computed mean: (-3.9899e-17, 3.2255e-18)

Theorem value: 0. Copper shows the computed mean. Read the finite-geometric-series derivation in Reasoning; the picture is an illustration.

Measurements

Samples N
256
Retained terms K
16
DC retained
Yes; counted in K
Sample MSE
1.728e-5
Discarded coefficient energy
1.728e-5
MSE identity residual
9.487e-20
Parseval energy residual
0
Dense reference MSE (selected K)
1.729e-5
Dense reference MSE (all N)
6.978e-10Comparison at 2,048 arclength positions against the saved dense contour reference; this is separate from sample truncation error.

Guided exploration

How does the choice of retained frequencies affect reconstruction error?

Amplitude spectrum

Vertical: |cₖ|

1.003e-9-1280.254-64.30.508-0.50.76363.31.02127Signed frequency k
All coefficients
Coefficient phase

Vertical: Phase (rad)

-3.14-128-1.57-64.3-1.821e-14-0.51.5763.33.14127Signed frequency k
Defined phases
Reconstruction error by term budget

Vertical: Sample MSE (logarithmic scale)

1.194e-2811.157e-2164.81.122e-141291.088e-71921.05256Retained terms K (DC counted)
Band-limitedLargest coefficients

Experiment

Save the current parameters and full-precision results, or reproduce the documented study. Importing an experiment reruns its calculation. Display quality and camera position do not affect the exported mathematics.

Open the fourier study →
Method details

Direct Float64 complex DFT; forward 1/N, inverse unscaled; closed piecewise-linear equal-arclength resampling; signed Nyquist −N/2; independent sample MSE and omitted coefficient energy.

Model version: fourier-1.0.0. Software: 0.1.0+uncommitted.dirty.f24df3120282. Numerical tolerance: 4.190951585769653e-11.

Unrounded residual: 9.486769009248164e-20

Classification: numerical experiment. Mathematical claims require the stated assumptions and derivations.

Reasoning

Read the definitions, follow the arguments and examine the conditions of each result.

Background: Complex numbers, Sine and cosine, Finite sums. Start with the model for a brief introduction, follow the guided exploration for a closer look, or work through the arguments and experiment for a detailed study.

What you can learn
  • Use one consistent DFT normalization.
  • Connect orthogonality to reconstruction and error.
  • Separate sample reconstruction from the original continuous contour.

Reading step 1 of 5: Specify the sampled contour

Step 1 · Derivation · Selected

Specify the sampled contour

Represent each planar point by one complex number z = x + iy. The input is resampled at equal distances along its closed polygonal path, producing N samples without repeating the endpoint. Automatic closure is part of the input specification and must remain visible. A path with zero total length cannot define this sampling operation.

The transform sees a finite sequence, not an infinitely detailed drawing. Increasing N changes that sequence and may capture additional features of the input. Keeping N fixed while changing the retained term count studies a different question: how well a smaller set of modes represents the same data.

Sources: [M2] Discrete Fourier Transform — NumPy reference; [M3] But what is the Fourier Transform?

Step 2 · Derivation

Derive discrete orthogonality

Compare two modes with indices k and ℓ. Their inner product is the average of exp(2πi(k − ℓ)j/N) over all sample indices. If the frequencies agree modulo N, every summand is one. Otherwise the ratio q between consecutive summands satisfies qᴺ = 1 and q ≠ 1.

The finite geometric-series identity then gives (1 − qᴺ)/(1 − q) = 0. This cancellation establishes orthogonality algebraically. The rotating vectors illustrate the terms in that sum, but their appearance on the screen is not the reason the identity holds.

∑j=0N−1qj=1−qN1−q\sum_{j=0}^{N-1}q^j=\frac{1-q^N}{1-q}

Theorem. Distinct discrete Fourier modes are orthogonal under the sample-average inner product.

1N∑j=0N−1e2πi(k−ℓ)j/N={1,k≡ℓ(modN),0,otherwise.\frac1N\sum_{j=0}^{N-1}e^{2\pi i(k-\ell)j/N}=\begin{cases}1,&k\equiv\ell\pmod N,\\0,&\text{otherwise}.\end{cases}

Conditions and assumptions

  • N equally indexed samples.
  • Frequency indices are compared modulo N.

Sources: [M2] Discrete Fourier Transform — NumPy reference

Step 3 · Derivation

Recover the input samples

This project puts the factor 1/N in the forward transform. Substitute each coefficient into the inverse sum and exchange the two finite sums. Discrete orthogonality removes every input sample except the one with the required index, whose multiplier is one. The result is exact in arithmetic without rounding.

For display, indices use signed frequencies, including −N/2 at the even-size Nyquist position. This choice agrees at sample locations and specifies the interpolation between them. A complex contour need not have conjugate-symmetric coefficients; that symmetry is specific to real-valued input sequences.

ck=1N∑j=0N−1zje−2πikj/N,zj=∑k=0N−1cke2πikj/Nc_k=\frac1N\sum_{j=0}^{N-1}z_je^{-2\pi ikj/N},\qquad z_j=\sum_{k=0}^{N-1}c_ke^{2\pi ikj/N}

Derivation. The complete Fourier coefficient set reconstructs every input sample, up to numerical error.

Conditions and assumptions

  • Forward normalization is 1/N; the inverse is unscaled.
  • All N coefficients are included.

Sources: [M2] Discrete Fourier Transform — NumPy reference

Step 4 · Derivation

Measure truncation error

Removing a set of modes leaves an error vector equal to the sum of those omitted modes. Expand its squared norm. Orthogonality makes the mixed terms vanish, leaving the sum of the squared coefficient magnitudes. The workspace evaluates this coefficient energy separately from the average squared differences at the input samples.

For a fixed number of freely selectable coefficients, retaining the largest magnitudes minimizes this discrete squared error. If DC is fixed, optimize only over the remaining available terms and count DC in the budget. This conclusion does not assert optimality for corner appearance, maximum error or another visual criterion.

1N∑j=0N−1∣zj−z^j∣2=∑k∉S∣ck∣2\frac1N\sum_{j=0}^{N-1}|z_j-\widehat z_j|^2=\sum_{k\notin S}|c_k|^2

Theorem. The sample mean squared reconstruction error equals the energy in the omitted coefficients.

MSE⁡=1N∑j=0N−1∣zj−z^j∣2=∑k∉S∣ck∣2\operatorname{MSE}=\frac1N\sum_{j=0}^{N-1}|z_j-\widehat z_j|^2=\sum_{k\notin S}|c_k|^2

Conditions and assumptions

  • The reconstruction retains the specified set S.
  • The same samples and normalization are used on both sides.

Sources: [M2] Discrete Fourier Transform — NumPy reference

Step 5 · Numerical experiment

Separate reconstruction from interpolation

With all N terms, numerical reconstruction should recover the N samples within an input-scaled tolerance. Between those locations the displayed curve is a trigonometric interpolant. It need not coincide with the original continuous contour, even when the sample error is nearly zero.

The study compares contours, term budgets and selection rules at a fixed N before changing N. It stores input points, resampling settings and selected frequencies alongside coefficients and errors. A coefficient whose magnitude is near numerical zero has no reliably determined phase; the display identifies that case instead of presenting an arbitrary angle as meaningful.

Sources: [M2] Discrete Fourier Transform — NumPy reference; [M3] But what is the Fourier Transform?

References and review status

Project attribution: BIPH Math Society. The exposition was prepared with tool assistance.

Review status: Not reviewed. Independent review by a teacher or society member has not yet been recorded. Numerical checks do not replace mathematical review.

  1. [M2] Discrete Fourier Transform — NumPy reference

    NumPy contributors

    Definitions, signed-frequency conventions and normalization options. This project uses a forward factor of 1/N and an unscaled inverse, corresponding to norm="forward" rather than the library default. The browser implementation does not depend on NumPy. Source checked 16 September 2026.

  2. [M3] But what is the Fourier Transform?

    Grant Sanderson / 3Blue1Brown

    An author-created explanation connecting complex rotation and frequency. Used as a reference for mathematical exposition, not as a source of copied animation or as a substitute for the finite DFT derivation. Source checked 16 September 2026.

Related exhibits

BIPH Math Society · Tool-assisted implementation · Teacher/member review pending