No, at the Nyquist frequency it simply adds the aliased amplitudes like at every other frequency. There’s no “averaging”.

For example, for the IFFT of a “delta”-function frequency content, i.e. a pure sinusoid at a frequency of 2\pi*1/n (not the Nyquist frequency) with an amplitude of `1`

, it outputs an amplitude of 1. If we add an alias at a frequency of 2\pi*(1+n)/n then it outputs an amplitude of 2:

```
julia> using FFTW
julia> n = 8
8
julia> ifft( cis.(-2π * 1 * (0:n-1) / n) )
8-element Vector{ComplexF64}:
-4.3063660604970826e-17 - 1.4302971815274583e-18im
1.0 + 1.244288779022145e-16im
2.918587279715637e-17 - 1.5308084989341915e-17im
0.0 - 1.5308084989341915e-17im
1.2447490626287002e-17 - 2.9185872797156375e-17im
-1.1102230246251565e-16 - 3.2580367966163016e-17im
1.4302971815274553e-18 - 1.5308084989341915e-17im
0.0 - 1.5308084989341918e-17im
julia> ifft( cis.(-2π * 1 * (0:n-1) / n) + cis.(-2π * (1+n) * (0:n-1) / n))
8-element Vector{ComplexF64}:
-2.0859200112467696e-16 - 4.0288103043407935e-16im
2.0 + 9.560533348749494e-16im
2.3634757674030587e-16 - 3.7512545481845044e-16im
0.0 - 3.3587314335135604e-16im
-5.416589085122239e-16 + 9.671933064724106e-17im
0.0 + 4.065209743356281e-16im
5.13903332896595e-16 + 6.896375503161215e-17im
0.0 - 4.1437776628554474e-16im
```

And exactly the same thing happens at the Nyquist frequency \pm \pi:

```
julia> ifft( cis.(-2π * (n/2) * (0:n-1) / n) )
8-element Vector{ComplexF64}:
0.0 - 6.123233995736767e-17im
-2.5363265666181693e-17 - 6.123233995736766e-17im
-6.123233995736764e-17 - 6.123233995736766e-17im
-1.4782794558091698e-16 - 6.123233995736766e-17im
1.0 + 4.286263797015736e-16im
1.4782794558091698e-16 - 6.123233995736766e-17im
6.123233995736764e-17 - 6.123233995736766e-17im
2.5363265666181693e-17 - 6.123233995736766e-17im
julia> ifft( cis.(-2π * (n/2) * (0:n-1) / n) + cis.(+2π * (n/2) * (0:n-1) / n) )
8-element Vector{ComplexF64}:
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
2.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
julia> ifft( 2cos.(-2π * (n/2) * (0:n-1) / n) ) # 2cos = same thing as adding alias
8-element Vector{ComplexF64}:
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
2.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
0.0 + 0.0im
```

This shouldn’t be surprising since (a) the DFT definition does not have a different scale factor for the Nyquist term and (b) the aliased signal is identical at the sample points (this is the definition of “aliasing”) so it is literally impossible for the transform to detect how many aliased terms were summed in order to “average” them.

Maybe you are confused by the fact that if you put in a cosine (not a complex exponential) at a lower frequency, e.g. 2\pi/n, then a DFT is able to distinguish both the positive and negative frequency components as separate amplitudes:

```
julia> ifft( 2cos.(-2π * (1) * (0:n-1) / n) )
8-element Vector{ComplexF64}:
-8.612732120994165e-17 + 0.0im
1.0 + 1.3973696289155642e-16im
3.0616169978683824e-17 + 0.0im
-1.1102230246251565e-16 + 1.7272282976821098e-17im
2.4894981252574003e-17 + 0.0im
-1.1102230246251565e-16 - 1.7272282976821098e-17im
3.0616169978683824e-17 + 0.0im
1.0 - 1.3973696289155642e-16im
```

so the cosine seems to be “normalized differently” at the Nyquist frequency. This is just a consequence of the facts that the DFT basis functions are complex exponentials and a pure cosine consists of *two* complex exponentials, but at the Nyquist frequency those two complex exponentials are aliased.