#15552: enumerate_totallyreal_fields_prim does not return polynomial as 
elements of
a polynomial ring
-------------------------------------+-------------------------------------
       Reporter:  ppurka             |        Owner:
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.1
      Component:  algebra            |   Resolution:
       Keywords:                     |    Merged in:
        Authors:                     |    Reviewers:  Francis Clarke
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/ppurka/ticket/15552              |  d67b6c35baf378c3362f38b8b8c8c8dcc661602f
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by ppurka):

 This is still not completely ready for review -- need to verify that the
 outputs are fine. But you can look into the changes if you want.

 I am actually not confident that the functions give the output
 corresponding to the documentation! The statements that we get with
 `verbose=True` do not match the output (for example the discriminant
 bound). I guess we can just fix the output here and leave the actual
 program to someone who knows this stuff inside out.

 Here is a sample run after my patches.
 {{{
 sage: ZZx = ZZ['x']
 sage: F.<t> = NumberField(x^2-2)
 sage: enumerate_totallyreal_fields_rel(F, 2, 2000, verbose=True) # m=2
 ==> [t - 1, t + 1, 1] has discriminant 2624 > B
 ==> [-1, t + 1, 1] has discriminant 2624 > B
 ==> [-2, 1, 1] is not absolutely irreducible
 ==> [-1, t, 1] has discriminant 2304 > B
 ==> [t - 1, t, 1] is not squarefree
 ==> [-t - 1, t, 1] is not squarefree
 ==> [-2, 0, 1] is not squarefree
 ==> [t - 2, 0, 1] has discriminant 2048 > B
 ==> [-t - 2, 0, 1] has discriminant 2048 > B
 
================================================================================
 Polynomials tested: 9
 Polynomials with discriminant with large enough square divisior: 6
 Irreducible polynomials: 5
 Polynomials with nfdisc <= B: 0
 [1600, x^4 - 6*x^2 + 4, xF^2 + xF - 1]
 [[1600, x^4 - 6*x^2 + 4, xF^2 + xF - 1]]


 # return_seqs returns four numbers corresponding to the numbers above
 sage: enumerate_totallyreal_fields_rel(F, 2, 2000, return_seqs=True)
 [[9, 6, 5, 0], [[1600, [4, 0, -6, 0, 1], [-1, 1, 1]]]]


 # Testing m=1 which wasn't working before
 sage: enumerate_totallyreal_fields_rel(F, 1, 2000, verbose=True) # m=1
 [[1, x - 1, [-2, 0, 1]]]


 -------------------------- SECOND FUNCTION ----------------------------

 Let us try the _all function which calls _rel

 sage: enumerate_totallyreal_fields_all(2, 10, return_seqs=True)
 [[0, 0, 0, 0], [[5, [-1, -1, 1]], [8, [-2, 0, 1]]]]
 sage: enumerate_totallyreal_fields_all(2, 10)
 [[5, x^2 - x - 1], [8, x^2 - 2]]

 # the verbose output
 sage: enumerate_totallyreal_fields_all(2, 10, verbose=True)
 
================================================================================
 Polynomials tested: 0
 Polynomials with sssd poldisc: 0
 Irreducible polynomials: 0
 Polynomials with nfdisc <= B: 0
 [5, x^2 - x - 1]
 [8, x^2 - 2]
 
================================================================================
 Polynomials tested: 0
 Polynomials with discriminant with large enough square divisior: 0
 Irreducible polynomials: 0
 Polynomials with nfdisc <= B: 0
 [5, x^2 - x - 1]
 [8, x^2 - 2]
 [[5, x^2 - x - 1], [8, x^2 - 2]]


 # the case n=1
 sage: enumerate_totallyreal_fields_all(1, 10, verbose=True)
 
================================================================================
 Polynomials tested: 0
 Polynomials with discriminant with large enough square divisior: 0
 Irreducible polynomials: 0
 Polynomials with nfdisc <= B: 0
 [1, x - 1]
 [[1, x - 1]]


 ----------------------- THIRD FUNCTION --------------------------------

 # the third function
 sage: enumerate_totallyreal_fields_prim(5,5**7)
 [[14641, x^5 - x^4 - 4*x^3 + 3*x^2 + 3*x - 1],
  [24217, x^5 - 5*x^3 - x^2 + 3*x + 1],
  [36497, x^5 - 2*x^4 - 3*x^3 + 5*x^2 + x - 1],
  [38569, x^5 - 5*x^3 + 4*x - 1],
  [65657, x^5 - x^4 - 5*x^3 + 2*x^2 + 5*x + 1],
  [70601, x^5 - x^4 - 5*x^3 + 2*x^2 + 3*x - 1]]


 sage: enumerate_totallyreal_fields_prim(5,5**7,verbose=True)
 
================================================================================
 Polynomials tested: 953
 Polynomials with sssd poldisc: 359
 Irreducible polynomials: 191
 Polynomials with nfdisc <= B: 38
 [14641, x^5 - x^4 - 4*x^3 + 3*x^2 + 3*x - 1]
 [24217, x^5 - 5*x^3 - x^2 + 3*x + 1]
 [36497, x^5 - 2*x^4 - 3*x^3 + 5*x^2 + x - 1]
 [38569, x^5 - 5*x^3 + 4*x - 1]
 [65657, x^5 - x^4 - 5*x^3 + 2*x^2 + 5*x + 1]
 [70601, x^5 - x^4 - 5*x^3 + 2*x^2 + 3*x - 1]
 [[14641, x^5 - x^4 - 4*x^3 + 3*x^2 + 3*x - 1],
  [24217, x^5 - 5*x^3 - x^2 + 3*x + 1],
  [36497, x^5 - 2*x^4 - 3*x^3 + 5*x^2 + x - 1],
  [38569, x^5 - 5*x^3 + 4*x - 1],
  [65657, x^5 - x^4 - 5*x^3 + 2*x^2 + 5*x + 1],
  [70601, x^5 - x^4 - 5*x^3 + 2*x^2 + 3*x - 1]]

 # the case n = 1
 sage: enumerate_totallyreal_fields_prim(1,7, verbose=True)
 [[1, x - 1]]
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15552#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to