Angles live on a circle, so the ordinary average of their numerical values depends on where you put the zero. Treat each angle as a unit vector instead, average the vectors, and read off the direction θ̄ and length r̄ of the result: these do not depend on the origin, and they are exactly the maximum likelihood estimates of the von Mises distribution p(θ) ∝ exp{m cos(θ − θ₀)}, with m found from A(m) = r̄.
Samples use a seeded generator and the Best and Fisher (1979) rejection sampler, the same numbers as the Python code; the Bessel functions are computed by the trapezoidal rule, which is exact to rounding for periodic integrands like (3.130).
code/ch03_standard_distributions.py (circular_mean, vonmises_pdf, bessel_ratio, inverse_bessel_ratio, vonmises_ml, vonmises_sample; Figures 3.9 to 3.12).