Opened 9 years ago

Closed 8 years ago

#8938 closed defect (fixed)

Multivariate polynomials can be incorrectly formatted in LaTeX

Reported by: fwclarke Owned by: AlexGhitza
Priority: minor Milestone: sage-4.7.2
Component: algebra Keywords: Multivariate polynomials latex
Cc: Merged in: sage-4.7.2.alpha1
Authors: Francis Clarke, Andrey Novoseltsev Reviewers: Martin Albrecht, John Palmieri
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by novoselt)

sage: C5.<z> = CyclotomicField(5)
sage: P.<s, t> = C5[]
sage: f = (z^2 + z)*s
sage: f
(z^2 + z)*s
sage: latex(f)
z^{2} + z s

Apply:

  1. trac_8938_latex_test_for_cyclotomic_fields.patch

Attachments (2)

trac_8938.patch (11.8 KB) - added by fwclarke 9 years ago.
trac_8938_latex_test_for_cyclotomic_fields.patch (1.3 KB) - added by novoselt 8 years ago.

Download all attachments as: .zip

Change History (13)

Changed 9 years ago by fwclarke

comment:1 Changed 9 years ago by fwclarke

  • Status changed from new to needs_review

The patch solves this problem, providing latex code which is modelled on that used for single-variable polynomials.  A few doctests have had to be adjusted and LaTeX output provided for elements of QQbar.

comment:2 Changed 9 years ago by malb

  • Reviewers set to Martin Albrecht
  • Status changed from needs_review to positive_review

Applies cleanly, doctests pass, reads good.

comment:3 Changed 9 years ago by davidloeffler

  • Authors set to Francis Clarke
  • Milestone set to sage-4.5

comment:4 Changed 9 years ago by davidloeffler

  • Status changed from positive_review to needs_work

I'm getting doctest failures with this under 4.5.alpha1:

sage -t  "devel/sage-reviewing/sage/rings/polynomial/multi_polynomial_element.py"
**********************************************************************           
File "/storage/masiao/sage-4.5.alpha1/devel/sage-reviewing/sage/rings/polynomial/multi_polynomial_element.py", line 379:                                                                                                    
    sage: latex(-I*y+I*x^2)                                                                                   
Expected:                                                                                                     
    \sqrt{-1} x^{2} - \sqrt{-1} y                                                                             
Got:                                                                                                          
    \left(\sqrt{-1}\right) x^{2} + \left(-\sqrt{-1}\right) y                                                  
**********************************************************************                                        
1 items had failures:                                                                                         
   1 of   7 in __main__.example_15                                                                            
***Test Failed*** 1 failures.                                                                                 
For whitespace errors, see the file /home/masiao/.sage//tmp/.doctest_multi_polynomial_element.py              
         [3.7 s]                                                                                              
sage -t  "devel/sage-reviewing/sage/rings/qqbar.py"                                                           
**********************************************************************                           File "/storage/masiao/sage-4.5.alpha1/devel/sage-reviewing/sage/rings/qqbar.py", line 2223:
    sage: latex(-QQbar.zeta(4) + 5)
Expected:
    -i + 5
Got:
    -\sqrt{-1} + 5
**********************************************************************
1 items had failures:
   1 of   7 in __main__.example_42
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/masiao/.sage//tmp/.doctest_qqbar.py
         [19.5 s]
sage -t  "devel/sage-reviewing/sage/schemes/generic/algebraic_scheme.py"
**********************************************************************
File "/storage/masiao/sage-4.5.alpha1/devel/sage-reviewing/sage/schemes/generic/algebraic_scheme.py", line 595:
    sage: S._latex_()
Expected:
    '\\text{Closed subscheme of } {\\mathbf P}_{\\Bold{F}_{11}}^2 \\text{ defined by } x^{2} - y z'
Got:
    '\\text{Closed subscheme of } {\\mathbf P}_{\\Bold{F}_{11}}^2 \\text{ defined by } x^{2} + 10 y z'
**********************************************************************
File "/storage/masiao/sage-4.5.alpha1/devel/sage-reviewing/sage/schemes/generic/algebraic_scheme.py", line 602:
    sage: S._latex_()
Expected:
    '\\text{Closed subscheme of } {\\mathbf P}_{\\Bold{F}_{11}}^2 \\text{ defined by } x^{2} - y z, x^{5}'
Got:
    '\\text{Closed subscheme of } {\\mathbf P}_{\\Bold{F}_{11}}^2 \\text{ defined by } x^{2} + 10 y z, x^{5}'
**********************************************************************
1 items had failures:
   2 of   9 in __main__.example_23
***Test Failed*** 2 failures.
For whitespace errors, see the file /home/masiao/.sage//tmp/.doctest_algebraic_scheme.py
         [5.4 s]

----------------------------------------------------------------------
The following tests failed:


        sage -t  "devel/sage-reviewing/sage/rings/polynomial/multi_polynomial_element.py"
        sage -t  "devel/sage-reviewing/sage/rings/qqbar.py"
        sage -t  "devel/sage-reviewing/sage/schemes/generic/algebraic_scheme.py"
Total time for all tests: 28.6 seconds

comment:5 Changed 9 years ago by fwclarke

It looks like the new failures are caused by #9017 and #9108, both of which overtook this patch.  I'll try to make a new patch compatible with the changes introduced by the other two.

comment:6 Changed 9 years ago by fwclarke

See also #9394.

comment:7 Changed 9 years ago by novoselt

See also #9478.

comment:8 Changed 8 years ago by novoselt

  • Authors changed from Francis Clarke to Francis Clarke, A

In Sage 4.7.1.rc0 I get for the last line

\left(z^{2} + z\right) s

so this bug has been fixed along the way.

comment:9 Changed 8 years ago by novoselt

  • Authors changed from Francis Clarke, A to Francis Clarke, Andrey Novoseltsev
  • Description modified (diff)
  • Milestone changed from sage-4.7.1 to sage-4.7.2
  • Status changed from needs_work to needs_review

comment:10 Changed 8 years ago by jhpalmieri

  • Priority changed from major to minor
  • Reviewers changed from Martin Albrecht to Martin Albrecht, John Palmieri
  • Status changed from needs_review to positive_review

Looks good to me. (There are probably other doctests verifying this from whatever ticket originally fixed it, but having another one can't hurt.)

comment:11 Changed 8 years ago by jdemeyer

  • Merged in set to sage-4.7.2.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.