# How to choose phase to give a desired Fourier transform

Cross posted from MSE.

I have a mathematical problem arising from a physics application, which I feel must have been solved before, but I don't know the terminology associated with it. I am looking for references. Briefly, the problem is this:

Given an input function $$f$$ and a desired output function $$g$$, find a real-valued function $$\phi$$ such that the modulus of the Fourier transform $$\left|\mathcal{F}\left\{fe^{i\phi}\right\}\right|$$ is as close as possible to $$|g|$$ (with respect to some norm--say $$L^2$$).

(In my particular case, all functions are defined on a compact subset of $$\mathbb{R}^2$$, in case it matters.)

In practice, the input function $$f$$ is an electric field, the phase function $$\phi$$ is provided by a "spatial light modulator", and the magnitude of the Fourier transform gives the output intensity of a light field, which you want to have a specified form.

I'm interested in both abstract results and algorithmic solutions to this problem.

• Is $\phi$ completely arbitrary? If so, then you can just choose $\phi := -i\log( \mathcal{F}^{-1}(g) / f)$ and have exact equality in some cases. And if $f$ has zeros, you can approximate $f$ arbitrarily close by some (say Schwartz) function without zeros. – Johannes Hahn Feb 7 at 21:40
• @JohannesHahn: I don't think you can get close usually: the $L^2$ norm of $fe^{i\phi}$ is independent of $\phi$, so if this isn't close to the norm of $g$ to start with, then there's nothing you can do. – Christian Remling Feb 7 at 22:52
• @JohannesHahn $\phi$ is real (a pure phase), which I believe precludes an exact solution in general. I've edited this into the problem statement for clarity. – Yly Feb 8 at 1:58
• Given $f,G \in L^2$ you want to find $e^{i \phi},e^{i \varphi}$ minimizing $\| fe^{i \phi}-\mathcal{F}^{-1}[G e^{i \varphi}]\|^2$, so that $\varphi = arg( \mathcal{F}[e^{i \phi}f])-arg(G)$. You can then look at $\partial_t \| \mathcal{F}[fe^{i (\phi+t\psi)}]-G e^{i arg(\mathcal{F}[e^{i (\phi+t \psi)}f])-arg(G)}\|^2]|_{t= 0}$ – reuns Feb 8 at 8:50