借助於sympy.core()方法,我們可以計算出一個正整數ñ。核心(n,t)計算t-th無電源部分ñ。
如果ñ主要的分解是:

然後

用法: core(n, t=2)
參數:
n - 它表示一個整數。
t - 它表示一個整數(可選)。 t的默認值為2。
返回:返回n的t-th無功率部分。
範例1:
# import core() method from sympy
from sympy.ntheory.factor_ import core
n = 24
k = 2
# Use core() method
core_n_k = core(n, k)
print("core({}, {}) = {} ".format(n, k, core_n_k))
輸出:
core(24, 2) = 6
範例2:
# import core() method from sympy
from sympy.ntheory.factor_ import core
n = 11**4
k = 3
# Use core() method
core_n_k = core(n, k)
print("core({}, {}) = {} ".format(n, k, core_n_k))
輸出:
core(14641, 3) = 11
相關用法
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python Decimal max()用法及代碼示例
- Python PIL ImageOps.fit()用法及代碼示例
- Python os.rmdir()用法及代碼示例
- Python sympy.det()用法及代碼示例
- Python Decimal min()用法及代碼示例
- Python os.readlink()用法及代碼示例
- Python os.writev()用法及代碼示例
- Python os.readv()用法及代碼示例
- Python PIL RankFilter()用法及代碼示例
- Python os.rename()用法及代碼示例
- Python os.sendfile()用法及代碼示例
注:本文由純淨天空篩選整理自rupesh_rao大神的英文原創作品 Python | sympy.core() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。