diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1475/CH2/EX2.22/Example_2_22.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1475/CH2/EX2.22/Example_2_22.sce')
-rwxr-xr-x | 1475/CH2/EX2.22/Example_2_22.sce | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/1475/CH2/EX2.22/Example_2_22.sce b/1475/CH2/EX2.22/Example_2_22.sce new file mode 100755 index 000000000..db8410d0a --- /dev/null +++ b/1475/CH2/EX2.22/Example_2_22.sce @@ -0,0 +1,20 @@ +// Example 2.22 Two defective tube lights are mixed
+clc;
+clear;
+n=3;
+N=10;
+p=2/10;
+m=n*p;
+q=1-p;
+var=n*p*q;
+S_d=sqrt(var);
+Np=N*p;
+Nq=N*q;
+disp(S_d,"Standard Deviation",var,"Variance",m,"Mean is n*p =",p,"probab. of defective items",N,"Total sample of item");
+function value = hyper(Np,Nq,N,n, x)
+value = (factorial(Np)*factorial(Nq)*factorial(N-n)*factorial(n))/(factorial(Np-x)*factorial(x)*factorial(n-x)*factorial(Nq-(n-x))*factorial(N));
+endfunction
+f_0=hyper(Np,Nq,N,n,0);
+f_1=hyper(Np,Nq,N,n,1);
+f_2=hyper(Np,Nq,N,n,2);
+disp(f_0,"Probability of 0 defective tube light in the sample of 3 is ",f_1,"Probability of 1 defective tube light in the sample of 3 is ",f_2,"Probability of 2 defective tube light in the sample of 3 is ",);
|