summaryrefslogtreecommitdiff
path: root/291/CH4
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /291/CH4
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 '291/CH4')
-rwxr-xr-x291/CH4/EX4.1a/eg4_1a.sce47
-rwxr-xr-x291/CH4/EX4.1b/eg4_1b.sce11
-rwxr-xr-x291/CH4/EX4.1c/eg4_1c.sce2
-rwxr-xr-x291/CH4/EX4.2a/eg4_2a.sce3
-rwxr-xr-x291/CH4/EX4.2b/eg4_2b.sce6
-rwxr-xr-x291/CH4/EX4.3a/eg4_3a.sce14
-rwxr-xr-x291/CH4/EX4.3b/eg4_3b.sce17
-rwxr-xr-x291/CH4/EX4.3c/eg4_3c.sce6
-rwxr-xr-x291/CH4/EX4.3e/eg4_3e.sce8
-rwxr-xr-x291/CH4/EX4.3f/eg4_3f.sce5
-rwxr-xr-x291/CH4/EX4.3g/eg4_3g.sce8
-rwxr-xr-x291/CH4/EX4.4a/eg4_4a.sce8
-rwxr-xr-x291/CH4/EX4.4d/eg4_4d.sce2
-rwxr-xr-x291/CH4/EX4.5a/eg4_5a.sce5
-rwxr-xr-x291/CH4/EX4.5b/eg4_5b.sce2
-rwxr-xr-x291/CH4/EX4.5c/eg4_5c.sce5
-rwxr-xr-x291/CH4/EX4.5d/eg4_5d.sce2
-rwxr-xr-x291/CH4/EX4.5e/eg4_5e.sce8
-rwxr-xr-x291/CH4/EX4.5f/eg4_5f.sce9
-rwxr-xr-x291/CH4/EX4.5g/eg4_5g.sce4
-rwxr-xr-x291/CH4/EX4.6a/eg4_6a.sce9
-rwxr-xr-x291/CH4/EX4.7a/eg4_7a.sce10
-rwxr-xr-x291/CH4/EX4.7b/eg4_7b.sce4
-rwxr-xr-x291/CH4/EX4.9a/eg4_9a.sce6
24 files changed, 201 insertions, 0 deletions
diff --git a/291/CH4/EX4.1a/eg4_1a.sce b/291/CH4/EX4.1a/eg4_1a.sce
new file mode 100755
index 000000000..aa294a0fc
--- /dev/null
+++ b/291/CH4/EX4.1a/eg4_1a.sce
@@ -0,0 +1,47 @@
+p11 = 1/36;
+p12 = 1/36;
+p13 = 1/36;
+p14 = 1/36;
+p15 = 1/36;
+p16 = 1/36;
+p21 = 1/36;
+p22 = 1/36;
+p23 = 1/36;
+p24 = 1/36;
+p25 = 1/36;
+p26 = 1/36;
+p31 = 1/36;
+p32 = 1/36;
+p33 = 1/36;
+p34 = 1/36;
+p35 = 1/36;
+p36 = 1/36;
+p41 = 1/36;
+p42 = 1/36;
+p43 = 1/36;
+p44 = 1/36;
+p45 = 1/36;
+p46 = 1/36;
+p51 = 1/36;
+p52 = 1/36;
+p53 = 1/36;
+p54 = 1/36;
+p55 = 1/36;
+p56 = 1/36;
+p61 = 1/36;
+p62 = 1/36;
+p63 = 1/36;
+p64 = 1/36;
+p65 = 1/36;
+p66 = 1/36;
+disp(p11, "Probability that the sum is 2")
+disp(p12+p21, "Probability that the sum is 3")
+disp(p13+p31+p22, "Probability that the sum is 4")
+disp(p14+p41+p32+p23, "Probability that the sum is 5")
+disp(p15+p51+p24+p42+p33, "Probability that the sum is 6")
+disp(p16+p61+p25+p52+p34+p43, "Probability that the sum is 7")
+disp(p26+p62+p35+p53+p44, "Probability that the sum is 8")
+disp(p36+p63+p45+p54, "Probability that the sum is 9")
+disp(p46+p64+p55, "Probability that the sum is 10")
+disp(p65+p56, "Probability that the sum is 11")
+disp(p66, "Probability that the sum is 12")
diff --git a/291/CH4/EX4.1b/eg4_1b.sce b/291/CH4/EX4.1b/eg4_1b.sce
new file mode 100755
index 000000000..e1d2e8cd4
--- /dev/null
+++ b/291/CH4/EX4.1b/eg4_1b.sce
@@ -0,0 +1,11 @@
+pdd= 0.09;
+pda = 0.21;
+pad = 0.21;
+paa = 0.49;
+
+disp(pdd, "Probability that the number of acceptable components is 0 is")
+disp(pda+pad, "Probability that the number of acceptable components is 1 is")
+disp(paa, "Probability that the number of acceptable components is 2 is")
+disp(pdd, "Probability that I is 0 is")
+
+disp(paa+pad+pda, "Probability that I is 1 is") \ No newline at end of file
diff --git a/291/CH4/EX4.1c/eg4_1c.sce b/291/CH4/EX4.1c/eg4_1c.sce
new file mode 100755
index 000000000..921c2bd00
--- /dev/null
+++ b/291/CH4/EX4.1c/eg4_1c.sce
@@ -0,0 +1,2 @@
+prob = 1-(1-(1/%e));
+disp( prob, "Probability that X exceeds 1 is") \ No newline at end of file
diff --git a/291/CH4/EX4.2a/eg4_2a.sce b/291/CH4/EX4.2a/eg4_2a.sce
new file mode 100755
index 000000000..804e46b4c
--- /dev/null
+++ b/291/CH4/EX4.2a/eg4_2a.sce
@@ -0,0 +1,3 @@
+p1 = 1/2;
+p2 = 1/3;
+disp (1-(p1+p2), "Probability that X is 3 is ") \ No newline at end of file
diff --git a/291/CH4/EX4.2b/eg4_2b.sce b/291/CH4/EX4.2b/eg4_2b.sce
new file mode 100755
index 000000000..cddf29538
--- /dev/null
+++ b/291/CH4/EX4.2b/eg4_2b.sce
@@ -0,0 +1,6 @@
+
+integral = integrate('(4*x)-(2*x*x)' , 'x', 0, 2);
+C = 1/integral;
+disp(C, "The value of C is")
+integral_new = integrate('C*((4*x)-(2*x*x))' , 'x', 0, 1);
+disp(1-integral_new , "Probability that X is greater than 1 is") \ No newline at end of file
diff --git a/291/CH4/EX4.3a/eg4_3a.sce b/291/CH4/EX4.3a/eg4_3a.sce
new file mode 100755
index 000000000..0ab26bc52
--- /dev/null
+++ b/291/CH4/EX4.3a/eg4_3a.sce
@@ -0,0 +1,14 @@
+new = 3;
+working = 4;
+defective =5;
+total = factorial(12)/(factorial(3)*factorial(9));
+disp(factorial(5)/(factorial(3)*factorial(2)*total), "Probability that X=0 and Y=0");
+disp(factorial(5)*factorial(4)/(factorial(3)*factorial(2)*factorial(3)*total), "Probability that X=0 and Y=1");
+disp(factorial(5)*factorial(4)/(factorial(2)*factorial(2)*factorial(4)*total), "Probability that X=0 and Y=2");
+disp(factorial(4)/(factorial(3)*factorial(1)*total), "Probability that X=0 and Y=3");
+disp(factorial(3)*factorial(5)/(factorial(2)*factorial(2)*factorial(3)*total), "Probability that X=1 and Y=0");
+disp(factorial(5)*factorial(4)*factorial(3)/(factorial(2)*factorial(3)*factorial(4)*total), "Probability that X=1 and Y=1");
+disp(factorial(3)*factorial(4)/(factorial(2)*factorial(2)*factorial(2)*total), "Probability that X=1 and Y=2");
+disp(factorial(3)*factorial(5)/(factorial(2)*factorial(4)*factorial(1)*total), "Probability that X=2 and Y=0");
+disp(factorial(3)*factorial(4)/(factorial(2)*factorial(1)*factorial(3)*total), "Probability that X=2 and Y=1");
+disp(factorial(3)/(factorial(3)*total), "Probability that X=3 and Y=3"); \ No newline at end of file
diff --git a/291/CH4/EX4.3b/eg4_3b.sce b/291/CH4/EX4.3b/eg4_3b.sce
new file mode 100755
index 000000000..d7240828d
--- /dev/null
+++ b/291/CH4/EX4.3b/eg4_3b.sce
@@ -0,0 +1,17 @@
+child0 = 0.15;
+child1 = 0.2;
+child2 = 0.35;
+child3 = 0.30;
+pboy = 0.5;
+pgirl = 0.5;
+
+disp(child0 , "Probability that B=0 and G=0")
+disp(child1*pgirl , "Probability that B=0 and G=1")
+disp(child2*pgirl*pgirl , "Probability that B=0 and G=2")
+disp(child3*pgirl*pgirl*pgirl , "Probability that B=0 and G=3")
+disp(child1*pboy , "Probability that B=1 and G=0")
+disp(child2*pgirl*pboy , "Probability that B=1 and G=1")
+disp(child3*pgirl*pgirl*pboy , "Probability that B=1 and G=2")
+disp(child2*pboy*pboy , "Probability that B=2 and G=0")
+disp(child3*pgirl*pboy*pboy , "Probability that B=2 and G=1")
+disp(child3*pboy*pboy*pboy , "Probability that B=3 and G=0")
diff --git a/291/CH4/EX4.3c/eg4_3c.sce b/291/CH4/EX4.3c/eg4_3c.sce
new file mode 100755
index 000000000..01a8b747c
--- /dev/null
+++ b/291/CH4/EX4.3c/eg4_3c.sce
@@ -0,0 +1,6 @@
+intx= integrate('%e^(-x)', 'x',0, 1 );
+inty=integrate('2*%e^(-2*y)', 'y', 0, 1);
+answer = (1-intx)*inty;
+disp(answer , "Probability that X>1 and Y<1 is")
+
+//For other two parts, symbolic manipulations are required \ No newline at end of file
diff --git a/291/CH4/EX4.3e/eg4_3e.sce b/291/CH4/EX4.3e/eg4_3e.sce
new file mode 100755
index 000000000..ce0daaa3c
--- /dev/null
+++ b/291/CH4/EX4.3e/eg4_3e.sce
@@ -0,0 +1,8 @@
+pdec3 = 0.05;
+pdec2= 0.1;
+pdec1 = 0.2;
+p0= 0.3
+pinc1= 0.2;
+pinc2= 0.1;
+pinc3 = 0.05;
+disp(pinc1*pinc2*p0, "Probability that the stock price will increase successively by 1, 2 and 0 points in the next 3 days is") \ No newline at end of file
diff --git a/291/CH4/EX4.3f/eg4_3f.sce b/291/CH4/EX4.3f/eg4_3f.sce
new file mode 100755
index 000000000..a71d15612
--- /dev/null
+++ b/291/CH4/EX4.3f/eg4_3f.sce
@@ -0,0 +1,5 @@
+disp(0.1/0.3875, "probability that B =0 given G=1 ");
+disp(0.175/0.3875, "probability that B =1 given G=1 ");
+disp(0.1125/0.3875, "probability that B =2 given G=1 ");
+disp(0/0.3875, "probability that B =3 given G=1 ");
+//The values are taken from Table 4.2 \ No newline at end of file
diff --git a/291/CH4/EX4.3g/eg4_3g.sce b/291/CH4/EX4.3g/eg4_3g.sce
new file mode 100755
index 000000000..65839531a
--- /dev/null
+++ b/291/CH4/EX4.3g/eg4_3g.sce
@@ -0,0 +1,8 @@
+p00=0.4;
+p01 = 0.2;
+p10 = 0.1;
+p11= 0.3;
+
+pY1= p01+p11;
+disp(p01/pY1, "Probability that X=0 and Y=1")
+disp(p11/pY1, "Probability that X=1 and Y=1") \ No newline at end of file
diff --git a/291/CH4/EX4.4a/eg4_4a.sce b/291/CH4/EX4.4a/eg4_4a.sce
new file mode 100755
index 000000000..03e3cb541
--- /dev/null
+++ b/291/CH4/EX4.4a/eg4_4a.sce
@@ -0,0 +1,8 @@
+p1=1/6;
+p2=1/6;
+p3=1/6;
+p4=1/6;
+p5=1/6;
+p6=1/6;
+expec= p1 + (2*p2)+(3*p3)+(4*p4)+(5*p5)+ (6*p6);
+disp(expec) \ No newline at end of file
diff --git a/291/CH4/EX4.4d/eg4_4d.sce b/291/CH4/EX4.4d/eg4_4d.sce
new file mode 100755
index 000000000..fa8bee4ef
--- /dev/null
+++ b/291/CH4/EX4.4d/eg4_4d.sce
@@ -0,0 +1,2 @@
+expec= integrate('(x)/1.5', 'x', 0,1.5);
+disp("hours", expec, "On an average, you have to wait for ") \ No newline at end of file
diff --git a/291/CH4/EX4.5a/eg4_5a.sce b/291/CH4/EX4.5a/eg4_5a.sce
new file mode 100755
index 000000000..4857aff36
--- /dev/null
+++ b/291/CH4/EX4.5a/eg4_5a.sce
@@ -0,0 +1,5 @@
+p0= 0.2;
+p1= 0.5;
+p2=0.3;
+expec = 0*0*p0 + 1*1*p1 + 2*2*p2;
+disp(expec, "Expectation of X^2 is") \ No newline at end of file
diff --git a/291/CH4/EX4.5b/eg4_5b.sce b/291/CH4/EX4.5b/eg4_5b.sce
new file mode 100755
index 000000000..a2bbb5766
--- /dev/null
+++ b/291/CH4/EX4.5b/eg4_5b.sce
@@ -0,0 +1,2 @@
+expec = integrate('x^3', 'x', 0, 1);
+disp(expec, "The expectation is") \ No newline at end of file
diff --git a/291/CH4/EX4.5c/eg4_5c.sce b/291/CH4/EX4.5c/eg4_5c.sce
new file mode 100755
index 000000000..4857aff36
--- /dev/null
+++ b/291/CH4/EX4.5c/eg4_5c.sce
@@ -0,0 +1,5 @@
+p0= 0.2;
+p1= 0.5;
+p2=0.3;
+expec = 0*0*p0 + 1*1*p1 + 2*2*p2;
+disp(expec, "Expectation of X^2 is") \ No newline at end of file
diff --git a/291/CH4/EX4.5d/eg4_5d.sce b/291/CH4/EX4.5d/eg4_5d.sce
new file mode 100755
index 000000000..a2bbb5766
--- /dev/null
+++ b/291/CH4/EX4.5d/eg4_5d.sce
@@ -0,0 +1,2 @@
+expec = integrate('x^3', 'x', 0, 1);
+disp(expec, "The expectation is") \ No newline at end of file
diff --git a/291/CH4/EX4.5e/eg4_5e.sce b/291/CH4/EX4.5e/eg4_5e.sce
new file mode 100755
index 000000000..066e1d0c5
--- /dev/null
+++ b/291/CH4/EX4.5e/eg4_5e.sce
@@ -0,0 +1,8 @@
+profit1 = 10;
+profit2= 20;
+profit3 = 40;
+prob1= 0.2;
+prob2 = 0.8;
+prob3 = 0.3;
+expec = profit1*prob1 + profit2*prob2 + profit3*prob3;
+disp(" thousand dollars", expec, "The expectd profit is") \ No newline at end of file
diff --git a/291/CH4/EX4.5f/eg4_5f.sce b/291/CH4/EX4.5f/eg4_5f.sce
new file mode 100755
index 000000000..afda4e253
--- /dev/null
+++ b/291/CH4/EX4.5f/eg4_5f.sce
@@ -0,0 +1,9 @@
+//As scilab does not symbolic computations, this example is solved taking N=5
+prob = 1/5 //probability that a letter is put into the right envelope
+EX1 = 1*prob+0*(1-prob);
+EX2 = 1*prob+0*(1-prob);
+EX3 = 1*prob+0*(1-prob);
+EX4 = 1*prob+0*(1-prob);
+EX5 = 1*prob+0*(1-prob);
+EX= EX1 + EX2+ EX3 +EX4 + EX5;
+disp(EX, "Thus, the expectation is") \ No newline at end of file
diff --git a/291/CH4/EX4.5g/eg4_5g.sce b/291/CH4/EX4.5g/eg4_5g.sce
new file mode 100755
index 000000000..95f6ce8ef
--- /dev/null
+++ b/291/CH4/EX4.5g/eg4_5g.sce
@@ -0,0 +1,4 @@
+ProbXiequals1 = 1 - ((19/20)^10);
+EXi = ProbXiequals1 ;
+EX = 20*EXi;
+disp(EX, "The expectation is") \ No newline at end of file
diff --git a/291/CH4/EX4.6a/eg4_6a.sce b/291/CH4/EX4.6a/eg4_6a.sce
new file mode 100755
index 000000000..590bd709c
--- /dev/null
+++ b/291/CH4/EX4.6a/eg4_6a.sce
@@ -0,0 +1,9 @@
+probXequalsi = 1/6;
+expecXsquared = 0;
+for n=1:6
+ expecXsquared = expecXsquared + (n*n*probXequalsi)
+end
+
+expecX= 3.5 // from eg 4.4a
+var = expecXsquared - (expecX^2);
+disp(var, "The variance is")
diff --git a/291/CH4/EX4.7a/eg4_7a.sce b/291/CH4/EX4.7a/eg4_7a.sce
new file mode 100755
index 000000000..98f73141a
--- /dev/null
+++ b/291/CH4/EX4.7a/eg4_7a.sce
@@ -0,0 +1,10 @@
+probXequalsi = 1/6;
+expecXsquared = 0;
+for n=1:6
+ expecXsquared = expecXsquared + (n*n*probXequalsi)
+end
+
+expecX= 3.5 // from eg 4.4a
+var = expecXsquared - (expecX^2);
+var10 = var*10;
+disp(var10, "The variance is") \ No newline at end of file
diff --git a/291/CH4/EX4.7b/eg4_7b.sce b/291/CH4/EX4.7b/eg4_7b.sce
new file mode 100755
index 000000000..28d3932df
--- /dev/null
+++ b/291/CH4/EX4.7b/eg4_7b.sce
@@ -0,0 +1,4 @@
+probIj = 0.5;
+varIj = probIj*(1-probIj);
+var = 10*varIj;
+disp(var, "Thus, the required variance is") \ No newline at end of file
diff --git a/291/CH4/EX4.9a/eg4_9a.sce b/291/CH4/EX4.9a/eg4_9a.sce
new file mode 100755
index 000000000..05efdc7e4
--- /dev/null
+++ b/291/CH4/EX4.9a/eg4_9a.sce
@@ -0,0 +1,6 @@
+avg = 50;
+probX75 = avg/75;
+disp(probX75, "Probability that X>75 is")
+var = 25;
+upperlimit = var/100;
+disp(1-upperlimit, "Probability that X lies between 40 and 60 is") \ No newline at end of file