Skip to content

Commit

Permalink
Trac #15298: Two versions of QQ(sqrt{-1}) upon startup
Browse files Browse the repository at this point in the history
We have two copies upon startup:
{{{
sage: import gc
sage: Ks=[K for K in gc.get_objects() if
....: isinstance(K,sage.rings.number_field.number_field.NumberField_quad
ratic)]
sage: [latex(k.0) for k in Ks]
[i, \sqrt{-1}]
}}}
I suspect they are coming from
`symbolic/pynac.pyx:2046 (in init_pynac_I)`
{{{
    K = QuadraticField(-1, 'I', embedding=CC.gen(), latex_name='i')
}}}
and from `rings/qqbar.py:7699 (in _init_qqbar)`
{{{
    QQbar_I_nf = QuadraticField(-1, 'I', embedding=CC.gen())
}}}
Should we perhaps both give them the same latex name so that these can
be the same field?

URL: https://trac.sagemath.org/15298
Reported by: nbruin
Ticket author(s): Frédéric Chapoton
Reviewer(s): Ralf Stephan
  • Loading branch information
Release Manager authored and vbraun committed Sep 24, 2017
2 parents b199005 + 5aa64be commit 158818b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/sage/rings/qqbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2929,13 +2929,13 @@ def _latex_(self):
sage: latex(AA(22/7))
\frac{22}{7}
sage: latex(QQbar(1/3 + 2/7*I))
\frac{2}{7} \sqrt{-1} + \frac{1}{3}
\frac{2}{7} i + \frac{1}{3}
sage: latex(QQbar.zeta(4) + 5)
\sqrt{-1} + 5
i + 5
sage: latex(QQbar.zeta(4))
\sqrt{-1}
i
sage: latex(3*QQbar.zeta(4))
3 \sqrt{-1}
3 i
sage: latex(QQbar.zeta(17))
0.9324722294043558? + 0.3612416661871530? \sqrt{-1}
sage: latex(AA(19).sqrt())
Expand Down Expand Up @@ -7576,7 +7576,7 @@ def _init_qqbar():

AA_0 = AA.zero()

QQbar_I_nf = QuadraticField(-1, 'I', embedding=CC.gen())
QQbar_I_nf = QuadraticField(-1, 'I', embedding=CC.gen(), latex_name='i')
QQbar_I_generator = AlgebraicGenerator(QQbar_I_nf, ANRoot(AAPoly.gen()**2 + 1, CIF(0, 1)))
QQbar_I = AlgebraicNumber(ANExtensionElement(QQbar_I_generator, QQbar_I_nf.gen()))

Expand Down

0 comments on commit 158818b

Please sign in to comment.