These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

### Exercise 1: The TEM$_{00}$ Mode: "Line Cuts"
The irradiance $I$ (power per unit area) of a laser oscillating in the TEM$_{00}$ mode can be expressed as
$$
I(x,y) = I_0\exp\Bigg[-{{2(x^2+y^2)}\over{w_0^2}}
\Biggr]
$$
where $I_0$ is the maximum irradiance of the beam and $w_0$ is a parameter that describes the width (i.e., the spatial extent) of the beam. You can show that when $y=0$, the locations $x_{1/2}$ at which $I = I_0/2$ are $x_{1/2} = \pm(0.5\ln{2})^{1/2}w_0 = \pm 0.59w_0$. Show that when $y=0$ and $x = w_0$, the irradiance is $I = I_0\exp(-2) = 0.135$, and show that the above expression for the irradance is equivalent to
$$I(x,y) = I_0\exp\bigg[-2\bigl(\tilde{x}^2+\tilde{y}^2\bigr)
\biggr]
$$
where the "scaled variables" $\tilde{x}$ and $\tilde{y}$ are defined as $\tilde{x}\equiv x/w_0$ and $\tilde{y}\equiv y/w_0$. We can relate this expression to the total power $P_0$ transmitted by the beam:
$$
I(x,y) = {{2P_0}\over{\pi w_0^2}}\exp\bigg[-2\bigl(\tilde{x}^2+\tilde{y}^2\bigr)
\biggr]
$$
(a) Assume $P_0 = 1.0$ mW and $w_0 = 1.0$ mm to generate a line plot of the irradiance $I$ on the vertical axis versus $\tilde{x}$ on the horizontal axis for $-2\leq \tilde{x} \leq 2$ for different values of $\tilde{y}=0.0, 0.2, 0.4, 0.6, 0.8,$ and $1.0$.
(b) Repeat (a) but now plot the irradiance divided by the maximum irradiance for that particular value of $\tilde{y}$ (in other words, plot $I/I_{max,{\tilde{y}}}$) versus $\tilde{x}$ on the horizontal axis. Comment on the resulting plot.
### Exercise 2: The TEM$_{00}$ Mode: A Contour Plot
(a) A filled contour plot is a plot that indicates value by color as a function of two variables. Make a plot of the irradiance versus the variables $x$ and $y$ for $-2w_0 \leq x,y \leq 2w_0$, with $w_0 = 0.5$ mm and $P_0 = 1.0$ mW.
(b) Using the same values for $w_0$ and $P_0$, make a filled contour plot of the scaled irradiance $I(x,y)/(2P_0/\pi w_0^2)$ versus the scaled variables $\tilde{x}$ and $\tilde{y}$ for $-2 \leq \tilde{x},\tilde{y} \leq 2$.
### Exercise 3: The Knife-Edge Profile
You can experimentally determine the value of the parameter $w_0$ that describes the width of the beam by measuring the profile of the laser beam using a knife-edge mounted on a linear translation stage together with an optical detector connected to a power meter. The idea is that you allow the laser beam to enter the detector while you translate the knife-edge across the beam and monitor the power meter reading. Initially, when the beam is not blocked, the reading gives the total power of the beam; finally, the beam is completely blocked from entering the detector by the knife-edge and the reading would be zero (in the absence of background light). A schematic is shown below; we assume the beam is centered on the origin.
![Alt Figure](images/laser_beam_profile/Beam_Profile_by_knife-edge.png "")
Imagine that the knife-edge travels in the $+x$-direction, and that the position of the knife-edge is $x$. Then the power received by the detector is
$$P(x) = {{2P_0}\over{\pi w_0^2}}\int_{-\infty}^{+\infty}dy\int_{x}^{+\infty}\exp\bigg[-2\bigl(\tilde{x}^2+\tilde{y}^2\bigr)\biggr]dx
$$
where $P_0$ is the total power of the laser beam. Show that this expression is equivalent to
$$
P(x) = {{P_0}\over{2}}\Biggl[1 - {\rm erf}\Bigl({{2x}\over{w_0}}\Bigr)\Biggr]
$$
where ${\rm erf}(u) = \int_u^{+\infty}\exp(-t^2)dt$ is the error function. Calculate $P(x)/P_0$ and plot this quantity versus $x$, the position of the knife edge, when $w_0 = 0.5$ mm and for $-3w_0 \leq x \leq 3w_0$.
### Exercise 4: Fit Experimental Data to the Model Knife-Edge Profile
Imagine that you have gone to the lab, set up the experiment to determine the beam profile, and obtained the data shown in the table below. Uncertainties in $x$ are $\Delta x = \pm 0.0001$ in., and the uncertainties in $P(x)/P_0$ are $\pm 0.001$.
$x$ [in.] | $P(x)/P_0$ | $x$ [in.] | $P(x)/P_0$
:-: | :-: | :---: | :--:
-0.0366 | 1.000 | 0.0014 | 0.420
-0.0346 | 1.000 | 0.0034 | 0.315
-0.0326 | 1.000 | 0.0054 | 0.229
-0.0306 | 0.999 | 0.0074 | 0.156
-0.0286 | 0.999 | 0.0094 | 0.105
-0.0266 | 0.998 | 0.0114 | 0.066
-0.0246 | 0.998 | 0.0134 | 0.040
-0.0226 | 0.998 | 0.0154 | 0.025
-0.0206 | 0.995 | 0.0174 | 0.016
-0.0186 | 0.992 | 0.0194 | 0.012
-0.0166 | 0.983 | 0.0214 | 0.010
-0.0146 | 0.968 | 0.0234 | 0.008
-0.0126 | 0.947 | 0.0254 | 0.007
-0.0106 | 0.915 | 0.0274 | 0.007
-0.0086 | 0.870 | 0.0294 | 0.007
-0.0066 | 0.814 | 0.0314 | 0.006
-0.0046 | 0.738 | 0.0334 | 0.006
-0.0026 | 0.638 | 0.0354 | 0.005
-0.0006 | 0.532 | |
On the same graph, plot: the experimental data with error bars: the "guess" function $P(x)/P_0$ with $w_0 = 0.02$ mm; and the fit function.