当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python sympy.smoothness()用法及代码示例


借助于sympy.smoothness()方法,我们可以找到给定数字的平滑度和power-smoothness。数字的平滑度是其最大的首要因素,而power-smoothness是其最大的因数提高的因数。

用法:
smoothness(n)

参数:
n - 它表示要计算的平滑度和power-smoothness的数字。


返回值:
返回给定数字的平滑度和power-smoothness元组。

示例1:

# import smoothness() method from sympy 
from sympy.ntheory.factor_ import smoothness 
   
n = 64
   
# Use smoothness() method  
smoothness_n, power_smoothness_n = smoothness(n)  
       
print("The smoothness and power-smoothness of {} is {} and {} respectively". 
      format(n, smoothness_n, power_smoothness_n))

输出:

The smoothness and power-smoothness of 64 is 2 and 64 respectively

示例2:

from sympy.ntheory.factor_ import smoothness 
   
n = 2**4 * 13
   
# Use smoothness() method  
smoothness_n, power_smoothness_n = smoothness(n)  
       
print("The smoothness and power-smoothness of {} is {} and {} respectively". 
      format(n, smoothness_n, power_smoothness_n))

输出:

The smoothness and power-smoothness of 208 is 13 and 16 respectively


相关用法


注:本文由纯净天空筛选整理自rupesh_rao大神的英文原创作品 Python | sympy.smoothness() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。