This simple example shows how one can use Finesse to compute quantities like the stability of a Fabry-Perot cavity whilst scanning over the cavity length but keeping the waist size fixed at the input mirror. The image below shows the set-up used here.

For a waist-size of 8 mm and beam wavelength of 1550 nm, we can use

to compute the Rayleigh range of the beam. In this case, we get,

```
l L0 1 0 n0
s s0 0 n0 nITM1
m ITM 0.99 0.01 0 nITM1 nITM2
s scav 1 nITM2 nETM1
m ETM 0.99 0.01 0 nETM1 nETM2
# Set initial ETM RoC to Rc2 = 1 + zr**2
attr ETM Rcx 16901
attr ETM Rcy 16901
cav FP ITM nITM2 ETM nETM1
# detect the stability (m-factor) of the cavity
cp FP x stability
xaxis scav L lin 0.01 2000 1000
# Compute ETM RoC to keep w0 = 8mm at ITM
func Rc2 = $x1 * (1 + ($zr / $x1)^2)
put ETM Rcx $Rc2
put ETM Rcy $Rc2
const zr 130
lambda 1550n
noplot Rc2
pyterm pdf
```

As you can see from the plot produced, the cavity is near-unstable when the length of the cavity is either much less or much greater than the Rayleigh range of the beam. Note that the value of the stability here is the quantity m which is given by,

where A and D are the corresponding elements of the cavity round-trip ABCD matrix. A cavity is only stable when,

The function Rc2 used in the Finesse code block above was derived as follows. The waist size for an asymmetric cavity in general can be defined as,

where L is the cavity length and,

are the singular-stability factors of the two cavity mirrors. For a configuration where the waist is at the input mirror (i.e. flat input mirror) we have g1 = 1 and so w0 simplifies to

Re-arranging for Rc2 gives,