python – n球面坐标系到笛卡尔坐标系

python – n球面坐标系到笛卡尔坐标系

有没有有效的方法在笛卡尔坐标系和 n-spherical one之间进行切换?转型如下: 以下是我的代码,但我想摆脱循环: import numpy as npimport scipy.sparse def coord_transform_n(r,alpha): alpha: the n-2 values between [0,pi) and last one