title: Adaptive-additive algorithm
text: # Adaptive-additive algorithm
  
  In the studies of Fourier optics, sound synthesis, stellar interferometry, optical tweezers, and diffractive optical elements (DOEs) it is often important to know the spatial frequency phase of an observed wave source. In order to reconstruct this phase the Adaptive-Additive Algorithm (or AA algorithm), which derives from a group of adaptive (input-output) algorithms, can be used. The AA algorithm is an iterative algorithm that utilizes the Fourier Transform to calculate an unknown part of a propagating wave, normally the spatial frequency phase (k space). This can be done when given the phase’s known counterparts, usually an observed amplitude (position space) and an assumed starting amplitude (k space). To find the correct phase the algorithm uses error conversion, or the error between the desired and the theoretical intensities.
  
  ## The algorithm
  
  ### History
  
  The adaptive-additive algorithm was originally created to reconstruct the spatial frequency phase of light intensity in the study of stellar interferometry. Since then, the AA algorithm has been adapted to work in the fields of Fourier Optics by Soifer and Dr. Hill, soft matter and optical tweezers by Dr. Grier, and sound synthesis by Röbel.
  
  ### Algorithm
  
  * Define input amplitude and random phase
  * Forward Fourier Transform
  * Separate transformed amplitude and phase
  * Compare transformed amplitude/intensity to desired output amplitude/intensity
  * Check convergence conditions
  * Mix transformed amplitude with desired output amplitude and combine with transformed phase
  * Inverse Fourier Transform
  * Separate new amplitude and new phase
  * Combine new phase with original input amplitude
  * Loop back to Forward Fourier Transform
  
  ### Example
  
  For the problem of reconstructing the spatial frequency phase (k-space) for a desired intensity in the image plane (x-space). Assume the amplitude and the starting phase of the wave in k-space is $A_{0}$ and $\phi _{n}^{k}$ respectively. Fourier transform the wave in k-space to x space.
  
      $A_{0}e^{i\phi _{n}^{k}}{\xrightarrow {FFT}}A_{n}^{f}e^{i\phi _{n}^{f}}$
  
  Then compare the transformed intensity $I_{n}^{f}$ with the desired intensity $I_{0}^{f}$, where
  
      $I_{n}^{f}=\left(A_{n}^{f}\right)^{2},$
      $\varepsilon ={\sqrt {\left(I_{n}^{f}\right)^{2}-\left(I_{0}\right)^{2}}}.$
  
  Check $\varepsilon$ against the convergence requirements. If the requirements are not met then mix the transformed amplitude $A_{n}^{f}$ with desired amplitude $A^{f}$.
  
      ${\bar {A}}_{n}^{f}=\left[aA^{f}+(1-a)A_{n}^{f}\right],$
  
  where a is mixing ratio and
  
      $A^{f}={\sqrt {I_{0}}}$.
  
  Note that a is a percentage, defined on the interval 0 ≤ a ≤ 1.
  
  Combine mixed amplitude with the x-space phase and inverse Fourier transform.
  
      ${\bar {A}}^{f}e^{i\phi _{n}^{f}}{\xrightarrow {iFFT}}{\bar {A}}_{n}^{k}e^{i\phi _{n}^{k}}.$
  
  Separate ${\bar {A}}_{n}^{k}$ and $\phi _{n}^{k}$ and combine $A_{0}$ with $\phi _{n}^{k}$. Increase loop by one $n\to n+1$ and repeat.
  
  **Limits**
  
  * If $a=1$ then the AA algorithm becomes the Gerchberg–Saxton algorithm.
  * If $a=0$ then ${\bar {A}}_{n}^{k}=A_{0}$.
  