#8800: Doctest coverage of categories - numerous coercion fixes
--------------------------+-------------------------------------------------
Reporter: SimonKing | Owner: Simon King
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.6.1
Component: categories | Keywords: categories doctests
Author: Simon King | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------+-------------------------------------------------
Comment(by SimonKing):
Replying to [comment:58 lftabera]:
> I confirm that changing the doctest makes all doctest pass.
Good!
> However, with the coercion of embedded and non embedded number fields,
now addition is not associative.
>
> {{{
> sage: K1.<r1>=NumberField(x^2-2)
> sage: K2.<r2>=NumberField(x^2-2, embedding=1)
> sage: K3.<r3>=NumberField(x^2-2, embedding=-1)
> sage: (r1+r2)+r3
> 3*r1
> sage: r1+(r2+r3)
> r1
> }}}
>
> r1+r2 is ambiguous. So either this operation should raise an error or it
should add an embedding to K1 compatible with K2. But as far as I
understand the coercion model the latter is not possible.
I disagree: It should not raise an error. This is a side-effect of Sage's
coercion model. We (see discussion on sage-nt) do want a forgetful
coercion from K2 to K1 and from K3 to K1; and we want a coercion between
two embedded number fields induced by the embedding.
Hence, we have a coercion between K2 and K3 sending `r3` to `-r2`.
Therefore `r2+r3` is `K2.zero()`, thus, `r1+(r2+r3)==r1`. On the other
hand, `r1+r2` is `2*r1`, since the coercion from K2 to K1 sends `r2` to
`r1`; and similarly `r3` is sent to `r1`, hence `(r1+r2)+r3==3*r1`.
But I suggest to discuss on sage-algebra whether people are really happy
with that consequence of a forgetful coercion.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8800#comment:59>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.