summaryrefslogtreecommitdiff
path: root/2294/CH12/EX12.4/EX12_4.sce
diff options
context:
space:
mode:
Diffstat (limited to '2294/CH12/EX12.4/EX12_4.sce')
-rwxr-xr-x2294/CH12/EX12.4/EX12_4.sce15
1 files changed, 15 insertions, 0 deletions
diff --git a/2294/CH12/EX12.4/EX12_4.sce b/2294/CH12/EX12.4/EX12_4.sce
new file mode 100755
index 000000000..d6916b9ec
--- /dev/null
+++ b/2294/CH12/EX12.4/EX12_4.sce
@@ -0,0 +1,15 @@
+//Example 12.4
+//Probability to find the required sample size.
+disp('Let A be the event of choosing a sample size of 6 containing two red, one green , two blue and one white blue ball.');
+funcprot(0)
+function c = combination ( n , r )
+c = prod ( n : -1 : n-r+1 )/ prod (1:r)
+endfunction
+disp('The number of combination of choosing 6 balls from 14 balls is 14 C 6 ways')
+disp('The number of combination of choosing 2 red balls from 4 balls is 4 C 2 ways')
+disp('The number of combination of choosing 1 from 3 green balls is 3 C 1 ways')
+disp('The number of combination of choosing 2 from 5 green balls is 5 C 2 ways')
+disp('The number of combination of choosing 1 from 2 white balls is 2 C 1 ways')
+disp('P(A)={(4 C 2)*(3 C 1)*(5 C 2)*(2 C 1)}/(14 C 6)=')
+p=(combination(4,2)*combination(3,1)*combination(5,2)*combination(2,1))/combination(14,6);
+disp(p);