本文整理汇总了Python中sage.structure.parent_gens.ParentWithGens.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ParentWithGens.__init__方法的具体用法?Python ParentWithGens.__init__怎么用?Python ParentWithGens.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.structure.parent_gens.ParentWithGens
的用法示例。
在下文中一共展示了ParentWithGens.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, group, base_ring = IntegerRing()):
r""" Create the given group algebra.
INPUT:
-- (Group) group: a generic group.
-- (Ring) base_ring: a commutative ring.
OUTPUT:
-- a GroupAlgebra instance.
EXAMPLES::
sage: from sage.algebras.group_algebra import GroupAlgebra
doctest:1: DeprecationWarning:...
sage: GroupAlgebra(GL(3, GF(7)))
Group algebra of group "General Linear Group of degree 3 over Finite
Field of size 7" over base ring Integer Ring
sage: GroupAlgebra(1)
Traceback (most recent call last):
...
TypeError: "1" is not a group
sage: GroupAlgebra(SU(2, GF(4, 'a')), IntegerModRing(12)).category()
Category of group algebras over Ring of integers modulo 12
"""
if not base_ring.is_commutative():
raise NotImplementedError("Base ring must be commutative")
if not is_Group(group):
raise TypeError('"%s" is not a group' % group)
ParentWithGens.__init__(self, base_ring, category = GroupAlgebras(base_ring))
self._formal_sum_module = FormalSums(base_ring)
self._group = group
示例2: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, coordinate_patch = None):
"""
Construct the algebra of differential forms on a given coordinate patch.
See ``DifferentialForms`` for details.
INPUT::
- ``coordinate_patch`` -- Coordinate patch where the algebra lives.
If no coordinate patch is given, a default coordinate patch with
coordinates (x, y, z) is used.
EXAMPLES::
sage: p, q = var('p, q')
sage: U = CoordinatePatch((p, q)); U
Open subset of R^2 with coordinates p, q
sage: F = DifferentialForms(U); F
Algebra of differential forms in the variables p, q
"""
from sage.categories.graded_algebras_with_basis \
import GradedAlgebrasWithBasis
from sage.structure.parent_gens import ParentWithGens
if not coordinate_patch:
x, y, z = var('x, y, z')
coordinate_patch = CoordinatePatch((x, y, z))
if not isinstance(coordinate_patch, CoordinatePatch):
raise TypeError("%s not a valid Coordinate Patch" % coordinate_patch)
self._patch = coordinate_patch
ParentWithGens.__init__(self, SR, \
category = GradedAlgebrasWithBasis(SR))
示例3: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self):
"""
TEST::
sage: sage.rings.infinity.InfinityRing_class() is sage.rings.infinity.InfinityRing_class() is InfinityRing
True
"""
ParentWithGens.__init__(self, self, names=('oo',), normalize=False)
示例4: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self):
"""
TESTS::
sage: sage.rings.infinity.UnsignedInfinityRing_class() is sage.rings.infinity.UnsignedInfinityRing_class() is UnsignedInfinityRing
True
"""
ParentWithGens.__init__(self, self, names=("oo",), normalize=False)
示例5: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, prec=53):
"""
Initialize ``self``.
EXAMPLES::
sage: ComplexIntervalField()
Complex Interval Field with 53 bits of precision
sage: ComplexIntervalField(200)
Complex Interval Field with 200 bits of precision
"""
self._prec = int(prec)
from sage.categories.fields import Fields
ParentWithGens.__init__(self, self._real_field(), ('I',), False, category = Fields())
示例6: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, prec=53):
"""
TESTS::
sage: C = ComplexField(200)
sage: C.category()
Category of fields
sage: TestSuite(C).run()
"""
self._prec = int(prec)
from sage.categories.fields import Fields
ParentWithGens.__init__(self, self._real_field(), ('I',), False, category = Fields())
# self._populate_coercion_lists_()
self._populate_coercion_lists_(coerce_list=[complex_number.RRtoCC(self._real_field(), self)])
示例7: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, polynomial, names, category=CAT):
"""
Create a function field defined as an extension of another
function field by adjoining a root of a univariate polynomial.
INPUT:
- ``polynomial`` -- a univariate polynomial over a function field
- ``names`` -- variable names (as a tuple of length 1 or string)
- ``category`` -- a category (defaults to category of function fields)
EXAMPLES::
We create an extension of function fields::
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L = K.extension(y^5 - x^3 - 3*x + x*y); L
Function field in y defined by y^5 + x*y - x^3 - 3*x
Note the type::
sage: type(L)
<class 'sage.rings.function_field.function_field.FunctionField_polymod_with_category'>
We can set the variable name, which doesn't have to be y::
sage: L.<w> = K.extension(y^5 - x^3 - 3*x + x*y); L
Function field in w defined by y^5 + x*y - x^3 - 3*x
"""
from sage.rings.polynomial.all import is_Polynomial
if names is None:
names = (polynomial.variable_name(), )
if not is_Polynomial(polynomial):
raise TypeError, "polynomial must be a polynomial"
if polynomial.degree() <= 0:
raise ValueError, "polynomial must have positive degree"
base_field = polynomial.base_ring()
if not isinstance(base_field, FunctionField):
raise TypeError, "polynomial must be over a function"
self._base_field = base_field
self._polynomial = polynomial
ParentWithGens.__init__(self, base_field,
names=names, category = category)
self._hash = hash(polynomial)
self._ring = self._polynomial.parent()
self._populate_coercion_lists_(coerce_list=[base_field, self._ring])
self._gen = self(self._ring.gen())
示例8: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, prec=53):
"""
Initialize ``self``.
TESTS::
sage: C = ComplexField(200)
sage: C.category()
Join of Category of fields and Category of complete metric spaces
sage: TestSuite(C).run()
"""
self._prec = int(prec)
from sage.categories.fields import Fields
ParentWithGens.__init__(self, self._real_field(), ('I',), False, category=Fields().Metric().Complete())
# self._populate_coercion_lists_()
self._populate_coercion_lists_(coerce_list=[RRtoCC(self._real_field(), self)])
示例9: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self):
"""
Initialize ``self``.
TESTS::
sage: sage.rings.infinity.UnsignedInfinityRing_class() is sage.rings.infinity.UnsignedInfinityRing_class() is UnsignedInfinityRing
True
Sage can understand SymPy's complex infinity (:trac:`17493`)::
sage: import sympy
sage: SR(sympy.zoo)
Infinity
"""
ParentWithGens.__init__(self, self, names=('oo',), normalize=False)
示例10: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, coordinate_patch = None):
"""
Construct the algebra of differential forms on a given coordinate patch.
See ``DifferentialForms`` for details.
INPUT:
- ``coordinate_patch`` -- Coordinate patch where the algebra lives.
If no coordinate patch is given, a default coordinate patch with
coordinates (x, y, z) is used.
EXAMPLES::
sage: p, q = var('p, q')
sage: U = CoordinatePatch((p, q)); U
doctest:...: DeprecationWarning: Use Manifold instead.
See http://trac.sagemath.org/24444 for details.
Open subset of R^2 with coordinates p, q
sage: F = DifferentialForms(U); F
doctest:...: DeprecationWarning: For the set of differential forms of
degree p, use U.diff_form_module(p), where U is the base manifold
(type U.diff_form_module? for details).
See http://trac.sagemath.org/24444 for details.
Algebra of differential forms in the variables p, q
"""
from sage.categories.graded_algebras_with_basis \
import GradedAlgebrasWithBasis
from sage.structure.parent_gens import ParentWithGens
from sage.misc.superseded import deprecation
deprecation(24444, 'For the set of differential forms of degree p, ' +
'use U.diff_form_module(p), where U is the base ' +
'manifold (type U.diff_form_module? for details).')
if not coordinate_patch:
x, y, z = var('x, y, z')
coordinate_patch = CoordinatePatch((x, y, z))
if not isinstance(coordinate_patch, CoordinatePatch):
raise TypeError("%s not a valid Coordinate Patch" % coordinate_patch)
self._patch = coordinate_patch
ParentWithGens.__init__(self, SR, \
category = GradedAlgebrasWithBasis(SR))
示例11: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self):
r"""
We create the rational numbers `\QQ`, and call a few functions::
sage: Q = RationalField(); Q
Rational Field
sage: Q.characteristic()
0
sage: Q.is_field()
True
sage: Q.category()
Category of quotient fields
sage: Q.zeta()
-1
We next illustrate arithmetic in `\QQ`.
::
sage: Q('49/7')
7
sage: type(Q('49/7'))
<type 'sage.rings.rational.Rational'>
sage: a = Q('19/374'); b = Q('17/371'); print a, b
19/374 17/371
sage: a + b
13407/138754
sage: b + a
13407/138754
sage: a * b
19/8162
sage: b * a
19/8162
sage: a - b
691/138754
sage: b - a
-691/138754
sage: a / b
7049/6358
sage: b / a
6358/7049
sage: b < a
True
sage: a < b
False
Next finally illustrate arithmetic with automatic coercion. The
types that coerce into the rational field include ``str, int,
long, Integer``.
::
sage: a + Q('17/371')
13407/138754
sage: a * 374
19
sage: 374 * a
19
sage: a/19
1/374
sage: a + 1
393/374
TESTS::
sage: TestSuite(QQ).run()
sage: QQ.variable_name()
'x'
sage: QQ.variable_names()
('x',)
"""
from sage.categories.basic import QuotientFields
ParentWithGens.__init__(self, self, category = QuotientFields())
self._assign_names(('x',),normalize=False) # ???
self._populate_coercion_lists_(element_constructor=rational.Rational, init_no_parent=True)
示例12: __init__
# 需要导入模块: from sage.structure.parent_gens import ParentWithGens [as 别名]
# 或者: from sage.structure.parent_gens.ParentWithGens import __init__ [as 别名]
def __init__(self, prec=53):
self._prec = int(prec)
from sage.categories.fields import Fields
ParentWithGens.__init__(self, self._real_field(), ('I',), False, category = Fields())