Ticket #3808 (closed defect: invalid)

Opened 5 years ago

Last modified 5 years ago

bug in Hom constructor for finite fields --- more a feature

Reported by: was Owned by: somebody
Priority: minor Milestone: sage-3.1.2
Component: algebra Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description (last modified by was) (diff)

Reported by Nick Alexander. Notice the Set of field embeddings from Finite Field in a of size 7^2 to [6*a + 1] below which is idiotic.

sage: K.<a> = FiniteField(7^2)
sage: a
a
sage: a^7
6*a + 1
sage: K.Hom([a^7])
Set of field embeddings from Finite Field in a of size 7^2 to [6*a + 1]
sage: list(K.Hom([a^7]))
------------------------------------------------------------------------
---
AttributeError                            Traceback (most recent call
last)

/Users/ncalexan/sage-3.0.6/devel/sage-nca/<ipython console> in
<module>()

/Users/ncalexan/sage-3.0.6/local/lib/python2.5/site-packages/sage/
rings/finite_field_morphism.py in __getitem__(self, n)
    169               Defn: a |--> b^9 + b^7 + b^6 + b^5 + b^4]
    170         """
--> 171         return self.list()[n]
    172
    173     def index(self, item):

/Users/ncalexan/sage-3.0.6/local/lib/python2.5/site-packages/sage/
rings/finite_field_morphism.py in list(self)
    139         D = self.domain()
    140         C = self.codomain()
--> 141         if D.characteristic() == C.characteristic() and
Integer(D.degree()).divides(Integer(C.degree())):
    142             f = D.modulus()
    143             g = C['x'](f)

AttributeError: 'list' object has no attribute 'characteristic'

Change History

comment:1 Changed 5 years ago by was

  • Description modified (diff)

comment:2 Changed 5 years ago by was

  • Description modified (diff)

comment:3 Changed 5 years ago by fwclarke

  • Priority changed from major to minor
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from basic arithmetic to algebra
  • Summary changed from bug in Hom constructor for finite fields to bug in Hom constructor for finite fields --- more a feature

I guess what was meant here was

sage: K.<a> = FiniteField(7^2)
sage: K.hom([a^7])

Ring endomorphism of Finite Field in a of size 7^2
  Defn: a |--> 6*a + 1

With 'hom' rather than 'Hom' it works fine. As does

sage: K.Hom(K)
Automorphism group of Finite Field in a of size 7^2
sage: K.Hom(K).list()

[
Ring endomorphism of Finite Field in a of size 7^2
  Defn: a |--> 6*a + 1,
Ring endomorphism of Finite Field in a of size 7^2
  Defn: a |--> a
]

The reported behaviour with K.Hom([a^7]) is much more general; it is the default for creating Homsets: if no specific method exists to construct the Homset, just name it (however meaningless that may be!). Thus

sage: QQ.Hom(5)
Set of Morphisms from Rational Field to 5 in Category of objects

Attempting to list such sets of morphisms leads to an error.

I think this has to be regarded as a feature rather than a bug.

Note: See TracTickets for help on using tickets.