You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trac #25218: Extract roots in NumberField if possible
!NumberField previously evaluated integral powers in the !NumberField,
and evaluated all fractional powers in the symbolic ring.
This patch makes !NumberField attempt to evaluate the fractional power
within the field, and only falls back on the symbolic ring if this
fails.
There's a few interesting changes in the test suite.
Old code:
{{{
sage: QQbar((2*I)^(1/2))
1 + 1*I
sage: (2*I)^(1/2)
sqrt(2*I)
sage: I^(2/3)
I^(2/3)
}}}
New code:
{{{
sage: QQbar((2*I)^(1/2))
I + 1
sage: (2*I)^(1/2)
I + 1
sage: I^(2/3)
-1
}}}
The first change is just cosmetic. The second makes good sense, as Sage
is now evaluating an expression it didn't before. The third change is
more troubling.
The explanation lies in the definition of I:
{{{
sage: I.parent()
Symbolic Ring
sage: I.pyobject().parent()
Number Field in I with defining polynomial x^2 + 1
}}}
In this number field, there is a single cube root of `I` (`-I`).
Squaring `-I` gives us `-1`, so `I^(2/3)=-1`.
My opinion is that the new behavior of !NumberField is correct and
preferred, but perhaps `I` should be defined in QQbar, not in a
!NumberField.
URL: https://trac.sagemath.org/25218
Reported by: gh-BrentBaccala
Ticket author(s): Brent Baccala
Reviewer(s): Sébastien Labbé
0 commit comments