當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。