diff options
author | prashantsinalkar | 2019-10-04 12:24:07 +0530 |
---|---|---|
committer | prashantsinalkar | 2019-10-04 12:24:07 +0530 |
commit | b3f3a8ecd454359a2e992161844f2fb599f8238a (patch) | |
tree | 7bb3f64824627ef179d5f341266a664fd0b69011 /Basic_Engineering_Mathematics_by_John_Bird/CH34 | |
parent | 80492d3788738910b80dc16f918511057b7321d6 (diff) | |
download | R_TBC_Uploads-b3f3a8ecd454359a2e992161844f2fb599f8238a.tar.gz R_TBC_Uploads-b3f3a8ecd454359a2e992161844f2fb599f8238a.tar.bz2 R_TBC_Uploads-b3f3a8ecd454359a2e992161844f2fb599f8238a.zip |
Initial commit/added all books
Diffstat (limited to 'Basic_Engineering_Mathematics_by_John_Bird/CH34')
9 files changed, 163 insertions, 0 deletions
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.1/Ex34_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.1/Ex34_1.R new file mode 100644 index 00000000..843e91ce --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.1/Ex34_1.R @@ -0,0 +1,16 @@ +#page no.363
+
+n = 20 # no. of men
+w = 33 # no. of women
+total = n+w # total no. of people
+
+prob_of_men = n/total
+print(prob_of_men)
+
+prob_of_women = w/total
+print(prob_of_women)
+
+if((prob_of_men + prob_of_women)==1)
+{
+ print("no error")
+}
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.2/Ex34_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.2/Ex34_2.R new file mode 100644 index 00000000..9245904a --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.2/Ex34_2.R @@ -0,0 +1,15 @@ +#page no. 363
+
+#Load package ------> dice
+library(dice)
+
+
+## Probability of rolling no 4's when rolling three six-sided dice
+
+E=getEventProb(nrolls = 3, # number of dice rolls to make
+ ndicePerRoll = 1,# number of dice to use in each dice roll
+ nsidesPerDie = 6,# number of sides on each die
+ eventList = list(4),
+ orderMatters = FALSE)
+
+print(E)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.3/Ex34_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.3/Ex34_3.R new file mode 100644 index 00000000..6a125e44 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.3/Ex34_3.R @@ -0,0 +1,17 @@ +#page no. 364
+#problem 3
+
+n = 10 # number of horses
+win <- function(a,b)# a--->number of winner in race
+ # b---> total number of particpants
+{
+ winner <- a/b
+ return(winner)
+}
+#part(a)
+prob_of_winning = win(1,n)
+print(prob_of_winning)
+
+# part(b)
+prob_of_two_races = win(1,n) * win(1,n)
+print(prob_of_two_races)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.4/Ex34_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.4/Ex34_4.R new file mode 100644 index 00000000..11b94c85 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.4/Ex34_4.R @@ -0,0 +1,18 @@ +#page no. 364
+#problem 4
+#given:
+prob_temp = 1/20#probability of failing due to temperature
+prob_vib = 1/25 #probability of failing due to vibration
+prob_hum = 1/50 #probability of failing due to humidity
+
+#part(a)
+prob_a = prob_temp * prob_vib # fails--> temperature and vibration
+print(prob_a)
+
+#part(b)
+prob_b =prob_vib + prob_hum # fails--> humidity or vibration
+print(prob_b)
+
+#part(c)
+prob_c = (1-prob_temp) * (1-prob_hum) # NOT_fails--> temperature and humidity
+print(prob_c)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.5/Ex34_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.5/Ex34_5.R new file mode 100644 index 00000000..52248966 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.5/Ex34_5.R @@ -0,0 +1,22 @@ +# page no. 365
+#problem 5
+#given:
+n = 100 #total number of capacitors
+n_t = 73 # capacitors within req. tolerance values
+n_bt = 17 # capacitors within req. tolerance values below
+n_at = n-(n_t+n_bt) #capacitors within req. tolerance values above
+
+probability <-function(a,b)
+{
+ prob = a/b
+ return(prob)
+}
+
+#part(a) ----> probability with replacement
+prob_n_t = probability(n_t,n) * probability(n_t,n)
+print(prob_n_t)
+
+# part(b) ------> probability one below and second above tolerance values
+# without replacement
+prob_a_b = probability(n_bt,n) * probability(n_at,n-1)
+print(prob_a_b)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.6/Ex34_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.6/Ex34_6.R new file mode 100644 index 00000000..d58bee7d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.6/Ex34_6.R @@ -0,0 +1,22 @@ +#page no. 366
+#problem 6
+
+n = 40 #total number of components
+n_d = 5 # number of defective components
+n_g = n - n_d #number of good components
+
+probability <-function(a,b)
+{
+ prob = a/b
+ return(prob)
+}
+
+#part(a)
+#with replacement (probability of good)
+prob_a = probability(n_g,n) * probability(n_g,n)
+print(prob_a)
+
+#part(b)
+#without replacement(probability of good)
+prob_b = probability(n_g,n) * probability(n_g-1,n-1)
+print(prob_b)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.7/Ex34_7.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.7/Ex34_7.R new file mode 100644 index 00000000..357f687f --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.7/Ex34_7.R @@ -0,0 +1,26 @@ +#page no. 366
+#problem 7
+
+n = 40 #total number of components
+n_d = 5 # number of defective components
+n_g = n - n_d #number of good components
+
+probability <-function(a,b)
+{
+ prob = a/b
+ return(prob)
+}
+
+prob_def = probability(n_d,n)
+print(prob_def)
+prob_good = probability(n_g,n)
+print(prob_good)
+#part(a)
+#with replacement (probability of one defective component )
+prob_a = (prob_def * prob_good) + (prob_good * prob_def)
+print(prob_a)
+
+#part(b)
+#without replacement(probability of one defective component)
+prob_b = (prob_def * probability(n_g,n-1))+(prob_good * probability(n_d,n-1))
+print(prob_b)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.8/Ex34_8.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.8/Ex34_8.R new file mode 100644 index 00000000..74042c82 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.8/Ex34_8.R @@ -0,0 +1,9 @@ +#page no.= 366
+
+b = 74 #no. of brass washers
+s = 86 #no. of steel washers
+a = 40 #no. of aluminium washers
+t = b+s+a # total no. of washers
+
+probability = (s/t)*((s-1)/(t-1))*((s-2)/(t-2))#probability that all three are steel washers
+print(probability)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.9/Ex34_9.R b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.9/Ex34_9.R new file mode 100644 index 00000000..2d3bd63d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH34/EX34.9/Ex34_9.R @@ -0,0 +1,18 @@ +#page no. 366
+#problem 9
+
+
+b = 74 #no. of brass washers
+s = 86 #no. of steel washers
+a = 40 #no. of aluminium washers
+t = b+s+a # total no. of washers
+a_n = t - a # no. of not aluminium washers
+
+prob<-function(a,b)
+{
+ probability = a/b
+ return(probability)
+}
+# probability without replacement that no aluminium washer drwan
+prob_n_alum = prob(a_n,t) *prob(a_n-1,t-1)*prob(a_n-2,t-2)
+print(prob_n_alum)
|