#11476: PartitionTuples.cardinality has problems
---------------------------------------------------------+------------------
       Reporter:  pdehaye                                |         Owner:  
sage-combinat
           Type:  defect                                 |        Status:  
needs_review 
       Priority:  major                                  |     Milestone:  
sage-5.4     
      Component:  combinatorics                          |    Resolution:       
        
       Keywords:  PartitionTuple, cardinality, beginner  |   Work issues:       
        
Report Upstream:  N/A                                    |     Reviewers:       
        
        Authors:  Andrew Mathas                          |     Merged in:       
        
   Dependencies:  #13072                                 |      Stopgaps:       
        
---------------------------------------------------------+------------------
Description changed by andrew.mathas:

Old description:

> It works for smaller values.
>
> {{{
> sage: PartitionTuples(100,13).cardinality()
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /Volumes/Scratch/Users/duser1/sage/<ipython console> in <module>()
>
> /Users/duser1/sage/local/lib/python2.6/site-
> packages/sage/combinat/partition.pyc in cardinality(self)
>    3183             185
>    3184         """
> -> 3185         return ZZ(gp.eval('polcoeff(1/eta(x)^%s, %s, x)'%(self.k,
> self.n)))
>    3186
>    3187
>
> /Users/duser1/sage/local/lib/python2.6/site-
> packages/sage/structure/parent.so in
> sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6820)()
>
> /Users/duser1/sage/local/lib/python2.6/site-
> packages/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3254)()
>
> /Users/duser1/sage/local/lib/python2.6/site-
> packages/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3157)()
>
> /Users/duser1/sage/local/lib/python2.6/site-
> packages/sage/rings/integer.so in sage.rings.integer.Integer.__init__
> (sage/rings/integer.c:7212)()
>
> TypeError: unable to convert x (=  ***   at top-level:
> polcoeff(1/eta(x)^13
>   ***                 ^--------------------
>   *** polcoeff: non existent component in truecoeff.) to an integer
> sage:
>
> }}}

New description:

 It works for smaller values.

 {{{
 sage: PartitionTuples(100,13).cardinality()
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /Volumes/Scratch/Users/duser1/sage/<ipython console> in <module>()

 /Users/duser1/sage/local/lib/python2.6/site-
 packages/sage/combinat/partition.pyc in cardinality(self)
    3183             185
    3184         """
 -> 3185         return ZZ(gp.eval('polcoeff(1/eta(x)^%s, %s, x)'%(self.k,
 self.n)))
    3186
    3187

 /Users/duser1/sage/local/lib/python2.6/site-
 packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
 (sage/structure/parent.c:6820)()

 /Users/duser1/sage/local/lib/python2.6/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (sage/structure/coerce_maps.c:3254)()

 /Users/duser1/sage/local/lib/python2.6/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (sage/structure/coerce_maps.c:3157)()

 /Users/duser1/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
 in sage.rings.integer.Integer.__init__ (sage/rings/integer.c:7212)()

 TypeError: unable to convert x (=  ***   at top-level:
 polcoeff(1/eta(x)^13
   ***                 ^--------------------
   *** polcoeff: non existent component in truecoeff.) to an integer
 sage:

 }}}


 As noted below, this turned out to just be an issue of increasing the
 precision in the pari function call. The attached patch fixes the problem:

 '''Attach'''  [attachment:trac_11476--fixing-partition-tuples_cardinality-
 am.patch]

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11476#comment:5>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to