What is wrong with this Maple code for sum of Stirling numbers (which should output Lah numbers)?

28 views Asked by At

I am trying to compute Lah numbers with Maple, but without using the Lah numbers recurrence relation, but the relation with Stirling numbers of both kind:

$L(n, k) = \sum_{j=0}^{n} s(n, j) S(j, k)$, where

$s(n, k) = s(n-1, k-1) + (n-1) s(n-1, k)$ and

$S(n, k) = S(n-1, k-1) + k S(n-1, k)$.

I have tried the following code:

s := proc(n, k) option remember; 
`if`(n = k, 1, `if`(k < 0 or n < k, 0, s(n - 1, k - 1) + (n - 1)*s(n - 1, k))); 
end proc;
S := proc(n, k) option remember; 
`if`(n = k, 1, `if`(k < 0 or n < k, 0, S(n - 1, k - 1) + k*S(n - 1, k))); end proc;
sum(s(n, j)*S*(j, k), j = 0 .. n);
end do; 

and it always reports an error:

Error, unable to parse

It looks like that the code is wrong, but I do not know how to fix it.

When I click on the error, it sends me to this website: https://www.maplesoft.com/support/help/errors/view.aspx?path=Error,%20unable%20to%20parse

Any suggestions for fixing the code? Thanks a lot.

I have tried to fix the code but I do not know how to fix it.

0

There are 0 answers