Opened 6 years ago

Closed 5 years ago

#22208 closed enhancement (fixed)

Conversion from SR to number fields

Reported by: Karl-Dieter Crisman Owned by:
Priority: minor Milestone: sage-8.0
Component: number fields Keywords:
Cc: Samuel Lelièvre Merged in:
Authors: Jeroen Demeyer Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: beed700 (Commits, GitHub, GitLab) Commit: beed7001cf8f8b2a18b77b591e05334c2ec9a91e
Dependencies: Stopgaps:

Status badges

Description (last modified by Jeroen Demeyer)

I'm not sure if this is kosher, but I would like

sage: G = GaussianIntegers()
sage: G(2+I)

to "just work".

Change History (23)

comment:1 Changed 6 years ago by Ralf Stephan

Looks like a conversion as in symbolic/expression_conversions.py should do the trick.

comment:2 Changed 6 years ago by Nils Bruin

This could help: #18036

comment:3 in reply to:  2 Changed 6 years ago by Karl-Dieter Crisman

This could help: #18036

Haha, I was sure that one had been merged by others long ago! I'll at least put a xref to this one there.

comment:4 Changed 6 years ago by Jeroen Demeyer

Milestone: sage-7.6sage-duplicate/invalid/wontfix
Resolution: duplicate
Status: newclosed

comment:5 Changed 6 years ago by Samuel Lelièvre

Cc: Samuel Lelièvre added

Note that the following also works (in Sage 7.5.1).

sage: G = GaussianIntegers()
sage: G('2 + I')
I + 2

comment:6 Changed 5 years ago by Jeroen Demeyer

Description: modified (diff)
Resolution: duplicate
Status: closednew
Summary: Allow immediate coercion from SR to Gaussian?Conversion from SR to number fields

comment:7 Changed 5 years ago by Jeroen Demeyer

I'm reopening this because there are two ways to interpret this ticket:

  1. Allow G(2 + I) to just work, using the symbol I.
  1. Allow G(expr) to work, where expr is some symbolic expression representing a Gaussian integer.

Only the first one would be fixed by #18036.

Version 0, edited 5 years ago by Jeroen Demeyer (next)

comment:8 Changed 5 years ago by Jeroen Demeyer

Authors: Jeroen Demeyer
Milestone: sage-duplicate/invalid/wontfixsage-8.0

comment:9 Changed 5 years ago by Jeroen Demeyer

Branch: u/jdemeyer/conversion_from_sr_to_number_fields

comment:10 Changed 5 years ago by Jeroen Demeyer

Commit: 0128efca77e3faf7cd18749ad49f610958008021
Status: newneeds_review

New commits:

0128efcConversion from AA, QQbar and SR to number fields

comment:11 Changed 5 years ago by Ralf Stephan

Can you be more specific than except Exception?

comment:12 Changed 5 years ago by Jeroen Demeyer

I'll try to just drop the except Exception completely.

comment:13 Changed 5 years ago by git

Commit: 0128efca77e3faf7cd18749ad49f61095800802147845a424847db5ef208298d4e7fdbd84c695b03

Branch pushed to git repo; I updated commit sha1. New commits:

47845a4Further fixes to conversion of non-number-field elements

comment:14 Changed 5 years ago by Jeroen Demeyer

In the end, I did some more refactoring, including removing some duplicate code.

comment:15 Changed 5 years ago by Ralf Stephan

Sorry, to much algebra, cannot review.

comment:16 in reply to:  15 Changed 5 years ago by Karl-Dieter Crisman

Sorry, to much algebra, cannot review.

Most of the algebra is just cutting and pasting some examples, though, so those wouldn't need explicit review ...

comment:17 Changed 5 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw

I double-checked, and the algebra LGTM. I do have one minor docstring fix:

         """
-        Convert a non-number field element x into this number field.
+        Convert a non-number field element ``x`` into this number field.
 
         INPUT:
 
-        - ``x`` -- a non number field element x, e.g., a list, integer,
-          rational, or polynomial.
+        - ``x`` -- a non number field element, e.g., a list, integer,
+          rational, or polynomial

Once that is done, you can set a positive review on my behalf.

comment:18 Changed 5 years ago by git

Commit: 47845a424847db5ef208298d4e7fdbd84c695b034a3e6386daf2ea7c691810cab70373339f5c161d

Branch pushed to git repo; I updated commit sha1. New commits:

4a3e638Minor doc fix

comment:19 Changed 5 years ago by Jeroen Demeyer

Status: needs_reviewpositive_review

comment:20 Changed 5 years ago by Volker Braun

Status: positive_reviewneeds_work

Merge conflict

comment:21 Changed 5 years ago by git

Commit: 4a3e6386daf2ea7c691810cab70373339f5c161dbeed7001cf8f8b2a18b77b591e05334c2ec9a91e

Branch pushed to git repo; I updated commit sha1. New commits:

beed700Merge tag '8.1.beta0' into t/22208/conversion_from_sr_to_number_fields

comment:22 Changed 5 years ago by Jeroen Demeyer

Status: needs_workpositive_review

comment:23 Changed 5 years ago by Volker Braun

Branch: u/jdemeyer/conversion_from_sr_to_number_fieldsbeed7001cf8f8b2a18b77b591e05334c2ec9a91e
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.