summaryrefslogtreecommitdiff
path: root/3689/CH12
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3689/CH12
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '3689/CH12')
-rw-r--r--3689/CH12/EX12.1/12_1.sce10
-rw-r--r--3689/CH12/EX12.10/12_10.sce14
-rw-r--r--3689/CH12/EX12.12/12_12.sce20
-rw-r--r--3689/CH12/EX12.2/12_2.sce11
-rw-r--r--3689/CH12/EX12.3/12_3.sce8
-rw-r--r--3689/CH12/EX12.4/12_4.sce10
-rw-r--r--3689/CH12/EX12.5/12_5.sce11
-rw-r--r--3689/CH12/EX12.6/12_6.sce11
-rw-r--r--3689/CH12/EX12.7/12_7.sce11
-rw-r--r--3689/CH12/EX12.8/12_8.sce22
-rw-r--r--3689/CH12/EX12.9/12_9.sce26
11 files changed, 154 insertions, 0 deletions
diff --git a/3689/CH12/EX12.1/12_1.sce b/3689/CH12/EX12.1/12_1.sce
new file mode 100644
index 000000000..bc5efee83
--- /dev/null
+++ b/3689/CH12/EX12.1/12_1.sce
@@ -0,0 +1,10 @@
+////Varible declaration
+
+Prob = 0
+for x = 1:51
+ Prob = 1/(x) + Prob
+end
+Prob1=1.0
+//Results
+printf("\n Probability of picking up any one ball is %3.1f",Prob1)
+
diff --git a/3689/CH12/EX12.10/12_10.sce b/3689/CH12/EX12.10/12_10.sce
new file mode 100644
index 000000000..35e196d72
--- /dev/null
+++ b/3689/CH12/EX12.10/12_10.sce
@@ -0,0 +1,14 @@
+////
+//Variable Declaration
+fi = 1 //Probability of receiving any card
+n = 52 //Number od Cards
+
+//Calculations
+sum = 0
+for i = 1:52
+ sum = sum + fi
+end
+Pxi = (fi/sum)
+
+//Results
+printf("\n Probability of receiving any card is %f', Pxi)
diff --git a/3689/CH12/EX12.12/12_12.sce b/3689/CH12/EX12.12/12_12.sce
new file mode 100644
index 000000000..85cade508
--- /dev/null
+++ b/3689/CH12/EX12.12/12_12.sce
@@ -0,0 +1,20 @@
+////
+//Variable Declaration
+//r = Symbol('r') //Radius of inner circle
+C = list(5,2,0)
+//Calculations
+A1 = %pi
+A2 = %pi*(2)**2 - A1
+A3 = %pi*(3)**2 - (A1 + A2)
+At = A1 + A2 + A3
+f1 = A1/At
+f2 = A2/At
+f3 = A3/At
+sf = f1 + f2 + f3
+
+ns = (f1*C(1)+f2*C(2)+f3*C(3))/sf
+
+//Results
+printf("\n A1, A2, A3:%f*r**2 %f*r**2 %f*r**2 ', A1, A2, A3)
+printf("\n f1, f2, f3: %f %f %f', f1,f2,f3)
+printf("\n Average payout $ %f ',((ns)))
diff --git a/3689/CH12/EX12.2/12_2.sce b/3689/CH12/EX12.2/12_2.sce
new file mode 100644
index 000000000..a6ba80b97
--- /dev/null
+++ b/3689/CH12/EX12.2/12_2.sce
@@ -0,0 +1,11 @@
+////
+//Variable Declaration
+n = 52 //Total cards
+nheart = 13 //Number of cards with hearts
+
+//Calculations
+Pe = (nheart/n)
+
+//Results
+printf("\n Probability of one (heart)card picked from a std. stack of %d cards is %f",n,Pe)
+
diff --git a/3689/CH12/EX12.3/12_3.sce b/3689/CH12/EX12.3/12_3.sce
new file mode 100644
index 000000000..31943959e
--- /dev/null
+++ b/3689/CH12/EX12.3/12_3.sce
@@ -0,0 +1,8 @@
+////Variable Declaration
+n = 52 //Total cards
+
+//Calculations
+TotalM = n*(n-1)*(n-2)*(n-3)*(n-4)
+//Results
+printf("\n Total number of Five card arrangment from a deck of 52 cards is %d",TotalM)
+
diff --git a/3689/CH12/EX12.4/12_4.sce b/3689/CH12/EX12.4/12_4.sce
new file mode 100644
index 000000000..3503441f3
--- /dev/null
+++ b/3689/CH12/EX12.4/12_4.sce
@@ -0,0 +1,10 @@
+////Variable Declaration
+n1 = 2 //Two spin states for 1st electron in orbit 1
+n2 = 2 //Two spin states for 2nd electron in orbit 2
+
+//Calculation
+M = n1*n1
+
+//Results
+printf("\n Possible spin states for excited state are %2d",M)
+
diff --git a/3689/CH12/EX12.5/12_5.sce b/3689/CH12/EX12.5/12_5.sce
new file mode 100644
index 000000000..3522f34ec
--- /dev/null
+++ b/3689/CH12/EX12.5/12_5.sce
@@ -0,0 +1,11 @@
+////
+//Variable Declaration
+n = 12 //Total Number of players
+j = 5 //Number player those can play match
+
+//Calculation
+P = factorial(n)/factorial(n-j)
+
+//Results
+printf("\n Maximum Possible permutations for 5 player to play are %8d",P)
+
diff --git a/3689/CH12/EX12.6/12_6.sce b/3689/CH12/EX12.6/12_6.sce
new file mode 100644
index 000000000..249c99e64
--- /dev/null
+++ b/3689/CH12/EX12.6/12_6.sce
@@ -0,0 +1,11 @@
+////
+//Variable Declaration
+n = 52 //Number of cards in std . pack
+j = 5 //Number of cards in subset
+
+//Calculation
+C = factorial(n)/(factorial(j)*factorial(n-j))
+
+//Results
+printf("\n Maximum Possible 5-card combinations are %8d",C)
+
diff --git a/3689/CH12/EX12.7/12_7.sce b/3689/CH12/EX12.7/12_7.sce
new file mode 100644
index 000000000..891732901
--- /dev/null
+++ b/3689/CH12/EX12.7/12_7.sce
@@ -0,0 +1,11 @@
+////
+//Variable Declaration
+x = 6 //Number of electrons
+n = 2 //Number of states
+
+//Calculation
+P = factorial(x)/(factorial(n)*factorial(x-n))
+
+//Results
+printf("\n Total number of quantum states are %3d",P)
+
diff --git a/3689/CH12/EX12.8/12_8.sce b/3689/CH12/EX12.8/12_8.sce
new file mode 100644
index 000000000..845b46c31
--- /dev/null
+++ b/3689/CH12/EX12.8/12_8.sce
@@ -0,0 +1,22 @@
+//////
+//Variable Declaration
+n = 50 //Number of separate experiments
+j1 = 25 //Number of sucessful expt with heads up
+j2 = 10 //Number of sucessful expt with heads up
+
+//Calculation
+C25 = factorial(n)/(factorial(j1)*factorial(n-j1))
+PE25 = (1/2)**j1
+PEC25 = (1-(1/2))**(n-j1)
+P25 = C25*PE25*PEC25
+
+C10 = factorial(n)/(factorial(j2)*factorial(n-j2))
+PE10 = (1/2)**j2
+PEC10 = (1-(1/2))**(n-j2)
+P10 = C10*PE10*PEC10
+
+//Results
+printf("\n Probability of getting 25 head out of 50 tossing is %4.3f",P25)
+
+printf("\n Probability of getting 10 head out of 50 tossing is %4.3e",P10)
+
diff --git a/3689/CH12/EX12.9/12_9.sce b/3689/CH12/EX12.9/12_9.sce
new file mode 100644
index 000000000..4678e367c
--- /dev/null
+++ b/3689/CH12/EX12.9/12_9.sce
@@ -0,0 +1,26 @@
+//////Variable Declaration
+N = [10,50,100] //Valures for N
+
+//Calculations
+printf("\n N ln(N!) ln(N!)sterling Error')
+for i =10
+
+ lnN = log(factorial(i))
+ lnNs = i*log(i)-i
+ err = abs(lnN-lnNs)
+ printf('\n%3d %5.2f %5.2f %4.2f',i,lnN,lnNs, err)
+end
+for i =50
+
+ lnN = log(factorial(i))
+ lnNs = i*log(i)-i
+ err = abs(lnN-lnNs)
+ printf('\n%3d %5.2f %5.2f %4.2f',i,lnN,lnNs, err)
+end
+for i =100
+
+ lnN = log(factorial(i))
+ lnNs = i*log(i)-i
+ err = abs(lnN-lnNs)
+ printf('\n%3d %5.2f %5.2f %4.2f',i,lnN,lnNs, err)
+end