summaryrefslogtreecommitdiff
path: root/3161/CH2/EX2.2/Ex2_2.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /3161/CH2/EX2.2/Ex2_2.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '3161/CH2/EX2.2/Ex2_2.sce')
-rw-r--r--3161/CH2/EX2.2/Ex2_2.sce38
1 files changed, 38 insertions, 0 deletions
diff --git a/3161/CH2/EX2.2/Ex2_2.sce b/3161/CH2/EX2.2/Ex2_2.sce
new file mode 100644
index 000000000..386dae4fb
--- /dev/null
+++ b/3161/CH2/EX2.2/Ex2_2.sce
@@ -0,0 +1,38 @@
+clc;
+//page 86
+//problem 2.2
+
+//Probability that A will occur if B has already occurred(P_AB) = ratio of Probability of joint occurence of A&B (P_A_B) & Probability of B(P_B)
+//P_A_B(robability of joint occurence) = Probability that A&B both occur(P_AinterB)
+
+//From given values P_AinterB = 0.1 implies P_A_B = 0.1 & P_B = 0.4
+P_AinterB = 0.1
+P_A_B = P_AinterB
+P_B = 0.4
+
+P_AB = P_A_B/P_B
+
+//Similarly
+//Probability that B will occur if A has already occurred(P_BA) = ratio of Probability of joint occurence of A&B (P_A_B) & Probability of B(P_A)
+
+//From given values P_A = 0.2
+P_A = 0.2
+
+P_BA = P_A_B/P_A
+
+//Bayes theorem says that P_AB = (P_A/P_B)*P_BA
+//After Calculating LHS & RHS if both are equal then bayes theorem is satisfying
+
+//Calculating LHS
+LHS = P_AB
+
+//Calculating RHS
+RHS = (P_A/P_B)*P_BA
+
+disp('P(A/B) = '+string(P_AB) );
+
+if LHS == RHS then
+ disp('LHS = RHS, Hence Bayes theorem is verified' );
+end
+
+