借助sympy.integer_nthroot()方法,我们可以找到作为参数传递的数字的第n个根sympy.integer_nthroot()方法。它将返回一个具有两个值的元组,一个为root,另一个为boolean值,这表明该根是否完美。
用法:sympy.integer_nthroot(val)
返回:Return a tuple having root and boolean value.
范例1:
在这个例子中,我们可以通过使用integer_nthroot()方法,我们可以找到作为参数传递的数字的第n个根。
# import sympy 
from sympy import *
  
# Using sympy.integer_nthroot() method 
gfg = integer_nthroot(25, 2) 
  
print(gfg)输出:
(5, True)
范例2:
# import sympy 
from sympy import *
  
# Using sympy.integer_nthroot() method 
gfg = integer_nthroot(80, 3) 
  
print(gfg)输出:
(4, False)
相关用法
- Python os.dup()用法及代码示例
 - Python set()用法及代码示例
 - Python next()用法及代码示例
 - Python os.get_blocking()用法及代码示例
 - Python sympy.apart()用法及代码示例
 - Python sympy.nC()用法及代码示例
 - Python os.set_blocking()用法及代码示例
 - Python os.getcwd()用法及代码示例
 - Python os.access()用法及代码示例
 - Python dict pop()用法及代码示例
 - Python sympy.Add()用法及代码示例
 - Python sympy.nP()用法及代码示例
 
注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Python | sympy.integer_nthroot() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
