code: def to_polar(xyz):
      
      r = length_of(xyz)
      x, y, z = xyz
      theta = arcsin(z / r)
      phi = arctan2(y, x) % tau
      return r, theta, phi
docs: Convert ``[x y z]`` into spherical coordinates ``(r, theta, phi)``.
  
      ``r`` - vector length
      ``theta`` - angle above (+) or below (-) the xy-plane
      ``phi`` - angle around the z-axis
  
      The meaning and order of the three return values is designed to
      match both ISO 31-11 and the traditional order used by physicists.
      Mathematicians usually define ``theta`` and ``phi`` the other way
      around, and may need to use caution when using the return values.
      See: https://en.wikipedia.org/wiki/Spherical_coordinate_system