Changes between Version 6 and Version 40 of Ticket #18036


Ignore:
Timestamp:
10/19/20 08:55:47 (12 months ago)
Author:
mmezzarobba
Comment:

Time to reboot this ticket! (Still a bit of a work in progress, comments welcome.)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #18036

    • Property Authors changed from to Marc Mezzarobba
    • Property Cc mmezzarobba behackl rws gh-kliem gh-mwageringel added
    • Property Summary changed from I should not be symbolic to I.parent() should not be the symbolic ring
    • Property Branch changed from to u/mmezzarobba/18036-QQi
    • Property Milestone changed from sage-6.6 to sage-9.3
    • Property Commit changed from to 2657cd768a920d339cc7bc9d2b4dd88cf3862d8d
  • Ticket #18036 – Description

    v6 v40  
    1 As suggested in #7545, `I` (so that `I^2 = -1`) should be defined directly as the generator of `QuadraticField(-1)` and not wrapped into a symbolic expression.
     1As 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.
    22
    3 Currently, `I` is defined in `sage/symbolic/pynac.pyx` within the function `init_pynac_I`.
     3**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.
     4
     5**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).
     6
     7**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.)