-
-
Couldn't load subscription status.
- Fork 680
Description
As suggested in #7545, this ticket defines the imaginary unit I directly as the generator of QuadraticField(-1) instead of wrapping it in a symbolic expression.
Why? To allow it to be used in combination with elements of QQbar, CC, etc., without coercion forcing the expression to SR. For example, 1.0 + I is now an element of CC instead of SR.
How? We set I in sage.all to the generator of ℚ[i], and deprecate importing it from sage.symbolic.I. The symbolic I remains available from sage.symbolic.constants for library code working with symbolic expressions, and as SR(I) or SR.I(). We create a dedicated subclass of quadratic number field elements to make it possible to support features similar to those of symbolic expressions of the form a + I*b that would not make sense for number field elements (or be too hard to implement, or pollute the namespace).
Why not ℤ[i]? Because the class hierarchy of number field and order elements makes it difficult to provide the compatibility features mentioned above for elements of both ℤ[i] and ℚ[i]. Having I be an element of ℚ[i] covers almost all use cases (all except working with algebraic integers?), and people who work with orders are sophisticated enough to explicitly ask for I ∈ ℤ[i] when they need that. (This is a debatable choice. We could probably do without the dedicated subclass for elements of ℚ[i], at the price of breaking backward compatibility a bit more.)
CC: @categorie @jdemeyer @mezzarobba @behackl @rwst @kliem @mwageringel
Component: number fields
Author: Marc Mezzarobba
Branch/Commit: 54a34a7
Reviewer: Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/18036