blob: d2a364dc0fd464586b1be2223570369031f55707 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//Example 6.3
clear;
clc;
//To calculate the number of ways of distribute
//(i)2 distinguishable objects in two boxes
N=2;//number of objects
l=2;//number of boxes
w=l^N;//number of configurations
mprintf('the number of ways of distribute (i)2 distinguishable objects in 2 boxes = %i',w);
//(ii)2 distinguishable objects in 3 boxes
N=2;//number of objects
l=3;//number of boxes
w=l^N;//number of configurations
mprintf('\n the number of ways of distribute (ii)2 distinguishable objects in 3 boxes = %i',w);
//(iii)2 indistinguishable objects in 2 boxes
N=2;//number of objects
l=2;//number of boxes
w=(3*2*1)/(2*1*1);//number of configurations
mprintf('\n the number of ways of distribute (iii)2 indistinguishable objects in 2 boxes = %i',w);
//(iv)2 indistinguishable objects in 3 boxes
N=2;//number of objects
l=3;//number of boxes
w=(4*3*2*1)/(2*1*2*1);//number of configurations
mprintf('\n the number of ways of distribute (iv)2 indistinguishable objects in 3 boxes = %i',w);
//end
|