Numpy n 次方根:如何做

要在 numpy 中查找数字或数组 xn 次方根,使用:

numpy_nth_root.py
np.power(x, (1/n))

n 可以是自然数如 4,但也可以是浮点数如 3.26

示例:计算 1.234 的 78 次方根

numpy_nth_root_example.py
>>> import numpy as np
>>> np.power(1.234, (1/78))
1.0026992894299456

Check out similar posts by category: Python