Convert ``(r, theta, phi)`` to Cartesian coordinates ``[x y z]``.

    ``r`` - vector length
    ``theta`` - angle above (+) or below (-) the xy-plane
    ``phi`` - angle around the z-axis

    The meaning and order of the three polar parameters 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 calling this function.
    See: https://en.wikipedia.org/wiki/Spherical_coordinate_system

def from_polar(r, theta, phi):
    """Convert ``(r, theta, phi)`` to Cartesian coordinates ``[x y z]``.

    ``r`` - vector length
    ``theta`` - angle above (+) or below (-) the xy-plane
    ``phi`` - angle around the z-axis

    The meaning and order of the three polar parameters 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 calling this function.
    See: https://en.wikipedia.org/wiki/Spherical_coordinate_system

    """
    rxy = r * cos(theta)
    return array((rxy * cos(phi), rxy * sin(phi), r * sin(theta)))