当前位置: 首页>>代码示例>>Python>>正文


Python RingElement.__init__方法代码示例

本文整理汇总了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)
开发者ID:Findstat,项目名称:sage,代码行数:35,代码来源:differential_form_element.py

示例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
开发者ID:Etn40ff,项目名称:sage,代码行数:27,代码来源:expect.py

示例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)
开发者ID:ProgVal,项目名称:sage,代码行数:12,代码来源:infinity.py

示例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
开发者ID:bgxcpku,项目名称:sagelib,代码行数:17,代码来源:interface.py

示例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)
开发者ID:Findstat,项目名称:sage,代码行数:18,代码来源:pari_ring.py

示例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_()
开发者ID:Findstat,项目名称:sage,代码行数:19,代码来源:quotient_ring_element.py

示例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
开发者ID:williamstein,项目名称:sagelib,代码行数:21,代码来源:expect.py

示例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
开发者ID:roed314,项目名称:padicprec,代码行数:8,代码来源:approximation.py


注:本文中的sage.structure.element.RingElement.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。