Opened 9 years ago

Closed 5 years ago

#15298 closed defect (fixed)

Two versions of QQ(sqrt{-1}) upon startup

Reported by: Nils Bruin Owned by:
Priority: trivial Milestone: sage-8.1
Component: interfaces Keywords:
Cc: Merged in:
Authors: Frédéric Chapoton Reviewers: Ralf Stephan
Report Upstream: N/A Work issues:
Branch: 5aa64be (Commits, GitHub, GitLab) Commit: 5aa64be9661c799b4fbdcde287d6f18959486719
Dependencies: Stopgaps:

Status badges

Description

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_quadratic)]
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?

Change History (13)

comment:1 Changed 9 years ago by Nils Bruin

A preliminary test shows that changing rings/qqbar.py:7699 to

QQbar_I_nf = QuadraticField(-1, 'I', embedding=CC.gen(), latex_name='i')

works fine and ensures that there's only one field created upon startup. Note that:

sage: latex(QQbar.0)
\text{\texttt{1*I}}

so it looks like the latex printing will not be affected by this change either.

comment:2 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:3 Changed 8 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:4 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4

comment:5 Changed 5 years ago by Ralf Stephan

Component: miscinterfaces
Milestone: sage-6.4sage-8.1

comment:6 Changed 5 years ago by Frédéric Chapoton

Authors: Frédéric Chapoton
Branch: u/chapoton/15298
Commit: 8aee254fc9fc7f3fc7992ff3e2b223d3d91aa7b4
Status: newneeds_review

done


New commits:

8aee254trac 15298 only one field for I

comment:7 Changed 5 years ago by git

Commit: 8aee254fc9fc7f3fc7992ff3e2b223d3d91aa7b4cf4d4f8640ba0abee20775c0d386b0ab29e8cfab

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

cf4d4f8trac 15298 only one field for I

comment:8 Changed 5 years ago by Ralf Stephan

Reviewers: Ralf Stephan

Doctest fails in qqbar.py which are logical. You can set to positive after adaptation.

comment:9 Changed 5 years ago by git

Commit: cf4d4f8640ba0abee20775c0d386b0ab29e8cfab5aa64be9661c799b4fbdcde287d6f18959486719

Branch pushed to git repo; I updated commit sha1. New commits:

5aa64betrac 15928 fixing doctests

comment:10 Changed 5 years ago by Frédéric Chapoton

Thanks. This introduces a non-uniform behaviour for the latex of QQbar elements. Sometimes "i" will still be displayed as sqrt{-1}. I propose to keep that issue for another ticket. Objection ?

comment:11 in reply to:  10 Changed 5 years ago by Ralf Stephan

Replying to chapoton:

Objection ?

None. Please go ahead.

comment:12 Changed 5 years ago by Frédéric Chapoton

Status: needs_reviewpositive_review

then let it be positive

comment:13 Changed 5 years ago by Volker Braun

Branch: u/chapoton/152985aa64be9661c799b4fbdcde287d6f18959486719
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.