It is recommended that you use the latest versions of Firefox or Chrome to view this page. All interactive code is run on your browser, so the use of Internet Explorer to view this page is not recommended.
This Python-based interactive demo illustrates the effect of modelocking, which means making each mode in the cavity phase-coherent. It plots a graph of the produced temporal intensity distribution of a modelocked or non-modelocked laser.
The output electric field strength is calculated using the following equation from Lecture 16: $$ E(t) = E_0 \sum\limits_{n=0}^{N-1} e^{i(\omega_nt + \phi_n)} $$ where $E_0$ is the electric field amplitude, $N$ is the number of modes in the cavity, $\phi_n$ is the phase of the $n$th cavity mode, and the angular frequency of the $n$th mode is given by $$\omega_n = \omega_p + n\Delta\omega.$$ $\omega_p$ is the offset frequency of the modes from zero detuning; and, as described in the course, modelocking fixes all $\phi_n$ such that they are identical and can thus be arbitrarily set to zero. The intensity $I(t)$ (plotted on the y-axis) is the square modulus of $E(t)$.
Additional equations from the course that are used in the code:
$$ \Delta\omega = \omega_n - \omega_{n-1} = 2{\pi}\left({c\over{2L_c}}\right) $$ $\Delta\omega$ is the free spectral range, $c$ is the speed of light and $L_c$ is the length of the cavity.
Round Trip Time: $ T = 2L_c / c$. The x-axis is in units of the round-trip time to illustrate the fact that when modelocking the peaks occur at multiples of $T$. For the purposes of this code, the cavity length and offset are kept constant at $L$ = 0.5 m and $\omega_p$ = 0 rad s$^{-1}$.
Below, you can vary the number of modes $N$ that are in the laser cavity using the slider. You can also change whether the laser is modelocked or not using the toggle button (Each value of $\phi_n$ is randomly chosen when not modelocking and all are set to zero when modelocking). Notice that the peak intensity of the modelocked distribution should be approximately $N$ times greater than the mean intensity of an equivalent non-modelocked distribution, and also that the mean intensity is unaffected by locking the phases. You can also zoom in to see the intermediate peaks.