bugs in function stirling1() in version 5.21.1 (and up?)



Would the dlmf be a better reference than Concrete Mathematics? 

I think that ( http://dlmf.nist.gov/26.8.E17) 

     stirling2(n,2) = 2^(n-1)-1, n >= 1

is correct. Further,

  (%i18)  makelist(stirling2(n,2) = 2^(n-1)-1,n,1,6);
  (%o18) [0=0,1=1,3=3,7=7,15=15,31=31]

The user documentation gives the bogus stirling1(n + 1, 2) = 2^n  - 1 . Here I think it's only the
user documentation that needs fixing.

As for 

  (%i36) assume(n>0)$
  (%i37)  stirling1(n+1,1);
  (%o37) n!
 
  (%i38) stirling1(6,1);
  (%o38) -120

The code and user documentation are incorrect. (see  http://dlmf.nist.gov/26.8.E14  )

Finally, I wouldn't necessarily  think that 

      m!*stirling2(n,m) -->  sum(binomial(m,k)*k^n*(-1)^(m-k),k,0,m) 

is a simplification. Likely it should be deleted from the user documentation. 

Thanks for your interest in the stirling code--I'll see what I can do to fix the code and the user
documentation. If you have more suggestions, please send them to the list.  To report a bug
on sourceforge, you'll need an account...sigh.

I'm not sure that the Stirling code has been used all that much--likely there are more bugs.

--Barton

________________________________________
From: maxima-bounces at math.utexas.edu <maxima-bounces at math.utexas.edu> on behalf of Bernhard Marx <b.w.marx at gmx.de>
Sent: Monday, December 16, 2013 16:53
To: maxima at math.utexas.edu
Subject: bugs in function stirling1() in version 5.21.1 (and up?)

Because i can make neither head nor tail
from the "bug reporting" at sourceforge,
i write to this list.
For the rest of this text "You" adresses persons
documenting. maintaining or developing Maxima.
That said:

To whom it may concern!

Maxima (as do other programs. e.g. PARI/gp) computes
integers (as values of stirling1()) with alternating signs,
whereas Concrete Math 2nd ed defines them non-negative.
This should be stressed in the documentation, where it is
now hidden (a bit) by
"the magnitude of stirling1 (n, m) is the number of permutations of
 a set with n members that have m cycles".
This is not a bug but a nuisance -- at least to me.

The bugs are the following, consistently in the program and its documentation:
        stirling1(n+1,2) simplifies to 2^n-1,
which is simply not true, even when disregarding the signs
(with H(n):=sum(1/k,k,1,n); it should be
        stirling1(n+1,2) simplifies to H(n)*n!*(-1)^(n-1)
). although the numbers computed for instantiated
n are correct (modulo the previous remark).
The simplifications
        stirling1(n+1,1) to n!                  and
        stirling1(n+1,n) to binomial(n,2)
would only be true, had you defined the function stirling1()
to return non-negative values (which you don't)
and thus should be
        stirling1(n+1,1) to (-1)^n*n!           and
        stirling1(n+1,n) to -binomial(n,2)

Furthermore there are some typos in the documentation of the function
stirling2().
Concrete Math 2nd ed eqn. (6.19) states for m,n >= 0
        m!*stirling2(n,m) = sum(binomial(m,k)*k^n*(-1)^(m-k),k,0,m)
but for this to work also for stirling2(0,0), 0^0 would have to be
defined as 1, which is not the standart with Maxima.
I couldn't provoke this simplification anyway in the program,
so it might as well be taken out of the documentation.

Maxima version: 5.21.1
Maxima build date: 8:13 4/26/2010
Host type: i686-pc-mingw32
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.8

With best regards,
Bernhard W. Marx






_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima