Opened 10 years ago

Closed 9 years ago

#13766 closed defect (duplicate)

No conversion from unit group to number field.

Reported by: Maarten Derickx Owned by: David Loeffler
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: number fields Keywords:
Cc: Marco Streng Merged in:
Authors: Reviewers: Marco Streng, Maarten Derickx
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Marco Streng)

* already fixed by #13687, apply no patches *

Currently we have:

sage: L.<a>=CyclotomicField(7)
sage: a in L.unit_group()
False

This is because:

sage: a1=L.unit_group()(a)
sage: L(a1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/maarten/Dropbox/Artikelen/MazurKamiennyDerickx/tex/<ipython console> in <module>()

/Applications/sage/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6820)()

/Applications/sage/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3254)()

/Applications/sage/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3157)()

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.pyc in _element_constructor_(self, x)
   6974             return self._coerce_from_str(x)
   6975         else:
-> 6976             return self._coerce_non_number_field_element_in(x)
   6977 
   6978     # TODO:

/Applications/sage/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.pyc in _coerce_non_number_field_element_in(self, x)
   5064         except (TypeError, AttributeError), msg:
   5065             pass
-> 5066         raise TypeError, type(x)
   5067 
   5068     def _coerce_from_str(self, x):

TypeError: <class 'sage.groups.abelian_gps.abelian_group_element.AbelianGroupElement'>

* already fixed by #13687, apply no patches *

Attachments (1)

trac13766_unit_group_conversion.patch (1.7 KB) - added by Maarten Derickx 9 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by Maarten Derickx

Component: PLEASE CHANGEnumber fields
Owner: changed from tbd to David Loeffler
Type: PLEASE CHANGEdefect

comment:2 Changed 10 years ago by Maarten Derickx

Cc: Marco Streng added

comment:3 Changed 10 years ago by Maarten Derickx

Summary: no conversion from unit group to number fieldNo conversion from unit group to number field.

comment:4 Changed 9 years ago by Robert Harron

This works for me in sage 5.8. This ticket should be closed.

comment:5 Changed 9 years ago by Maarten Derickx

Status: newneeds_review

Indeed, I can confirm that it works now. I added a patch that contains a doctest in order to make sure this doesn't break in the future.

Changed 9 years ago by Maarten Derickx

comment:6 Changed 9 years ago by Marco Streng

is there no such doctest in the patch that fixed this?

comment:7 Changed 9 years ago by Maarten Derickx

Well, I have no idea wich ticket fixed this. And I couldn't find a doctest which tests this somewhere.

comment:8 in reply to:  7 Changed 9 years ago by Marco Streng

Replying to mderickx:

Well, I have no idea wich ticket fixed this.

#13687

And I couldn't find a doctest which tests this somewhere.

Coercion from the abstract unit group to the number field is tested by #13687.

sage: UK.gen(0) + K.one()   # coerce abstract generator into number field

Conversion the other way around already had a test.

sage: [UK(u) for u in (x^4-1).roots(K,multiplicities=False)]

The coercion framework will then make sure that "in" also works correctly. I don't think another test is necessary.

Enhancing the documentation by explaining that "in" works in this case is nice, but then make sure the English grammar is correct in the patch as well. And there are issues like the fact that u0^6 may depend on the pari version, since any even exponent is correct, so this test will break later.

I propose to just close this ticket as duplicate instead :)

comment:9 Changed 9 years ago by Maarten Derickx

Milestone: sage-5.9sage-duplicate/invalid/wontfix
Status: needs_reviewpositive_review

comment:10 Changed 9 years ago by Maarten Derickx

Ok, I changed it to duplicate/invalid/wontfix and gave it positive review status so that Jeroen can close this.

comment:11 Changed 9 years ago by Marco Streng

Description: modified (diff)

(just making it a bit clearer/easier for Jeroen)

comment:12 in reply to:  11 Changed 9 years ago by Jeroen Demeyer

Resolution: duplicate
Reviewers: Marco Streng, Maarten Derickx
Status: positive_reviewclosed

Replying to mstreng:

(just making it a bit clearer/easier for Jeroen)

Absolutely, thanks!

Note: See TracTickets for help on using tickets.