Pari implements it, but incorrectly:

sage: number_of_partitions(5*10535+4,algorithm="pari")
132775694853416614410709359082850304628573507097
148711672236023178345995078715426574030466347126
367130008280402558755564770977624160764152691390
102001213796297899514590335375857238756973648770
246446295491295636766189177742381389268656730071
68971398574

But:

sage: number_of_partitions(5*10535+4)
132775694853416614410709359082850304628573507097
148711672236023178345995078715426574030466347126
367130008280402558755564770977624160764152691390
102001213796297899514590335375857238756973648770
246446295491295636766189177742381389268656730071
68971398575

At least GAP returns the right answer!! But after some time:

sage: number_of_partitions(5*10535+4)
---------------------------------------------------------------------------
<type 'exceptions.RuntimeError'>          Traceback (most recent call
last)

/home/wbhart/flint/trunk/<ipython console> in <module>()

/home/was/s/local/lib/python2.5/site-packages/sage/combinat/
combinat.py in number_of_partitions(n, k, algorithm)
   1245     if algorithm == 'gap':
   1246         if k==None:
-> 1247             ans=gap.eval("NrPartitions(%s)"%(ZZ(n)))
   1248         else:
   1249             ans=gap.eval("NrPartitions(%s,%s)"%(ZZ(n),ZZ(k)))

/home/was/s/local/lib/python2.5/site-packages/sage/interfaces/gap.py
in eval(self, x, newlines, strip)
    298         if len(x) == 0 or x[len(x) - 1] != ';':
    299             x += ';'
--> 300         s = Expect.eval(self, x)
    301         if newlines:
    302             return s

/home/was/s/local/lib/python2.5/site-packages/sage/interfaces/
expect.py in eval(self, code, strip, **kwds)
    519         code = code.strip()
    520         try:
--> 521             return '\n'.join([self._eval_line(L, **kwds) for L
in code.split('\n') if L != ''])
    522         except KeyboardInterrupt:
    523             self._keyboard_interrupt()

/home/was/s/local/lib/python2.5/site-packages/sage/interfaces/gap.py
in _eval_line(self, line, allow_use_file, wait_for_prompt)
    482                         return ''
    483                 else:
--> 484                     raise RuntimeError, message
    485
    486         except KeyboardInterrupt:

<type 'exceptions.RuntimeError'>: Unexpected EOF from Gap executing
NrPartitions(52679);

Bill.

On 26 Jul, 07:38, Nick Alexander <[EMAIL PROTECTED]> wrote:
> "William Stein" <[EMAIL PROTECTED]> writes:
> > QUESTIONS: Why is Mathematica about 10 times faster than PARI
> > at this?   What are the best ways to compute the number
> > of partitions of n?  Is it a calculation involving fast arithmetic
> > with dense polynomials of large degree, which would be best done
> > using the upcoming FLINT library or NTL?
>
> Please correct me if I'm crazy, but isn't there an asymptotic formula
> due to Hardy and Rademacher that can evaluate $P(n)$ to a very high
> accuracy very quickly?  Surely both of these packages implement such a
> convergent series approach, and it is possible that SAGE has faster
> real arithmetic and could do this faster.
>
> Again, I may be completely incorrect -- please let me know.
>
> Nick


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to