  The $M_2$ variables are devised to extend $M_{T2}$ by promoting transverse
masses to Lorentz-invariant ones and making explicit use of on-shell mass
relations. Unlike simple kinematic variables such as the invariant mass of
visible particles, where the variable definitions directly provide how to
calculate them, the calculation of the $M_2$ variables is undertaken by
employing numerical algorithms. Essentially, the calculation of $M_2$
corresponds to solving a constrained minimization problem in mathematical
optimization, and various numerical methods exist for the task. We find that
the sequential quadratic programming method performs very well for the
calculation of $M_2$, and its numerical performance is even better than the
method implemented in the existing software package for $M_2$. As a consequence
of our study, we have developed and released yet another software library,
YAM2, for calculating the $M_2$ variables using several numerical algorithms.
