本文整理汇总了Python中sage.structure.element.RingElement.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python RingElement.__init__方法的具体用法?Python RingElement.__init__怎么用?Python RingElement.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.structure.element.RingElement
的用法示例。
在下文中一共展示了RingElement.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, parent, degree, fun = None):
r"""
Construct a differential form.
INPUT:
- ``parent`` -- Parent algebra of differential forms.
- ``degree`` -- Degree of the differential form.
- ``fun`` (default: None) -- Initialize this differential form with the given function. If the degree is not zero, this argument is silently ignored.
EXAMPLES::
sage: x, y, z = var('x, y, z')
sage: F = DifferentialForms(); F
Algebra of differential forms in the variables x, y, z
sage: f = DifferentialForm(F, 0, sin(z)); f
sin(z)
"""
from sage.tensor.differential_forms import DifferentialForms
if not isinstance(parent, DifferentialForms):
raise TypeError("Parent not an algebra of differential forms.")
RingElement.__init__(self, parent)
self._degree = degree
self._components = {}
if degree == 0 and fun is not None:
self.__setitem__([], fun)
示例2: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, parent, value, is_name=False, name=None):
RingElement.__init__(self, parent)
self._create = value
if parent is None: return # means "invalid element"
# idea: Joe Wetherell -- try to find out if the output
# is too long and if so get it using file, otherwise
# don't.
if isinstance(value, basestring) and parent._eval_using_file_cutoff and \
parent._eval_using_file_cutoff < len(value):
self._get_using_file = True
if is_name:
self._name = value
else:
try:
self._name = parent._create(value, name=name)
# Convert ValueError and RuntimeError to TypeError for
# coercion to work properly.
except (RuntimeError, ValueError) as x:
self._session_number = -1
raise TypeError, x, sys.exc_info()[2]
except BaseException:
self._session_number = -1
raise
self._session_number = parent._session_number
示例3: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, parent=UnsignedInfinityRing):
"""
Initialize ``self``.
EXAMPLES::
sage: sage.rings.infinity.LessThanInfinity() is UnsignedInfinityRing(5)
True
"""
RingElement.__init__(self, parent)
示例4: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, parent, value, is_name=False, name=None):
RingElement.__init__(self, parent)
self._create = value
if parent is None: return # means "invalid element"
# idea: Joe Wetherell -- try to find out if the output
# is too long and if so get it using file, otherwise
# don't.
if is_name:
self._name = value
else:
try:
self._name = parent._create(value, name=name)
except (TypeError, KeyboardInterrupt, RuntimeError, ValueError), x:
raise TypeError, x
示例5: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, x, parent=None):
"""
EXAMPLES:
sage: R = PariRing()
sage: f = R('x^3 + 1/2')
sage: f
x^3 + 1/2
sage: type(f)
<class 'sage.rings.pari_ring.PariRing_with_category.element_class'>
sage: loads(f.dumps()) == f
True
"""
if parent is None:
parent = _inst
RingElement.__init__(self, parent)
self.__x = pari.pari(x)
示例6: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, parent, rep, reduce=True):
"""
An element of a quotient ring `R/I`. See
``QuotientRingElement`` for full documentation.
EXAMPLES::
sage: R.<x> = PolynomialRing(ZZ)
sage: S.<xbar> = R.quo((4 + 3*x + x^2, 1 + x^2)); S
Quotient of Univariate Polynomial Ring in x over Integer Ring by the ideal (x^2 + 3*x + 4, x^2 + 1)
sage: v = S.gens(); v
(xbar,)
"""
RingElement.__init__(self, parent)
self.__rep = rep
if reduce:
self._reduce_()
示例7: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self, parent, value, is_name=False, name=None):
RingElement.__init__(self, parent)
self._create = value
if parent is None: return # means "invalid element"
# idea: Joe Wetherell -- try to find out if the output
# is too long and if so get it using file, otherwise
# don't.
if isinstance(value, basestring) and parent._eval_using_file_cutoff and \
parent._eval_using_file_cutoff < len(value):
self._get_using_file = True
if is_name:
self._name = value
else:
try:
self._name = parent._create(value, name=name)
except (TypeError, KeyboardInterrupt, RuntimeError, ValueError), x:
self._session_number = -1
raise TypeError, x
示例8: __init__
# 需要导入模块: from sage.structure.element import RingElement [as 别名]
# 或者: from sage.structure.element.RingElement import __init__ [as 别名]
def __init__(self,parent,x,val=0,normalized=False):
RingElement.__init__(self,parent)
Approximation.__init__(self,parent)
self._x = QQ(x)
self._val = val
self._normalized = normalized