Thursday, February 28, 2008

Stirling number of 2nd Kind using Maple

> # Program for Stirling Number of 2nd Kind
# Homework Assignment for Dr. Porter's Math 449
# Submitted by Sumant
# Date February 26, 2008
# Dependency: Maple 7, Classic Worksheet
s449 := proc(n,k)
strl := Matrix(1..n,1..n,0);# Matrix with 0 entries
for i from 1 to n do
for j from 1 to i do
if ((j = 0) or (j = 1))
then
strl[i,j] := 1;
else
strl[i,j] := j*strl[i-1,j]+strl[i-1,j-1];
end if;
end do;
end do;
strl[n,k]; # Display the value
end proc;

0 Comments:

Post a Comment

<< Home

Site Meter