Is (Inverse) Fourier Transform still a "sum" of sinusoids? I'm trying to wrap my mind around the FT and specifically the IFT:
$$x(t) = \frac{1}{2T}\int_{-\infty}^{\infty}x(\omega)e^{i\omega t}d\omega
$$
I understand that they are generalization of the Fourier Series to non-periodic functions, where you take the period to be infinite, and the interval to be 0.
My question is - does it still hold that what you get is, sort-of, a "sum" of sinusoids? The $x(\omega)$ representing the frequency-domain, are the magnitudes of the different frequencies, but how do you get rid of the imaginary part $i$ when expanding $e^{i\omega t}$ using Euler's formula?
Specifically, is there a way to (numerically approximate) the rect function (time domain) by "sampling" of frequencies from the sinc function (frequency domain) and appropriate sinusoids? (To be honest, the sinc function itself is already somewhat similar to the rect, so I think some approximation is possible...)
 A: I think what you are looking for is the Nyquist–Shannon sampling theorem, a striking result of the last century I came to know in a seminar. It roughly says that, if the Fourier transform is zero outside an interval, then you can perfectly reconstrct the function with discrete samples, "summing up" sinc function. The right hypothesis to assume is that your signal has "limited bandwidth". Let me also remark that this is not too restrictive in digital signal processing: since human can sense from $20 Hz$ to $20.000Hz$, it does not make any difference if you cut the Fourier transform to zero outside this interval.
The explicit reconstruction is given by the Whittaker-Shannon interpolation formula:
$$x(t) = \sum_{n=-\infty}^{\infty} x(nT) \cdot  \text{sinc} \left ( \frac{t-nT}{T} \right ) $$
where $T$ is the sampling time you choose. There is also an explicit bound in how small you should choose $T$ in order to have a perfect approximation: if the frequencies are at most $B$, a sampling time of $T=1/2B$ will perfectly reconstruct the function.
Personally I was strike by the fact that a finite number of samples can give a perfect interpolation, as one intuitively thinks that the fidelity is proportional to how small the sampling time is.
A: I believe the rectangle function $\Pi(x)$ can be expressed as a nested series of sinusoids as illustrated in formula (1) below where the parameter $f$ is the evaluation frequency and assumed to be a positive integer. When evaluating formula (1) below (and all formulas derived from it) the evaluation limit $N$ must be selected such that $M(N)=0$ where $M(x)$ is the Mertens function. Formula (2) below contains a closed form representation of the two nested sums over $k$ in formula (1) below. Formulas (1) and (2) below are based on this answer I posted to my own question "Does this formula correspond to a series representation of the Dirac delta function $\delta(x)$?" on MathOverflow.

(1) $\quad\Pi(x)=\underset{\underset{M(N)=0}{N,f\to\infty}}{\text{lim}}\frac{1}{\pi}\sum\limits_{n=1}^N\mu(n)\left(\sum\limits_{k=1}^{f\ n}\frac{\cos\left(\frac{2 \pi k}{n}\right) \left(\sin\left(\frac{2 \pi k \left(x+\frac{1}{2}\right)}{n}\right)-\sin\left(\frac{2 \pi k \left(x-\frac{1}{2}\right)}{n}\right)\right)}{k}-\frac{1}{2} \sum\limits_{k=1}^{2\ f\ n} \frac{\sin\left(\frac{\pi k \left(x+\frac{1}{2}\right)}{n}\right)-\sin\left(\frac{\pi k \left(x-\frac{1}{2}\right)}{n}\right)}{k}\right)$
(2) $\quad\Pi(x)=\underset{\underset{M(N)=0}{N\to\infty}}{\text{lim}}\frac{1}{4 \pi i}\sum\limits_{n=1}^N\mu(n)\left(\log\left(1-e^{\frac{i \pi (2 x-3)}{n}}\right)-\log\left(1-e^{\frac{i \pi (2 x-1)}{n}}\right)-\log\left(1-e^{\frac{i \pi (2 x+3)}{n}}\right)+\log\left(1-e^{\frac{i (2 \pi x+\pi )}{n}}\right)+\log\left(1-e^{\frac{i \pi (1-2 x)}{n}}\right)-\log\left(1-e^{\frac{i \pi (3-2 x)}{n}}\right)+\log\left(1-e^{-\frac{i \pi (2 x+3)}{n}}\right)-\log\left(1-e^{-\frac{i (2 \pi x+\pi)}{n}}\right)-\log\left(1-e^{\frac{i \pi (2 x-1)}{2 n}}\right)+\log\left(1-e^{\frac{i \pi (2 x+1)}{2 n}}\right)+\log\left(1-e^{\frac{i \pi (1-2 x)}{2 n}}\right)-\log\left(1-e^{-\frac{i \pi (2 x+1)}{2 n}}\right)\right)$

