def cartesian_to_spherical_sympy(X): vacos = numpy.vectorize(sympy.acos) return numpy.stack([ _atan2_0(X), vacos(X[:, 2]) ], axis=1)