summaryrefslogtreecommitdiff
path: root/3808/CH7/EX7.12/Ex7_12.sce
diff options
context:
space:
mode:
Diffstat (limited to '3808/CH7/EX7.12/Ex7_12.sce')
-rw-r--r--3808/CH7/EX7.12/Ex7_12.sce14
1 files changed, 14 insertions, 0 deletions
diff --git a/3808/CH7/EX7.12/Ex7_12.sce b/3808/CH7/EX7.12/Ex7_12.sce
new file mode 100644
index 000000000..6668d90df
--- /dev/null
+++ b/3808/CH7/EX7.12/Ex7_12.sce
@@ -0,0 +1,14 @@
+//Chapter 07: Discrete Probability
+
+clc;
+clear;
+
+X=[1,2,3,4,5,6] //possible values on a fair die
+p=1/6 //probability for any value to appear when die is rolled
+Ex=0
+l=length(X)
+for i=1:l
+ Ex=Ex+p*X(i)
+end
+
+disp(Ex,'Expected value of X')