本文整理匯總了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)