bugs with integer_partitions



If you haven't already, please file a bug report. Bugs reported just on the
list
have a way of getting lost.


Barton

-----maxima-bounces at math.utexas.edu wrote: -----

>To: maxima at math.utexas.edu
>From: Oliver Kullmann <O.Kullmann at swansea.ac.uk>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 06/07/2008 01:01PM
>Subject: bugs with integer_partitions
>
>Hi,
>
>(%i2) integer_partitions(0);
>(%o2) {}
>
>which is wrong: it must be {[]}.
>
>The documentation of integer_partitions correctly states
>
>"A list [a_1, ..., a_m] is a partition of a nonnegative integer n
>     when (1) each a_i is a nonzero integer, and (2) a_1 + ... + a_m =
>     n."
>
>Unfortunately, then follows:
>
>"Thus 0 has no partitions."
>
>while obviously from the definition it follows that [] is the unique
>partition of 0.
>
>The partition function p(n), which counts the number of
>partitions of n, is accordingly defined as p(0) = 1.
>
>See any book on number theory, or e.g.
>http://en.wikipedia.org/wiki/Partition_(number_theory).
>Or see http://www.research.att.com/~njas/sequences/A000041.
>(For example, S_0 is the trivial group, the same as S_1,
>and thus p(0) = p(1) = 1.)
>
>Another bug: The documentation states that n is an integer.
>However:
>
>(%i4) integer_partitions(-1);
>(%o4) int_partitions(-1)
>
>The value is {} for negative n. The corrected integer_partition is
>
>corrected_integer_partitions(n) :=
> if n < 0 then {}
> elseif n = 0 then {[]}
> else integer_partitions(n)$
>
>Oliver
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima