Some routines for cubic functions and elliptic integrals