Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
more on names/gens
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Aug 28, 2015
1 parent f54e588 commit 92861ed
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/sage/rings/asymptotic/asymptotic_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,12 +1220,19 @@ def __classcall__(cls, growth_group, coefficient_ring, names=None,
::
sage: A.<a,b> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
sage: A.<x, y> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ); A
Asymptotic Ring <x^ZZ * y^ZZ> over Integer Ring
sage: A.<y, x> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
Traceback (most recent call last):
...
ValueError: Names 'y', 'x' do not coincide with
generators 'x', 'y' of Growth Group x^ZZ * y^ZZ.
sage: A.<a, b> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
Traceback (most recent call last):
...
ValueError: Names 'a', 'b' do not coincide with
generators 'x', 'y' of Growth Group x^ZZ * y^ZZ.
sage: A.<x,b> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
sage: A.<x, b> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
Traceback (most recent call last):
...
ValueError: Names 'x', 'b' do not coincide with
Expand All @@ -1235,7 +1242,7 @@ def __classcall__(cls, growth_group, coefficient_ring, names=None,
...
ValueError: Name 'x' do not coincide with
generators 'x', 'y' of Growth Group x^ZZ * y^ZZ.
sage: A.<x,y,z> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
sage: A.<x, y, z> = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ)
Traceback (most recent call last):
...
ValueError: Names 'x', 'y', 'z' do not coincide with
Expand All @@ -1245,15 +1252,15 @@ def __classcall__(cls, growth_group, coefficient_ring, names=None,
from sage.rings.asymptotic.growth_group import GrowthGroup
growth_group = GrowthGroup(growth_group)

strgens = list(str(g) for g in growth_group.gens_monomial())
strgens = tuple(str(g) for g in growth_group.gens_monomial())
def format_names(N):
return ('s ' if len(N) != 1 else ' ') + ', '.join("'%s'" % n for n in N)
if names and not strgens:
raise ValueError('%s does not privide any generators but name%s given.' %
(growth_group, format_names(names)))
elif names is not None and len(names) == 1 and len(strgens) == 1:
pass
elif names is not None and sorted(names) != strgens:
elif names is not None and names != strgens:
raise ValueError('Name%s do not coincide with generator%s of %s.' %
(format_names(names), format_names(strgens), growth_group))

Expand Down

0 comments on commit 92861ed

Please sign in to comment.