本文整理汇总了Python中sage.rings.all.QQ.denom方法的典型用法代码示例。如果您正苦于以下问题:Python QQ.denom方法的具体用法?Python QQ.denom怎么用?Python QQ.denom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.all.QQ
的用法示例。
在下文中一共展示了QQ.denom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.rings.all import QQ [as 别名]
# 或者: from sage.rings.all.QQ import denom [as 别名]
#.........这里部分代码省略.........
sage: Cusp(0,0)
Traceback (most recent call last):
...
TypeError: Unable to convert (0, 0) to a Cusp
::
sage: Cusp(oo,oo)
Traceback (most recent call last):
...
TypeError: Unable to convert (+Infinity, +Infinity) to a Cusp
::
sage: Cusp(Cusp(oo),oo)
Traceback (most recent call last):
...
TypeError: Unable to convert (Infinity, +Infinity) to a Cusp
"""
if parent is None:
parent = Cusps
Element.__init__(self, parent)
if not check:
self.__a = a; self.__b = b
return
if b is None:
if isinstance(a, Integer):
self.__a = a
self.__b = ZZ(1)
elif isinstance(a, Rational):
self.__a = a.numer()
self.__b = a.denom()
elif is_InfinityElement(a):
self.__a = ZZ(1)
self.__b = ZZ(0)
elif isinstance(a, Cusp):
self.__a = a.__a
self.__b = a.__b
elif isinstance(a, (int, long)):
self.__a = ZZ(a)
self.__b = ZZ(1)
elif isinstance(a, (tuple, list)):
if len(a) != 2:
raise TypeError, "Unable to convert %s to a Cusp"%a
if ZZ(a[1]) == 0:
self.__a = ZZ(1)
self.__b = ZZ(0)
return
try:
r = QQ((a[0], a[1]))
self.__a = r.numer()
self.__b = r.denom()
except (ValueError, TypeError):
raise TypeError, "Unable to convert %s to a Cusp"%a
else:
try:
r = QQ(a)
self.__a = r.numer()
self.__b = r.denom()
except (ValueError, TypeError):
raise TypeError, "Unable to convert %s to a Cusp"%a
return
if is_InfinityElement(b):