#14367: RuntimeError: There is a bug in the coercion code in Sage (number field
to
padic)
--------------------------------------------------+-------------------------
Reporter: lftabera | Owner: robertwb
Type: defect | Status: new
Priority: major | Milestone: sage-5.9
Component: coercion | Resolution:
Keywords: coercion, number field, p-adic | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
--------------------------------------------------+-------------------------
Comment (by nbruin):
Should perhaps
{{{
sage: Q7 = Qp(7)
sage: r1 = 3 + 7 + 2*7^2 + 6*7^3 + 7^4 + 2*7^5 + 7^6 + 2*7^7 + 4*7^8 +\
6*7^9 + 6*7^10 + 2*7^11 + 7^12 + 7^13 + 2*7^15 + 7^16 + 7^17 +\
4*7^18 + 6*7^19 + O(7^20)
sage: N.<b> = NumberField(x^2-2, embedding = r1)
}}}
give an error if `r1` (or the root of `x^2-2` close to `r1`) is not
invertible in its parent? I guess we are supposing that the embedding
implied here is into `parent(r1)`? Note that the definition of `Q7` in the
above example is entirely irrelevant. The `NumberField` constructor is in
no way indicating that an embedding into ''that'' `Q7` is requested.
I guess one option would be to let `embedding` try to construct a parent
in which the image of b is invertible, based on the parent inferred from
`r1`.
(rant)
In general, I think the rule "when in doubt, refuse the temptation to
quess" has served python extremely well and sage would do well to follow
that rule as much as possible too. At least the "fundamental
functionality" in sage should be free from guess-work.
If people then want to layer convenience functions and constructors on top
that try to guess what the user meant from underspecified or malformed
input, that's fine, but it should not contaminate the layer that provides
the real functionality.
(/rant)
So perhaps just fail, citing that sending `b` to `r1` does not map `N`
into a subfield of `parent(r1)`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14367#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.