本文整理汇总了Python中sage.all.RR.prime_divisors方法的典型用法代码示例。如果您正苦于以下问题:Python RR.prime_divisors方法的具体用法?Python RR.prime_divisors怎么用?Python RR.prime_divisors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.all.RR
的用法示例。
在下文中一共展示了RR.prime_divisors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_sha_tor_primes
# 需要导入模块: from sage.all import RR [as 别名]
# 或者: from sage.all.RR import prime_divisors [as 别名]
def add_sha_tor_primes(N1,N2):
"""
Add the 'sha', 'sha_primes', 'torsion_primes' fields to every
curve in the database whose conductor is between N1 and N2
inclusive.
"""
query = {}
query['conductor'] = { '$gte': int(N1), '$lte': int(N2) }
res = curves.find(query)
res = res.sort([('conductor', pymongo.ASCENDING)])
n = 0
for C in res:
label = C['lmfdb_label']
if n%1000==0: print label
n += 1
torsion = ZZ(C['torsion'])
sha = RR(C['sha_an']).round()
sha_primes = sha.prime_divisors()
torsion_primes = torsion.prime_divisors()
data = {}
data['sha'] = int(sha)
data['sha_primes'] = [int(p) for p in sha_primes]
data['torsion_primes'] = [int(p) for p in torsion_primes]
curves.update({'lmfdb_label': label}, {"$set": data}, upsert=True)