本文整理匯總了Python中sage.all.RR.round方法的典型用法代碼示例。如果您正苦於以下問題:Python RR.round方法的具體用法?Python RR.round怎麽用?Python RR.round使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sage.all.RR
的用法示例。
在下文中一共展示了RR.round方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: allbsd
# 需要導入模塊: from sage.all import RR [as 別名]
# 或者: from sage.all.RR import round [as 別名]
def allbsd(line):
r""" Parses one line from an allbsd file. Returns the label and a
dict containing fields with keys 'conductor', 'iso', 'number',
'ainvs', 'rank', 'torsion', 'torsion_primes', 'tamagawa_product',
'real_period', 'special_value', 'regulator', 'sha_an', 'sha',
'sha_primes', all values being strings or floats or ints or lists
of ints.
Input line fields:
conductor iso number ainvs rank torsion tamagawa_product real_period special_value regulator sha_an
Sample input line:
11 a 1 [0,-1,1,-10,-20] 0 5 5 1.2692093042795534217 0.25384186085591068434 1 1.00000000000000000000
"""
data = split(line)
label = data[0] + data[1] + data[2]
ainvs = parse_ainvs(data[3])
torsion = ZZ(data[5])
sha_an = RR(data[10])
sha = sha_an.round()
sha_primes = sha.prime_divisors()
torsion_primes = torsion.prime_divisors()
data = {
'conductor': int(data[0]),
'iso': data[0] + data[1],
'number': int(data[2]),
'ainvs': ainvs,
'rank': int(data[4]),
'tamagawa_product': int(data[6]),
'real_period': float(data[7]),
'special_value': float(data[8]),
'regulator': float(data[9]),
'sha_an': float(sha_an),
'sha': int(sha),
'sha_primes': [int(p) for p in sha_primes],
'torsion': int(torsion),
'torsion_primes': [int(p) for p in torsion_primes]
}
return label, data