Friday, February 29, 2008

Bell Numbers

> # Program for Bell Number
# Homework Assignment for Dr. Porter's Math 449
# Submitted by Sumant
# Date February 26, 2008
# Dependency: Maple 7, Classic Worksheet
b449 := proc(n)
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;
bell := 0;
for k from 1 to n do
bell := bell + strl[n,k];# Add numbers in the row
end do;
bell; # Display the bell number
end proc;

0 Comments:

Post a Comment

<< Home

Site Meter