-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repr of NumberFields (the parents) should indicate its embedding if there is one #21161
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
Shorter sentence would be better.
Ideally (as above), the |
comment:3
Or possibly
|
comment:4
|
comment:5
Replying to @mkoeppe:
Which is not that bad except the |
comment:7
This should work for number fields with a real embedding as well as a complex one. The interval notation is painful for the latter, so "with a=..." would probably work better. Also good if we end up with number fields with a p-adic embedding specified:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:11
In this patch I am using a format with
and for more complicated situations such as this one:
The output for the following looks a bit strange because printing goes through
Should we special case this? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Author: Matthias Koeppe |
comment:14
The patchbot gave 2 pyflakes warnings, I repaired one of them, the other one I can not make sure that it does not have side effects. Otherwise, the patchbot is happy and the resolution looks reasonable. I set it as positive review, if you agree @mkoeppe. New commits:
|
Reviewer: Jean-Philippe Labbé |
comment:15
Whoooops! |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:26
Fixed these two. |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:32
There are only 6 failing doctests. That's not bad!
|
comment:35
Looks good to me. The tests seem to pass on the latest beta and the pyflakes errors are not regressions. I set this to positive review. |
Changed branch from public/repr_of_numberfields__the_parents__should_indicate_its_embedding_if_there_is_one to |
Changed commit from |
comment:37
This ticket is probably causing (randomly) infinite loops on several patchbots. For example, see EDIT:
|
comment:38
Replying to @fchapoton:
The source code that changed is --- a/src/sage/rings/number_field/number_field.py
+++ b/src/sage/rings/number_field/number_field.py
@@ -3087,9 +3089,16 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
"""
- return "Number Field in %s with defining polynomial %s"%(
- self.variable_name(), self.polynomial())
+ result = "Number Field in {} with defining polynomial {}".format(self.variable_name(), self.polynomial())
+ gen = self.gen_embedding()
+ if gen is not None:
+ result += " with {} = {}".format(self.variable_name(), gen)
+ return result The rest of the diff consist of adapting the doctests. Where could the infinite loop come from? Hmm. |
comment:39
It appears that using the embedding in the repr is a very bad idea... Even when this problematic doctest works, calling
after this doctest makes sage crash.. |
comment:40
I have made #28036 to revert the changes made here. |
comment:41
Maybe changing this line would be a way out:
|
As discussed in #21105, number fields with coercion embeddings, in particular with real embeddings, behave quite differently from those without - but there's no indication of embeddings in the print representation:
This ticket changes the print representation when there is an embedding as follows.
This also works well for more complicated situations such as this one:
CC: @videlec @jplab @JohnCremona @tscrim @mezzarobba @jdemeyer
Component: number fields
Author: Matthias Koeppe
Branch:
d404006
Reviewer: Jean-Philippe Labbé
Issue created by migration from https://trac.sagemath.org/ticket/21161
The text was updated successfully, but these errors were encountered: