Solution (source code)

= Solution

Use <spectral pulse shaping> of a broadband coherent laser pulse. A <4f pulse shaper> disperses the frequency components with a diffraction grating, maps them to different transverse positions with a lens, applies a programmable complex mask at the Fourier plane, and recombines them with a second lens and grating. A <spatial light modulator> or suitable amplitude-and-phase modulation stages impose the mask.

Compute the desired complex spectral field by <Fourier transform> of the required temporal envelope, including its phase. In the available spectral band, choose
$$
M(\omega)=\frac{\widetilde E_{\rm target}(\omega)}{\widetilde E_{\rm input}(\omega)},\qquad
\widetilde E_{\rm out}(\omega)=M(\omega)\widetilde E_{\rm input}(\omega).
$$
The mask amplitude changes the spectral weights, and its phase changes temporal interference and chirp. \b[Recombining the masked <spectrum> produces the shaped temporal pulse.] A phase-only device needs additional optics to implement independent amplitude control. Calibrate the mask-to-frequency mapping and verify the output pulse experimentally, correcting it iteratively if needed.

The source bandwidth must contain the requested spectral components; a passive mask attenuates rather than supplies missing energy, so an overall rescaling may be needed. Finite spectral resolution determines the accessible time window, and finite bandwidth limits rapid temporal features.