Figure (1) below illustrates the reference function $\Pi(x)$ in blue and formulas (1) and (2) for $\Pi(x)$ in orange and green respectively where formula (1) is evaluated at $f=8$ and formulas (1) and (2) are both evaluated at $N=39$.


Figure (1): Illustration of formulas (1) and (2) for $\Pi(x)$ (orange and green)

Figure (2) below illustrates the reference function $\Pi(x)$ in blue and formula (2) for $\Pi(x)$ evaluated at $N=39$ and $N=101$ in orange and green respectively.


Figure (2): Illustration of formula (2) for $\Pi(x)$ evaluated at $N=39$ and $N=101$ (orange and green)

Figures (1) and (2) above illustrate formulas (1) and (2) above evaluate at an offset from the reference function $\Pi(x)$, and Figure (2) above illustrates the magnitude of this offset decreases as the magnitude of the evaluation limit $N$ increases. This offset is given by $-\frac{3}{4}\sum\limits_{n=1}^N\frac{\mu(n)}{n}$ which corresponds to $-0.0378622$ at $N=39$ and $-0.0159229$ at $N=101$. Since $-\frac{3}{4}\sum\limits_{n=1}^\infty\frac{\mu(n)}{n}=0$, formulas (1) and (2) above converge to the reference function $\Pi(x)$ as $N\to\infty$ (and as $f\to\infty$ for formula (1)).

Formula (3) below approximates the Fourier transform $\int_{-\infty}^\infty\Pi(x)\ e^{2 i \pi x y}\,dx=\text{sinc}(\pi y)$ with the finite integral $\int_{-X}^X\Pi(x)\ e^{2 i \pi x y}\,dx$ where the finite integral is evaluated using a modified version of formula (1) above which compensates for the offset of formula (1) from the reference function $\Pi(x)$ which was explained in the preceding paragraph. The Fourier transform of formula (1) needs to be evaluated at finite limits because of the idealization of the Fourier transform of the $\sin$ function as a pair of Dirac delta ($\delta$) functions. The offset of formula (1) from the reference function $\Pi(x)$ explained in the preceding paragraph needs to be compensated for in the evaluation to eliminate an oscillation in the result which is otherwise very noticeable at modest values of the evaluation limit $N$.

(3) $\quad\text{sinc}(\pi y)=\underset{\underset{M(N)=0}{X,N,f\to\infty}}{\text{lim}}\sum\limits_{n=1}^N\mu(n)\left(\frac{3 \sin(2 \pi X y)}{4 \pi n y}+\frac{n}{\pi} \left(\sum\limits_{k=1}^{f\ n}\frac{e^{-2 i \pi X y} \sin\left(\frac{\pi k}{n}\right) \cos\left(\frac{2 \pi k}{n}\right) \left(k \left(1+e^{4 i \pi X y}\right) \sin\left(\frac{2 \pi k X}{n}\right)+i n y \left(-1+e^{4 i \pi X y}\right) \cos\left(\frac{2 \pi k X}{n}\right)\right)}{\pi k (k-n y) (k+n y)}-\frac{1}{2}\sum\limits_{k=1}^{2\ f\ n}\frac{4 \sin\left(\frac{\pi k}{2 n}\right) \left(k \cos(2 \pi X y) \sin\left(\frac{\pi k X}{n}\right)-2 n y \sin(2 \pi X y) \cos\left(\frac{\pi k X}{n}\right)\right)}{\pi k \left(k^2-4 n^2 y^2\right)}\right)\right)$

Figure (3) below illustrates formula (3) above evaluated at $X=35$, $N=39$, and $f=8$ in orange overlaid on the reference function $\text{sinc}(\pi y)$ in blue. Note the evaluation of formula (3) in orange is so accurate it pretty much hides the underlying evaluation of the reference function $\text{sinc}(\pi y)$ in blue.


Figure (3): Illustration of formula (3) for $\text{sinc}(\pi y)$ orange
