Numpy nth root: How to

To find the nth root of number or array x in numpy use:

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

n can be a natural number like 4 but it can also be a floating point number like 3.26.

Example: Compute the 78th root of 1.234

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

Check out similar posts by category: Python