diff options
Diffstat (limited to 'Basic_Engineering_Mathematics_by_John_Bird')
122 files changed, 2027 insertions, 0 deletions
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.18/Ex11_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.18/Ex11_18.R new file mode 100644 index 00000000..4e355398 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.18/Ex11_18.R @@ -0,0 +1,18 @@ +#page no .95
+#problem 17
+#load package ---->measurements
+library(measurements)
+#functions:
+area_wire = function(p,l,r)
+{
+ return(p*l/r)
+}
+#formula used: R = p*l/a
+#given:
+r = 5 #resistance of wire
+l = 1.5 #lenght in kilmeter
+l1 = conv_unit(l,'km','m')
+p = 17.2 * 10^-6 # resistivity of wire in mm
+p1 = conv_unit(p,'mm','m')
+a = area_wire(p1,l1,r) #area of cross-section of wire
+print(a)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.19/Ex11_19.R b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.19/Ex11_19.R new file mode 100644 index 00000000..e5d76171 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.19/Ex11_19.R @@ -0,0 +1,18 @@ +#page no .95
+#problem 19
+#load package ---->measurements
+library(measurements)
+#functions:
+R = function(p,v,n,t)
+{
+ return((p*v)/(n*t))
+}
+#formula used: pv=nrt
+# r = pv/nt
+#given:
+p = 3 * 10^6 #pressure of gas in pascal
+v = 0.90 #volume of gas
+m = 2.81 #mass of gas in kg
+t = 231 # temperature in kelvin
+r = R(p,v,m,t) #constant
+print(r)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.22/Ex11_22.R b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.22/Ex11_22.R new file mode 100644 index 00000000..84a47792 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.22/Ex11_22.R @@ -0,0 +1,11 @@ +#page no. 96
+#problem 22
+#formula used : s=ut+(1/2)at^2
+# a = ((s-ut)*2)/t^2
+
+#given:
+s = 168 #distance travelled in meter
+u = 10 #initial velocity in m/s
+t = 6 #time in seconds
+a = ((s-u*t)*2)/t^2 # acceleration in m/s^2
+print(a)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.24/Ex11_24.R b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.24/Ex11_24.R new file mode 100644 index 00000000..26ba2554 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.24/Ex11_24.R @@ -0,0 +1,11 @@ +#page no.97
+#problem 24
+#formula used: e=fl/ax
+# x = fl/ae
+
+f = 20*10^6 #force when carrying load
+e = 70 * 10^9 # modulus of elasticity
+a = 0.1 #cross-sectional area
+l = 1.4 # lenght of bar
+x = (f*l)/(a*e) #extension of bar in m
+print(x*1000) #extension in mm
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.28/Ex11_28.R b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.28/Ex11_28.R new file mode 100644 index 00000000..d230f6c1 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH11/EX11.28/Ex11_28.R @@ -0,0 +1,10 @@ +#page no. 97
+#problem 28
+#formula used: D/d = sqrt((f+p)/(f-p))
+# (D/d)^2= (f+p)/(f-p)
+#given:
+D= 21.5
+d = 10.75
+p = 1800
+f = (p*(1+(D/d)^2))/(((D/d)^2)-1) #stress of thick cylinder
+print(f)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.17/Ex13_17.R b/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.17/Ex13_17.R new file mode 100644 index 00000000..0944c8a7 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.17/Ex13_17.R @@ -0,0 +1,22 @@ +#page no . 120
+#problem 17
+# formula used : matrix multiplication
+# x = A(inverse) * B
+#given: c = a+bt
+
+
+ #case 1
+ c1 = 52
+ t1 = 100
+ #eq1 = (52 = a + 100b)
+ #case 2
+ c2 = 172
+ t2 = 400
+ #eq2 = (172 = a+400b)
+
+# for solving a and b, form matrix
+ A = array(data = c(1,1,100,400),dim = c(2,2))
+ B = c(52,172)
+
+ solve(A,B) #value of a and b respectivily
+
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.18/Ex13_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.18/Ex13_18.R new file mode 100644 index 00000000..36e4ec23 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.18/Ex13_18.R @@ -0,0 +1,18 @@ +#page no. 121
+#problem 18
+#given:
+# x+y+z = 4
+# 2x-2y+4z = 33
+#3x-2y-2z = 2
+
+# formula used : matrix multiplication
+# x = A(inverse) * B
+
+A = array(data=c(1,2,3,1,-2,-2,1,4,-2),dim =c(3,3))
+B = c(4,33,2)
+X = solve(A,B)
+cat("x=",X[1]) #value of x
+
+cat("y=",X[2]) #value of y
+
+cat("z=",X[3]) #value of z
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.4/Ex13_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.4/Ex13_4.R new file mode 100644 index 00000000..bd393170 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH13/EX13.4/Ex13_4.R @@ -0,0 +1,9 @@ +#page no. 113
+#problem 4
+# formula used : matrix multiplication
+# x = A(inverse) * B
+
+A = array(data = c(7,6,-2,5), dim = c(2,2))
+B = c(26,29)
+
+solve(A,B) #value of a and b respectivily
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.18/Ex14_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.18/Ex14_18.R new file mode 100644 index 00000000..cd8d6aed --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.18/Ex14_18.R @@ -0,0 +1,31 @@ +#page no. 129
+#problem 18
+
+#function:
+
+# Constructing Quadratic Formula
+roots <- function(a,b,c){
+ if(delta(a,b,c) > 0){ # first case D>0
+ x_1 = (-b+sqrt(delta(a,b,c)))/(2*a)
+ x_2 = (-b-sqrt(delta(a,b,c)))/(2*a)
+ result = c(x_1,x_2)
+ }
+ else if(delta(a,b,c) == 0){ # second case D=0
+ x = -b/(2*a)
+ }
+ else {"There are no real roots."} # third case D<0
+}
+
+# Constructing delta
+delta<-function(a,b,c){
+ b^2-4*a*c
+}
+
+#given: quadratic eq.
+# x^2+2x-8 = 0
+
+a = 1
+b = 2
+c = -8
+x12 = roots(a,b,c) #roots of quadratic equation
+print(x12)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.19/Ex14_19.R b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.19/Ex14_19.R new file mode 100644 index 00000000..f67ccafc --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.19/Ex14_19.R @@ -0,0 +1,31 @@ +#page no. 129
+#problem 18
+
+#function:
+
+# Constructing Quadratic Formula
+roots <- function(a,b,c){
+ if(delta(a,b,c) > 0){ # first case D>0
+ x_1 = (-b+sqrt(delta(a,b,c)))/(2*a)
+ x_2 = (-b-sqrt(delta(a,b,c)))/(2*a)
+ result = c(x_1,x_2)
+ }
+ else if(delta(a,b,c) == 0){ # second case D=0
+ x = -b/(2*a)
+ }
+ else {"There are no real roots."} # third case D<0
+}
+
+# Constructing delta
+delta<-function(a,b,c){
+ b^2-4*a*c
+}
+
+#given: quadratic eq.
+# 3x^2+-11x-4 = 0
+
+a = 3
+b = -11
+c = -4
+x12 = roots(a,b,c) #roots of quadratic equation
+print(x12)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.22/Ex14_22.R b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.22/Ex14_22.R new file mode 100644 index 00000000..cb5509bd --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.22/Ex14_22.R @@ -0,0 +1,34 @@ +#page no. 129
+#problem 18
+
+#function:
+
+
+roots <- function(a, b, c){
+
+ pos_root <- ((-b) + sqrt((b^2) - 4*a*c)) / (2*a)
+
+ neg_root <- ((-b) - sqrt((b^2) - 4*a*c)) / (2*a)
+
+ return(pos_root) #length can not be negative, so take +ve root
+
+ print(neg_root)
+
+}
+
+#given:
+area = 23.6 #area of rectangle
+#l = x #let lenght of rectangle be x
+#b = x -3.10 # breadth is 3.10 shorter than length
+#eq. formed --->area = l*b
+# 23.6 = x*(x-3.10)
+# 23.6 = x^2-3.1x
+# x^2-3.1x-23.6=0
+a = 1
+b = -3.1
+c = -23.6
+x12 = roots(a,b,c) #roots of quadratic equation
+l = x12
+b = x12 - 3.10
+print(l) #length of rectangle
+print(b) #breadth of rectangle
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.26/Ex14_26.R b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.26/Ex14_26.R new file mode 100644 index 00000000..98629397 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.26/Ex14_26.R @@ -0,0 +1,27 @@ +#page no. 131
+#problem 26
+# funtion:
+roots <- function(a, b, c){
+
+ pos_root <- ((-b) + sqrt((b^2) - 4*a*c)) / (2*a)
+
+ neg_root <- ((-b) - sqrt((b^2) - 4*a*c)) / (2*a)
+
+ return(pos_root) #radius can not be negative, so take +ve root
+
+ print(neg_root)
+
+}
+# given: area of cone = (pi*r*l) + pi*r^2
+
+area = 486.2 #area of cone
+l = 15.3 # slant height of cone
+# after placing values we get eq.
+# r^2+15.3r-482.2/pi
+
+a = 1
+b = 15.3
+c = -482.2/pi
+r = roots(a,b,c)
+dia = 2*r #diameter of cone base
+print(dia)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.5/Ex14_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.5/Ex14_5.R new file mode 100644 index 00000000..0ab10241 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.5/Ex14_5.R @@ -0,0 +1,31 @@ +#page no. 125
+#problem 5
+
+#function:
+
+# Constructing Quadratic Formula
+roots <- function(a,b,c){
+ if(delta(a,b,c) > 0){ # first case D>0
+ x_1 = (-b+sqrt(delta(a,b,c)))/(2*a)
+ x_2 = (-b-sqrt(delta(a,b,c)))/(2*a)
+ result = c(x_1,x_2)
+ }
+ else if(delta(a,b,c) == 0){ # second case D=0
+ x = -b/(2*a)
+ }
+ else {"There are no real roots."} # third case D<0
+}
+
+# Constructing delta
+delta<-function(a,b,c){
+ b^2-4*a*c
+}
+
+#given: quadratic eq.
+# x^2+3x-4 = 0
+
+a = 1
+b = 3
+c = -4
+x12 = roots(a,b,c) #roots of quadratic equation
+print(x12)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.7/Ex14_7.R b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.7/Ex14_7.R new file mode 100644 index 00000000..bc58e795 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.7/Ex14_7.R @@ -0,0 +1,31 @@ +#page no. 126
+#problem 7
+
+#function:
+
+# Constructing Quadratic Formula
+roots <- function(a,b,c){
+ if(delta(a,b,c) > 0){ # first case D>0
+ x_1 = (-b+sqrt(delta(a,b,c)))/(2*a)
+ x_2 = (-b-sqrt(delta(a,b,c)))/(2*a)
+ result = c(x_1,x_2)
+ }
+ else if(delta(a,b,c) == 0){ # second case D=0
+ x = -b/(2*a)
+ }
+ else {"There are no real roots."} # third case D<0
+}
+
+# Constructing delta
+delta<-function(a,b,c){
+ b^2-4*a*c
+}
+
+#given: quadratic eq.
+# x^2-5x+6 = 0
+
+a = 1
+b = -5
+c = 6
+x12 = roots(a,b,c) #roots of quadratic equation
+ print(x12)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.1/Ex15_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.1/Ex15_1.R new file mode 100644 index 00000000..cdbe39bf --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.1/Ex15_1.R @@ -0,0 +1,6 @@ +#page no. 135
+#problem 1
+#function used: log(x,base)
+n = 9 # number to evaluate
+base = 3 #log base
+print(log(n,base))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.2/Ex15_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.2/Ex15_2.R new file mode 100644 index 00000000..81fde93f --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.2/Ex15_2.R @@ -0,0 +1,7 @@ +#page no. 135
+#problem 2
+#function used: log10(x)
+#given:
+n = 10 # number to evaluate
+val = log10(n) #log base 10 function
+print(val)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.3/Ex15_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.3/Ex15_3.R new file mode 100644 index 00000000..3427a7e7 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.3/Ex15_3.R @@ -0,0 +1,6 @@ +#page no. 135
+#problem 3
+#function used: log(x,base)
+n = 8 # number to evaluate
+base = 16 #log base 16
+print(log(n,base))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.4/Ex15_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.4/Ex15_4.R new file mode 100644 index 00000000..39b1bc98 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.4/Ex15_4.R @@ -0,0 +1,6 @@ +#page no. 135
+#problem 4
+#function used: log10(x)
+n = 0.001 # number to evaluate
+val = log10(n)
+print(val)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.6/Ex15_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.6/Ex15_6.R new file mode 100644 index 00000000..4e7dd937 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH15/EX15.6/Ex15_6.R @@ -0,0 +1,6 @@ +#page no. 136
+#problem 6
+#function used: log(x,base)
+n = 1/81 # number to evaluate
+base = 3 #log base
+print(log(n,base))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.1/Ex16_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.1/Ex16_1.R new file mode 100644 index 00000000..f1d43b89 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.1/Ex16_1.R @@ -0,0 +1,6 @@ +#page no.141
+#problem 1
+#Function used: exp(x)
+#given:
+print(0.0256*(exp(5.21)-exp(2.49))) #evaluate the following
+
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.15/Ex16_15.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.15/Ex16_15.R new file mode 100644 index 00000000..c81ff162 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.15/Ex16_15.R @@ -0,0 +1,19 @@ +#page no. 147
+#problem 15
+#function:
+log(exp(1))
+
+find_x = function(l,r)
+{
+ #apply log on both sides L.H.S and R.H.S
+ l = log(l) #r = log(exp(3*x))
+ #r = 3*x*log(exp(1)) ------>log(exp(1))=1
+ # to find x
+ return(x=l/r)
+}
+
+#given:
+l = 7/4 # values on L.H.S
+r = 3 # exp power and multiple factor of x
+result = find_x(l,r)
+print(result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.18/Ex16_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.18/Ex16_18.R new file mode 100644 index 00000000..0b76afb0 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.18/Ex16_18.R @@ -0,0 +1,34 @@ +#page no. 147
+#problem 18
+#load package --->measurements
+library(measurements)
+#formula used: alpha = (1/theta)log(R/R0)
+#
+#function:
+
+find_alpha = function(theta,R,R0)
+{
+ return((1/theta)*log(R/R0))
+}
+
+
+find_theta = function(alpha,R,R0)
+{
+ return((1/alpha)*log(R/R0))
+}
+
+#given:
+r0 = 5 #kilo_ohms
+R0 = conv_unit(r0,'km','m') # resistance in ohms
+
+r = 6 #kilo_ohms
+R = conv_unit(r,'km','m') # resistance in ohms
+
+theta = 1500 #temperature in C
+alpha = find_alpha(theta,R,R0)
+
+r_new = 5.4 #kilo_ohm
+R_new = conv_unit(r_new,'km','m')
+theta_new = find_theta(alpha,R_new,R0)
+
+print(theta_new) # temperature to nearest degree
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.19/Ex16_19.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.19/Ex16_19.R new file mode 100644 index 00000000..4183ad95 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.19/Ex16_19.R @@ -0,0 +1,25 @@ +#page no. 147
+#problem 19
+
+#load package --->measurements
+library(measurements)
+#formula used: Q = Q0*exp((-k*t)
+# k = (1/t)log(Q0/Q)------> after applying log on both sides
+#NEWTON's COOLING LAW
+#function:
+
+find_k = function(t,Q0,Q)
+{
+ return((1/t)*log(Q0/Q))
+}
+
+
+#given:
+Q0 = 56.6 #tenperature in C
+
+Q = 16.5 #tenperature in C
+
+t = 76 #time in seconds
+k_constant = find_k(t,Q0,Q)
+
+print(k_constant) # constant value
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.2/Ex16_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.2/Ex16_2.R new file mode 100644 index 00000000..84d58732 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.2/Ex16_2.R @@ -0,0 +1,20 @@ +#page no. 142
+#problem 2
+#function used: exp()
+
+exp_add = function(x,y)
+{
+ return(exp(x)+exp(y))
+}
+
+
+exp_sub = function(x,y)
+{
+ return(exp(x)-exp(y))
+}
+
+#given:
+a = 0.25 #powers of exp
+b = -0.25
+cal = 5*(exp_sub(a,b)/exp_add(a,b)) # evaluate
+print(cal)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.3/Ex16_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.3/Ex16_3.R new file mode 100644 index 00000000..f368a1dd --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.3/Ex16_3.R @@ -0,0 +1,18 @@ +#page no. 142
+#problem 3
+#function used: exp()
+#formula used: v = V*exp(-t/CR)
+#load package ------>measurements
+library(measurements)
+#given:
+
+V = 300 # volts
+t = 50 # time in milliseconds
+t1 = conv_unit(t,'msec','sec') #time in seconds
+c = 10 #in microFarad
+c1 = conv_unit(c,'um','m')
+R = 47 # kilo_ohms
+R1 = conv_unit(R,'km','m')
+
+v =V*exp(-t1/(c1*R1))
+print(v)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.4/Ex16_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.4/Ex16_4.R new file mode 100644 index 00000000..df12e931 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.4/Ex16_4.R @@ -0,0 +1,12 @@ +#page no. 143
+#problem 4
+#function used: factorial()
+exp_expansion = function(x)
+{
+ return(1+(x/1)+(x^2/factorial(2))+(x^3/factorial(3))+(x^4/factorial(4)))
+}
+
+#given:
+n = 0.5 #power of exp
+val = 5*exp_expansion(n)
+print(val)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.5/Ex16_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.5/Ex16_5.R new file mode 100644 index 00000000..2605421f --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH16/EX16.5/Ex16_5.R @@ -0,0 +1,12 @@ +#page no. 143
+#problem 5
+#function used: factorial()
+exp_expansion = function(x)
+{
+ return(1+(x/1)+(x^2/factorial(2))+(x^3/factorial(3))+(x^4/factorial(4)))
+}
+
+#given:
+n = -1 #power of exp
+val = 3*exp_expansion(n)
+print(val)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.1/Ex22_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.1/Ex22_1.R new file mode 100644 index 00000000..dcb7c0df --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.1/Ex22_1.R @@ -0,0 +1,14 @@ +#page no. 221
+#problem 1
+#formula used: pythagoras theorem
+
+hypo = function(base,perp)
+{
+ return(sqrt(base^2+perp^2))
+}
+
+#given:
+p = 4 #perpendicular height of triangle
+b = 3 #base of triangle
+h = hypo(b,p) #hypotenuse of triangle
+print(h)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.10/Ex22_10.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.10/Ex22_10.R new file mode 100644 index 00000000..b7412ee9 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.10/Ex22_10.R @@ -0,0 +1,5 @@ +#page no .225
+#problem 10
+#given:
+angle = 1.481
+sinQ = sin(angle)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.11/Ex22_11.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.11/Ex22_11.R new file mode 100644 index 00000000..9fb8db93 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.11/Ex22_11.R @@ -0,0 +1,7 @@ +#pageno.225
+#problem 11
+#function used: cos()
+#given:
+ angle=3*pi/5
+ cosQ = cos(angle)
+ print(cosQ)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.2/Ex22_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.2/Ex22_2.R new file mode 100644 index 00000000..09e6f62c --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.2/Ex22_2.R @@ -0,0 +1,16 @@ +#page no. 221
+#problem 2
+#formula used: pythagoras theorem
+
+
+prep = function(hypo , base)
+{
+ return(sqrt(hypo^2 - base^2))
+}
+
+
+#given:
+b = 5 #perpendicular height of triangle
+h = 13 #hypotenuse of triangle
+p = prep(h,b) #base of triangle
+print(p)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.3/Ex22_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.3/Ex22_3.R new file mode 100644 index 00000000..3040faa2 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.3/Ex22_3.R @@ -0,0 +1,25 @@ +#page no. 221
+#problem 3
+#formula used: pythagoras theorem
+
+
+hypotenuse = function(base,perp)
+{
+ return(sqrt(base^2+perp^2))
+}
+
+distance = function(speed,time)
+{return(speed*time)}
+
+#given:
+s1 = 300 #speed of one air craft in km/hr
+s2 = 220 #speed of second air craft in km/hr
+time = 4 #In hr
+d1=distance(s1,time) #travels in north
+d2=distance(s2,time) #travels in west
+
+# both airplane make right angle triangle
+d3 = hypotenuse(d1,d2) #distance b/w two airplanes
+print(d3)
+
+
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.4/Ex22_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.4/Ex22_4.R new file mode 100644 index 00000000..f0823af9 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.4/Ex22_4.R @@ -0,0 +1,22 @@ +#page no. 223
+#problem 4
+#formula used: sin=p/h cos=b/h tan=p/b
+
+sinQ = function(x,y)
+{return(x/y)}
+
+cosQ = function(x,y)
+{return(x/y)}
+
+tanQ = function(x,y)
+{return(x/y)}
+
+#given: right angle triangle
+b = 12
+p =5
+h = 13
+cat("sinQ=",sinQ(p,h))
+
+cat("cosQ=",cosQ(b,h))
+
+cat("tanQ=",tanQ(p,b))
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.5/Ex22_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.5/Ex22_5.R new file mode 100644 index 00000000..03909554 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.5/Ex22_5.R @@ -0,0 +1,39 @@ +#page no. 223
+#problem 5
+#formula used: sin=p/h cos=b/h tan=p/b
+
+
+hypotenuse = function(base,perp)
+{
+ return(sqrt(base^2+perp^2))
+}
+
+sinQ = function(x,y)
+{return(x/y)}
+
+cosQ = function(x,y)
+{return(x/y)}
+
+tanQ = function(x,y)
+{return(x/y)}
+
+#given: right angle triangle
+base = 4.62
+perp = 3.47
+height = hypotenuse(base,perp)
+print(height)
+cat("sinC=",sinQ(perp,height))
+
+cat("cosC=",cosQ(base,height))
+
+cat("tanC=",tanQ(perp,base))
+
+# rotate the sides
+b = perp
+p = base
+h = height
+cat("sinA=",sinQ(p,h))
+
+cat("cosA=",cosQ(b,h))
+
+cat("tanA=",tanQ(p,b))
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.6/Ex22_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.6/Ex22_6.R new file mode 100644 index 00000000..108ddeeb --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.6/Ex22_6.R @@ -0,0 +1,45 @@ +#page no. 223
+#problem 6
+#formula used: sin=p/h cos=b/h tan=p/b
+
+
+hypotenuse = function(base,perp)
+{
+ return(sqrt(base^2+perp^2))
+}
+
+sinQ = function(x,y)
+{return(x/y)}
+
+cosQ = function(x,y)
+{return(x/y)}
+
+tanQ = function(x,y)
+{return(x/y)}
+
+
+
+#given: right angle triangle
+ tanB = 8/15 #tan = p/b
+ #according to angle B
+ p = 8 #perpendicular lenght opposite angle B
+ b = 15 #base lenght opposite angle B
+ h = hypotenuse(b,p)
+
+ cat("sinB=",sinQ(p,h))
+
+ cat("cosB=",cosQ(b,h))
+
+ #cat("tanB=",tanQ(p,b))
+
+ #according to angle A
+ base = p#base lenght opposite angle A
+ perp = b#perpendicular lenght opposite angle A
+ height = h
+
+ cat("sinA=",sinQ(perp,height))
+
+ #cat("cosA=",cosQ(base,height))
+
+ cat("tanA=",tanQ(perp,base))
+
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.8/Ex22_8.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.8/Ex22_8.R new file mode 100644 index 00000000..62276316 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.8/Ex22_8.R @@ -0,0 +1,11 @@ +#page no. 225
+#problem 8
+#formula used: sin=p/h cos=b/h tan=p/b
+
+#given:
+angle_degree = 43 # angle in degree
+angle_min = 39 # angle in min
+
+#angel is 43 degree 39 min
+angle = ((angle_degree*60)+angle_min)/60 #conversion of angle into degree
+sinQ = sin(angle)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.9/Ex22_9.R b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.9/Ex22_9.R new file mode 100644 index 00000000..e1a1ca02 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH22/EX22.9/Ex22_9.R @@ -0,0 +1,15 @@ +#page no .225
+#problem 9
+# conversion minutes to degree
+angle = function(x,y)
+{
+ return(((x*60)+y)/60)
+}
+#given:
+angle_degree = 62 # angle in degree
+angle_min = 12 # angle in min
+
+deg = angle(angle_degree,angle_min)
+
+cosQ = cos(deg)
+cat("6cosQ:",6*cosQ)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.10/Ex26_10.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.10/Ex26_10.R new file mode 100644 index 00000000..5971b266 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.10/Ex26_10.R @@ -0,0 +1,27 @@ +#page no. 272
+#problem 10
+# formula used : #formula used : area of rectangle = l*b
+#given:
+l = 6 # length of building
+b = 8#breadth of building
+
+###triangle on top
+base = 8
+base_right = base/2 #base of right angle triangle
+hypo = 5
+height = sqrt(hypo^2 - (base_right^2))
+
+area_rect <- function(x,y) #area of rectangle
+{
+ a = x*y
+ return(a)
+}
+
+area_triangle <- function(x,y) #area of right angle triangle
+{
+ a = (x*y)/2
+ return(a)
+}
+
+area_building = area_rect(l,b) + area_triangle(base,height)
+print(area_building)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.11/Ex26_11.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.11/Ex26_11.R new file mode 100644 index 00000000..e943322e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.11/Ex26_11.R @@ -0,0 +1,12 @@ +#page no.273
+#problem 11
+#formula used: area of circle = pi*r^2
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+#given:
+r = 5 #radius of circle
+print(area_circle(r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.12/Ex26_12.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.12/Ex26_12.R new file mode 100644 index 00000000..454812b2 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.12/Ex26_12.R @@ -0,0 +1,13 @@ +#page no.273
+#problem 12
+#formula used: area of circle = pi*r^2
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+#given:
+dia = 15 #diameter of circle
+r = dia/2 #radius of circle
+print(area_circle(r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.13/Ex26_13.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.13/Ex26_13.R new file mode 100644 index 00000000..76480b64 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.13/Ex26_13.R @@ -0,0 +1,18 @@ +#page no.273
+#problem 13
+#formula used: area of circle = pi*r^2
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+radius_cir <- function(cir)
+{
+ r = cir/(2*pi)
+ return(r)
+}
+#given:
+circ = 70 #circumference of circle
+r = radius_cir(circ) #radius of circle
+print(area_circle(r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.14/Ex26_14.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.14/Ex26_14.R new file mode 100644 index 00000000..2412e61b --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.14/Ex26_14.R @@ -0,0 +1,18 @@ +#page no. 274
+#problem 14
+# formula used : area of sector=(theta/360)*area of circle
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+area_sector<- function(theta,r)
+{
+ a = (theta/360)*area_circle(r)
+}
+
+#given:
+r = 6 #radius of circle
+theta = 50 # angle subtended at center
+print(area_sector(theta,r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.15/Ex26_15.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.15/Ex26_15.R new file mode 100644 index 00000000..47924d96 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.15/Ex26_15.R @@ -0,0 +1,19 @@ +#page no. 274
+#problem 15
+# formula used : area of sector=(theta/360)*area of circle
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+area_sector<- function(theta,r)
+{
+ a = (theta/360)*area_circle(r)
+}
+
+#given:
+dia = 80 #diameter of circle
+r = dia/2 #radius of circle
+theta = 107 # angle subtended at center(107 degree 42 minutes)
+print(area_sector(theta,r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.16/Ex26_16.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.16/Ex26_16.R new file mode 100644 index 00000000..dac38a76 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.16/Ex26_16.R @@ -0,0 +1,16 @@ +#page no. 274
+#problem 16
+#formula used: area of circle = pi*r^2
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+#give:
+D = 5.45 #diameter of outer circle
+d = 2.25 #diameter of inner circle
+R = D/2 #radius of outer circle
+r = d/2 #radius of inner circle
+area_shaft = area_circle(R) - area_circle(r)
+print(area_shaft)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.17/Ex26_17.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.17/Ex26_17.R new file mode 100644 index 00000000..abaab8fc --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.17/Ex26_17.R @@ -0,0 +1,15 @@ +#page no. 275
+#problem 17
+# formula used : area of regular octagon =8*((1/2)*base*height)
+# 8 times area of triangle
+
+area_triangle = function(b,h)
+{
+ return((b*h)/2)
+}
+#given:
+base = 5
+H = 12 # total height across the flat
+h = H/2
+area_octagon=8*area_triangle(base,h)
+print(area_octagon)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.18/Ex26_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.18/Ex26_18.R new file mode 100644 index 00000000..475b65a1 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.18/Ex26_18.R @@ -0,0 +1,17 @@ +#page no. 275
+#problem 18
+# formula used : area of regular hexagon =6*((1/2)*base*height)
+# 6 times area of triangle
+
+area_triangle = function(b,h)
+{
+ return((b*h)/2)
+}
+#given:
+base = 8
+b = base/2 #base of right angle triangle
+hypo = base #hypotenuse of right angle triangle
+h = sqrt(hypo^2 - b^2)
+
+area_hexagon=6*area_triangle(base,h)
+print(area_hexagon)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.2/Ex26_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.2/Ex26_2.R new file mode 100644 index 00000000..a70d8925 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.2/Ex26_2.R @@ -0,0 +1,17 @@ +#page n0.269
+#problem 2
+area_square <- function(x)
+{
+ a = x^2
+ return(a)
+}
+
+peri_square <- function(x)
+{
+ return(p = 4*x)
+
+}
+
+n = 4#side of square
+print(area_square(n))
+print(peri_square(n))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.3/Ex26_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.3/Ex26_3.R new file mode 100644 index 00000000..38ed9024 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.3/Ex26_3.R @@ -0,0 +1,23 @@ +#page no.269
+#problem 3
+#formula used : area of rectangle = l*b
+# perimeter of rectangle = 2*(l+b)
+#given:
+
+l = 7 #length of rectangle
+b = 4.5 #breadth of rectangle
+area_rect <- function(x,y) #area of rectangle
+{
+ a = x*y
+ return(a)
+}
+
+peri_rect <- function(x,y) #perimeter of rectangle
+{
+ return(p = 2*(l+b))
+
+}
+
+print(area_rect(l,b))
+
+print(peri_rect(l,b))
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.4/Ex26_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.4/Ex26_4.R new file mode 100644 index 00000000..ec157a47 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.4/Ex26_4.R @@ -0,0 +1,21 @@ +#page no. 269
+#problem 4
+
+#formula used : area of parallelogram = base * perpendicular height
+#given:
+
+l = 16 #one side of parallelogram
+b = 9 #second side of parallelogram
+L = 21 # distance from one point to another point (horizontally)
+base = L-l #base of right angle triangle
+hypo = b # hypotenuse of right angle triangle
+h = sqrt(hypo^2 - base^2)
+
+
+area_para <- function(x,y) #area of parallelogram
+{
+ a = x*y
+ return(a)
+}
+
+print(area_para(l,h))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.5/Ex26_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.5/Ex26_5.R new file mode 100644 index 00000000..4438c936 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.5/Ex26_5.R @@ -0,0 +1,17 @@ +#page no.271
+#problem 5
+#formula used : area of right angle triangle = base*height/2
+
+#given:
+base = 1.92
+hypo = 5.68
+height = sqrt(hypo^2 - base^2)
+
+
+area_triangle <- function(x,y) #area of right angle triangle
+{
+ a = (x*y)/2
+ return(a)
+}
+
+print(area_triangle(base,height))
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.6/Ex26_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.6/Ex26_6.R new file mode 100644 index 00000000..0e979a01 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.6/Ex26_6.R @@ -0,0 +1,15 @@ +#page no. 271
+#problem 6
+#formula used: area of trapezium = ((sum of parallel sides)*perpendicular distance)/2
+
+#given:
+l1 = 27.4 #length of one parallel side
+l2 = 8.6 # length of 2nd parallel side
+h = 5.5 # perpendicular distance b/w two parallel sides
+area_trapezium <- function(x,y,z) #area of trapezium
+{
+ a = ((x+y)*z)/2
+ return(a)
+}
+
+print(area_trapezium(l1,l2,h))
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.7/Ex26_7.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.7/Ex26_7.R new file mode 100644 index 00000000..0c57907a --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.7/Ex26_7.R @@ -0,0 +1,22 @@ +#page no. 271
+#problem 7
+# formula used : #formula used : area of rectangle = l*b
+#load package ----->measurments
+library(measurements)
+#given:
+l = 820 #length of rectangle in mm
+b = 400 #breadth of rectangle in mm
+area_rect <- function(x,y) #area of rectangle
+{
+ a = x*y
+ return(a)
+}
+area = area_rect(l,b)
+#part(a)
+cat("area in mm^2:",area)
+
+#part(b)
+cat("area in cm^2:",conv_unit(area,'mm2','cm2'))
+
+#part(c)
+cat("area in m^2:",conv_unit(area,'mm2','m2'))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.8/Ex26_8.R b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.8/Ex26_8.R new file mode 100644 index 00000000..6755c459 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH26/EX26.8/Ex26_8.R @@ -0,0 +1,16 @@ +#page no. 271
+#problem 8
+# formula used : #formula used : area of rectangle = l*b
+#given:
+L = 100 #outer length of frame
+B = 50 #outer breadth of frame
+w = 4 # width of frame
+l = L-2*w # inner length of frame
+b = B -2*w #inner breadth of frame
+area_rect <- function(x,y) #area of rectangle
+{
+ a = x*y
+ return(a)
+}
+area_frame = area_rect(L,B) - area_rect(l,b)
+print(area_frame)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.1/Ex27_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.1/Ex27_1.R new file mode 100644 index 00000000..8875da74 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.1/Ex27_1.R @@ -0,0 +1,12 @@ +#page no. 279
+#problem 1
+#formula used: circumference of circle = 2*pi*r
+
+peri_circle = function(r)
+{
+ return(pi*r*2)
+}
+
+#given:
+r = 12 #radius of circle
+print(peri_circle(r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.10/Ex27_10.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.10/Ex27_10.R new file mode 100644 index 00000000..941ac028 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.10/Ex27_10.R @@ -0,0 +1,22 @@ +#page no. 282
+#problem 10
+#formula used: area of circle = pi*r^2
+# cicumference of circle = 2*pi*r
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+radius_cir <- function(cir)
+{
+ r = cir/(2*pi)
+ return(r)
+}
+
+
+#given:
+circ = 60 # circumference of circle
+r = radius_cir(circ)
+area = area_circle(r) #area of circle
+print(area)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.11/Ex27_11.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.11/Ex27_11.R new file mode 100644 index 00000000..f6e125a7 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.11/Ex27_11.R @@ -0,0 +1,10 @@ +#page no. 282
+#problem 11
+#formula used: length of arc = r*theta
+arc_length = function(r,theta)
+{return(r*theta)}
+#given:
+r = 5.5 #radius of circle
+theta = 1.20 # angel subtended at center in radians
+s = arc_length(r,theta) # length of arc
+print(s)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.12/Ex27_12.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.12/Ex27_12.R new file mode 100644 index 00000000..d46f903d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.12/Ex27_12.R @@ -0,0 +1,21 @@ +#page no. 282
+#problem 12
+#formula used: length of arc = r*theta
+
+arc_radius = function(s,theta)
+{return(s/theta)}
+
+peri_circle = function(r)
+{
+ return(pi*r*2)
+}
+
+#given:
+
+s = 4.75 #arc of length
+theta = 0.91 # angle in radian
+r = arc_radius(s,theta)
+dia = 2*r
+print(dia) # diameter of circle
+
+print(peri_circle(r)) # circumference of circle
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.13/Ex27_13.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.13/Ex27_13.R new file mode 100644 index 00000000..b68164b3 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.13/Ex27_13.R @@ -0,0 +1,27 @@ +#page no. 282
+#problem 13
+# formula used: minor arc = r*theta
+# circumference of circle = 2*pi*r
+# major arc = circumference - minor arc
+
+deg2rad <- function(deg) {return((deg * pi) / (180))} #degree to radian
+
+peri_circle = function(r)
+{
+ return(pi*r*2)
+}
+
+arc_length = function(r,theta)
+{return(r*theta)}
+
+#given:
+r = 8.4# radius of circle
+theta = 125 # angle in degree
+rad = deg2rad(theta) #angle in radian
+#part(a)
+minor_arc = arc_length(r,rad)
+print(minor_arc)
+#part(b)
+major_arc = peri_circle(r) - minor_arc
+print(major_arc)
+
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.15/Ex27_15.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.15/Ex27_15.R new file mode 100644 index 00000000..829e4280 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.15/Ex27_15.R @@ -0,0 +1,20 @@ +#page no. 282
+#problem 15
+#formula used: area of sector = (1/2)*r^2*theta
+
+deg2rad <- function(deg)#degree to radian
+ {
+ return((deg * pi) / (180))
+ }
+
+
+area_sector<- function(theta,r)
+{
+ a = (1/2)*r^2*theta
+}
+#given:
+r = 55 #radius of stadium
+theta = 45 #angle in degree
+rad = deg2rad(theta) #angle in radian
+area = area_sector(rad,r) # maximum area
+print(area)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.16/Ex27_16.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.16/Ex27_16.R new file mode 100644 index 00000000..d4758088 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.16/Ex27_16.R @@ -0,0 +1,13 @@ +#page no. 282
+#problem 15
+#formula used: area of sector = (1/2)*r^2*theta
+angle = function(r,area)
+{theta = (area*2)/r^2}
+rad2deg <- function(rad) {return((rad * 180) / (pi))} #radian to degree
+#given:
+r = 1.8 #radius of garden sprayer distance
+area = 2.5 # area of sector sprayed
+theta = angle(r,area) # angle in radian
+print(theta)
+degree = rad2deg(theta) #angle in degree
+print(degree)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.2/Ex27_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.2/Ex27_2.R new file mode 100644 index 00000000..02731d8d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.2/Ex27_2.R @@ -0,0 +1,13 @@ +#page no. 279
+#problem 2
+#formula used: circumference of circle = 2*pi*r
+
+peri_circle = function(r)
+{
+ return(pi*r*2)
+}
+
+#given:
+dia = 75 #diameter of circle
+r = dia/2 #radius of circle
+print(peri_circle(r))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.3/Ex27_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.3/Ex27_3.R new file mode 100644 index 00000000..6cc2d87e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.3/Ex27_3.R @@ -0,0 +1,14 @@ +#page no. 279
+#problem 3
+#formula used: circumference of circle = 2*pi*r
+
+radius_cir <- function(cir)
+{
+ r = cir/(2*pi)
+ return(r)
+}
+
+#given:
+circ = 112
+radius = radius_cir(circ)
+print(radius)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.4/Ex27_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.4/Ex27_4.R new file mode 100644 index 00000000..5504b4c6 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.4/Ex27_4.R @@ -0,0 +1,17 @@ +#page no. 279
+#problem 4
+#formula used: pythagoras theorem
+
+hypotenuse <- function(b,p)
+{
+ h = sqrt(b^2+p^2)
+ return(h)
+}
+
+#given:
+ab = 150 # tangent to circle
+ # act as perpendicular height
+ r = 40 #radius of circle(base)
+ ao = hypotenuse(r,ab)
+ print(ao)
+
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.5/Ex27_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.5/Ex27_5.R new file mode 100644 index 00000000..c3fbbdb9 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.5/Ex27_5.R @@ -0,0 +1,22 @@ +#page no. 280
+#problem 5
+#formula used:
+
+deg2rad <- function(deg) {return((deg * pi) / (180))} #degree to radian
+
+deg2rad_min = function(angle,min) #degree to radian while min are given
+{
+ deg = ((angle*60)+min)/60
+ return(deg2rad(deg))
+}
+#part(a)
+ #given:
+ d1 = 125 # angle in degree
+ print(deg2rad(d1))
+
+
+#part(b)
+ #given:
+ d2_angle = 69 # angle in degree and minutes
+ d2_min = 47 # 69 degree and 47 minutes
+ print(deg2rad_min(d2_angle,d2_min))
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.6/Ex27_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.6/Ex27_6.R new file mode 100644 index 00000000..7c31e6ad --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.6/Ex27_6.R @@ -0,0 +1,15 @@ +#page no. 281
+#problem 6
+#formula used: degrees to minutes
+rad2deg <- function(rad) #radian to degree
+{return((rad * 180) / (pi))}
+
+ #part(a):
+ #given:
+ rad1 = 0.749
+ print(rad2deg(rad1)) #in degree
+
+ #part(b):
+ #given:
+ rad2 = (3*pi)/4
+ print(rad2deg(rad2)) #in degree
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.8/Ex27_8.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.8/Ex27_8.R new file mode 100644 index 00000000..38ca7912 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.8/Ex27_8.R @@ -0,0 +1,13 @@ +#page no. 281
+#problem 8
+#formula used: area of semi circle = area of circle/2
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+#given:
+r = 14.63 #radius of semicircle
+area = (1/2)*area_circle(r) #area of semicircle
+print(area)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.9/Ex27_9.R b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.9/Ex27_9.R new file mode 100644 index 00000000..3a1f1ad7 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH27/EX27.9/Ex27_9.R @@ -0,0 +1,14 @@ +#page no. 282
+#problem 9
+#formula used: area of circle = pi*r^2
+
+area_circle = function(r)
+{
+ return(pi*r^2)
+}
+
+#given:
+dia = 35.0 #diameter of circle
+r = dia/2 #radius of circle
+area = area_circle(r) #area of circle
+print(area)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.1/Ex28_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.1/Ex28_1.R new file mode 100644 index 00000000..9300192d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.1/Ex28_1.R @@ -0,0 +1,14 @@ +# page no. 290
+#formula used: volume of cuboid = l*b*h
+# : surface area of cuboid = 2*(l*b+b*h+l*h)
+
+#given:
+l = 12
+b = 4
+h = 3
+
+volume = l*b*h
+print(volume)
+
+surface_area_of_cuboid = 2*((l*b)+(b*h)+(l*h))
+print(surface_area_of_cuboid)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.11/Ex28_11.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.11/Ex28_11.R new file mode 100644 index 00000000..c925530a --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.11/Ex28_11.R @@ -0,0 +1,15 @@ +#page no.294
+#formula used:volume of pyramid = area of base*perpendicular height/3
+#given: rectangular pyramid
+l = 5 # length of rectangular base
+b = 6 # breadth of rectangular base
+h = 18 # height of rectangular base
+vol_rect = l*b*h # Volume of rectangular base
+print(vol_rect)
+vol_pyramid = vol_rect # volume of pyramid == volume of rectangular metal
+L = 6 #length of casted base
+B = 10 # breadth of casted base
+area_base = L*B # area of base
+H = (3*vol_pyramid)/(area_base) #height of pyramid
+print(H)
+
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.12/Ex28_12.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.12/Ex28_12.R new file mode 100644 index 00000000..c043a048 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.12/Ex28_12.R @@ -0,0 +1,8 @@ +#page no.295
+#Load package -----> measurments
+#formula used: volume of cone = (pi*r^2*h)/3
+
+r = conv_unit(30, 'mm', 'cm') # radius of cone (mm to cm)
+h = conv_unit(80, 'mm', 'cm') # height of cone (mm to cm)
+volume_of_cone = (pi*r^2*h)/3
+print(volume_of_cone)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.13/Ex28_13.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.13/Ex28_13.R new file mode 100644 index 00000000..dc38439f --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.13/Ex28_13.R @@ -0,0 +1,20 @@ +#page no.295
+#formula used: volume of cone = (pi*r^2*h)/3
+# total surface area of cone = pi*r(l+r)
+
+# install.packages("remotes")
+# remotes::install_github("cewalters/r-packages")
+
+r = 5 # radius of cone
+h = 12 # height of cone
+volume_of_cone = (pi*r^2*h)/3
+print(volume_of_cone)
+
+hypotenuse <- function (x, y)
+{
+ sqrt (x ^ 2 + y ^ 2)
+}
+
+l = hypotenuse(r,h) #slant height
+TSA = pi*r*(l+r) # total surface area of cone
+print(TSA)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.15/Ex28_15.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.15/Ex28_15.R new file mode 100644 index 00000000..5842a0bf --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.15/Ex28_15.R @@ -0,0 +1,12 @@ +#page no.296
+#formula used: volume of sphere = (4*pi*r^3)/3
+# surface area of sphere = 4*pi*r^2
+
+area = 201.1 # surface area of sphere
+r = sqrt(area/(4*pi))
+print(r)
+
+dia = 2*r #diameter of sphere
+print(dia)
+volume = (4*pi*r^3)/3 #volume of sphere
+print(volume)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.18/Ex28_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.18/Ex28_18.R new file mode 100644 index 00000000..ed025362 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.18/Ex28_18.R @@ -0,0 +1,11 @@ +#page no. 299
+# formula used : volume of hemisphere = (volume of sphere)/2
+# = (2*pi*r^3)/3
+# surface area of hemisphere=((surface area of sphere)/2)+area of circle
+# = (2*pi*r^2)+(pi*r^2)
+dia = 5.0 #diameter of hemisphere
+r = dia/2
+vol = (2*pi*r^3)/3 #volume of hemisphere
+print(vol)
+area = (2*pi*r^2)+(pi*r^2)#surface area of hemisphere
+print(area)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.23/Ex28_23.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.23/Ex28_23.R new file mode 100644 index 00000000..a966fb83 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.23/Ex28_23.R @@ -0,0 +1,42 @@ +#page no. 300
+# formula used:volume of hemisphere =(2*pi*r^3)/3
+# volume of cone = (pi*r^2*h)/3
+# volume of cylinder = pi*r^2*h
+# surface area of hemisphere=(2*pi*r^2)+(pi*r^2)
+# curved surface area of cylinder= 2*pi*r*h
+# curved surface area of cone = pi*r*l
+# <-----boiler----top-hemisphere
+# middle-cylinder
+# bottom-cone
+
+len = 8 #length of cylinder
+dia = 6 # diameter of cylinder
+r = dia/2
+h = 4 # height of cone
+vol_h = (2*pi*r^3)/3 #volume of hemisphere
+print(vol_h)
+
+vol_Co = (pi*r^2*h)/3#volume of cone
+print(vol_Co)
+
+vol_Cy = pi*r^2*len#volume of cylinder
+print(vol_Cy)
+
+vol_boiler = vol_Co + vol_Cy + vol_h
+print(vol_boiler)
+
+
+hypotenuse <- function (x, y)
+{
+ sqrt (x ^ 2 + y ^ 2)
+}
+
+l = hypotenuse(r,h) #slant height
+
+
+sa_h =(2*pi*r^2)#surface area of hemisphere
+sa_Co =pi*r*l #curved surface area of cone
+sa_Cy =2*pi*r*len#curved surface area of cylinder
+
+sa_total = sa_h + sa_Co + sa_Cy # total surface area of boiler
+print(sa_total)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.24/Ex28_24.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.24/Ex28_24.R new file mode 100644 index 00000000..dd83aa05 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.24/Ex28_24.R @@ -0,0 +1,10 @@ +#page no. 302
+# formula used: volume of frustum = pi*h*((r^2+R^2+R*r))/3
+
+D = 6 #diameter at bigger end
+R = D/2
+d = 4 #diameter at smaller end
+r = d/2
+h = 3.6
+vol = pi*h*((r^2+R^2+R*r))/3 #volume of frustum
+print(vol)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.29/Ex28_29.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.29/Ex28_29.R new file mode 100644 index 00000000..71f6cf1e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.29/Ex28_29.R @@ -0,0 +1,21 @@ +#page no. 302
+# formula used: volume of frustum = pi*h*((r^2+R^2+R*r))/3
+# volume of cylinder = pi*r^2*h
+
+D = 25 #diameter at bigger end
+R = D/2
+d = 12 #diameter at smaller end
+r = d/2
+H = 30 #height of tower
+h = 12 #height of cylinder
+l = H-h # height of frustum
+vol_Cy = pi*R^2*h #volume of cylinder
+print(vol_Cy)
+vol_f = pi*l*((r^2+R^2+R*r))/3 #volume of frustum
+print(vol_f)
+
+vol_tower = vol_Cy + vol_f
+print(vol_tower)
+
+vol_air_space = 0.6 * vol_tower
+print(vol_air_space)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.4/Ex28_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.4/Ex28_4.R new file mode 100644 index 00000000..ed74b56d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.4/Ex28_4.R @@ -0,0 +1,11 @@ +#page no.291
+#formula used: volume of cylinder = pi*r^2*h
+# total surface area = 2*pi*r*(h+r)
+
+dia = 12 #diameter of cylinder
+r = dia/2
+h = 20 #height of cylinder
+volume = pi*r^2*h
+print(volume)
+TSA = 2*pi*r*(h+r) #total surface area of cylinder
+print(TSA)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.5/Ex28_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.5/Ex28_5.R new file mode 100644 index 00000000..8e49ec9b --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.5/Ex28_5.R @@ -0,0 +1,10 @@ +#page no.291
+#formula used: volume of cylinder = (area of cross-section)*length
+
+out_dia = 25#outer diameter of pipe
+in_dia = 12 #inner diameter of pipe
+h = 2.5*100 #lenght of pipe (converted meter to centimeter)
+area_of_cross_section = ((pi*out_dia^2)/4)-((pi*in_dia^2)/4)
+print(area_of_cross_section)
+volume = (area_of_cross_section)*h
+print(volume)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.9/Ex28_9.R b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.9/Ex28_9.R new file mode 100644 index 00000000..2c089aab --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH28/EX28.9/Ex28_9.R @@ -0,0 +1,7 @@ +#page no. 294
+# formula used: volume of pyramid = area of base*perpendicular height/3
+#given: square pyramid
+l = 6 # side of square base
+h = 16 # perpendicular height
+volume = ((l*l)*h)/3
+print(volume)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.1/Ex33_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.1/Ex33_1.R new file mode 100644 index 00000000..fe251936 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.1/Ex33_1.R @@ -0,0 +1,11 @@ +#Page no. 356
+#Function used: mean()
+# median()
+
+x<-c(2,3,7,5,5,13,1,7,4,8,3,4,3) #our Data Set
+
+mean_result = mean(x) #Computing Mean
+print(mean_result)
+
+median_result = median(x)#Computing Median
+print(median_result)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.2/Ex33_2.R b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.2/Ex33_2.R new file mode 100644 index 00000000..be3bb910 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.2/Ex33_2.R @@ -0,0 +1,11 @@ +#Page no. 356
+#Function used: mean()
+# median()
+
+x<-c(27.90,34.70,54.40,18.92,47.60,39.68) #our Data Set
+
+mean_result = mean(x) #Computing Mean
+print(mean_result)
+
+median_result = median(x)#Computing Median
+print(median_result)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.3/Ex33_3.R b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.3/Ex33_3.R new file mode 100644 index 00000000..553a0968 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.3/Ex33_3.R @@ -0,0 +1,18 @@ +#page no. 357
+#Function used:with(),mean(),readLines(),gsub()
+
+
+table_data <- "(value) (frequency)
+ (20.5,20.9] 3
+ (21.0,21.4] 10
+ (21.5,21.9] 11
+ (22.0,22.4] 13
+ (22.5,22.9] 9
+ (23.0,23.4] 2"
+L <- readLines(textConnection(table_data))#read line from connection
+DF <- read.table(text = gsub("[^0-9.]", " ", L), skip = 1, as.is = TRUE)#gsub replaces all occurrences
+
+x <- with(DF, rep((V1 + V2)/2, V3))#computing the intermediate values
+
+mean_result=mean(x)
+print(mean_result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.4/Ex33_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.4/Ex33_4.R new file mode 100644 index 00000000..6803a0af --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.4/Ex33_4.R @@ -0,0 +1,38 @@ +#page no. 357
+#Function used:with(),mean(),readLines(),gsub()
+
+
+table_data <- "(value) (frequency)
+(14.5,15.5] 5
+(16.5,17.5] 8
+(18.5,19.5] 16
+(20.5,21.5] 12
+(22.5,23.5] 6
+(24.5,25.5] 3"
+L <- readLines(textConnection(table_data))#read line from connection
+DF <- read.table(text = gsub("[^0-9.]", " ", L), skip = 1, as.is = TRUE)#gsub replaces all occurrences
+
+x <- with(DF, rep((V1 + V2)/2, V3))#computing the intermediate values
+
+mean_result=mean(x)
+print(mean_result)
+
+median_result=median(x)
+print(median_result)
+
+y <- table(x)
+mode_result = names(y)[which(y==max(y))]
+print(mode_result)
+
+hist(x)
+abline(v = mean_result,
+ col = "royalblue",
+ lwd = 2)
+
+abline(v = median_result,
+ col = "red",
+ lwd = 2)
+
+abline(v = mode_result,
+ col = "orange",
+ lwd = 2)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.5/Ex33_5.R b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.5/Ex33_5.R new file mode 100644 index 00000000..8502fef0 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.5/Ex33_5.R @@ -0,0 +1,6 @@ +#page no. 359
+#function used:var(),sqrt()
+
+x<-c(5,6,8,4,10,3)#data set
+sd.result = sqrt(var(x))#calculating the Standard Deviation
+print(sd.result)#result
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.6/Ex33_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.6/Ex33_6.R new file mode 100644 index 00000000..4fc1747e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH33/EX33.6/Ex33_6.R @@ -0,0 +1,18 @@ +#page no. 359
+#Function used:with(),var(),sqrt(),readLines(),gsub()
+
+
+table_data <- "(value) (frequency)
+(20.5,20.9] 3
+(21.0,21.4] 10
+(21.5,21.9] 11
+(22.0,22.4] 13
+(22.5,22.9] 9
+(23.0,23.4] 2"
+L <- readLines(textConnection(table_data))#read line from connection
+DF <- read.table(text = gsub("[^0-9.]", " ", L), skip = 1, as.is = TRUE)#gsub replaces all occurrences
+
+x <- with(DF, rep((V1 + V2)/2, V3))#computing the intermediate values
+
+sd.result = sqrt(var(x))#calculating the Standard Deviation
+print(sd.result)#result
\ No newline at end of file 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)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.11/Ex35_11.R b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.11/Ex35_11.R new file mode 100644 index 00000000..b114395e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.11/Ex35_11.R @@ -0,0 +1,12 @@ +#page no.376
+#problem 11
+
+#load package ----->deriv
+library(Deriv)
+#funtion used: D()-------> derivative function w.r.t variable
+#given:
+# (3*x^2-5*x)/2*x ----->((3*x)/2) - (5/2) # expression after solving
+y=expression(((3*x)/2) - (5/2))
+
+result = D(y,'x') # differentiation w.r.t 'x'
+print(result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.12/Ex35_12.R b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.12/Ex35_12.R new file mode 100644 index 00000000..a7d0f3d9 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.12/Ex35_12.R @@ -0,0 +1,9 @@ +#page no.377
+#problem 12
+#load package ----->deriv
+library(Deriv)
+#funtion used: D()-------> derivative function w.r.t variable
+#given:
+y=expression((2*x^3/5)-(4/x^3) + (4*sqrt(x^5))+7)
+
+D(y,'x') # differentiation w.r.t 'x'
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.16/Ex35_16.R b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.16/Ex35_16.R new file mode 100644 index 00000000..b7943b5c --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.16/Ex35_16.R @@ -0,0 +1,9 @@ +#page no.379
+#problem 16
+#load package ----->deriv
+library(Deriv)
+#funtion used: D()-------> derivative function w.r.t variable
+#given:
+y=expression(7*sin(2*x) - 3*cos(4*x)) #sin and cos function derivatives
+
+D(y,'x') # differentiation w.r.t 'x'
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.25/Ex35_25.R b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.25/Ex35_25.R new file mode 100644 index 00000000..f1c7f575 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.25/Ex35_25.R @@ -0,0 +1,11 @@ +#page no.382
+#problem 25
+#load package ----->deriv
+library(Deriv)
+#funtion used: D()-------> derivative function w.r.t variable
+#given:
+y=expression(2*x^3/3 - 4/x^2 + 1/2*x -sqrt(x)) #sin and cos function derivatives
+
+D1=D(y,'x') # 1st order differentiation w.r.t 'x'
+D2=D(D1,'x')# 2nd order differentiation w.r.t 'x'
+print(D2)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.6/Ex35_6.R b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.6/Ex35_6.R new file mode 100644 index 00000000..aaa5fe2e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.6/Ex35_6.R @@ -0,0 +1,9 @@ +#page no.376
+#problem 6
+#load package ----->deriv
+library(Deriv)
+#funtion used: D()-------> derivative function w.r.t variable
+#given:
+y=expression(5*sqrt(x))
+
+D(y,'x') # differentiation w.r.t 'x'
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.9/Ex35_9.R b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.9/Ex35_9.R new file mode 100644 index 00000000..2338b74e --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH35/EX35.9/Ex35_9.R @@ -0,0 +1,9 @@ +#page no.376
+#problem 9
+#load package ----->deriv
+library(Deriv)
+#funtion used: D()-------> derivative function w.r.t variable
+#given:
+y=expression(((2*x^4)/3)-(4/x^3)+9)
+
+D(y,'x') # differentiation w.r.t 'x'
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.18/Ex36_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.18/Ex36_18.R new file mode 100644 index 00000000..a098f867 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.18/Ex36_18.R @@ -0,0 +1,8 @@ +#page no. 392
+#problem 18
+#function: integrate(expression,lower,upper) --->in-built function
+f = function(x) (4-x^2) #function defination --->expression
+
+lower_limit = -2
+upper_limit = 3
+integrate(f,lower_limit,upper_limit) #evaluating the integral value over limits
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.20/Ex36_20.R b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.20/Ex36_20.R new file mode 100644 index 00000000..62053f58 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.20/Ex36_20.R @@ -0,0 +1,8 @@ +#page no. 392
+#problem 20
+#function: integrate(expression,lower,upper) --->in-built function
+f = function(x) (x^3-5*x+1) #function defination --->expression
+
+lower_limit = -1
+upper_limit = 1
+integrate(f,lower_limit,upper_limit) #evaluating the integral value over limits
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.22/Ex36_22.R b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.22/Ex36_22.R new file mode 100644 index 00000000..e257638d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.22/Ex36_22.R @@ -0,0 +1,8 @@ +#page no. 393
+#problem 22
+#function: integrate(expression,lower,upper) --->in-built function
+f = function(x) (3*sin(2*x)) #function defination --->expression
+
+lower_limit = 0
+upper_limit = pi/2
+integrate(f,lower_limit,upper_limit) #evaluating the integral value over limits
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.24/Ex36_24.R b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.24/Ex36_24.R new file mode 100644 index 00000000..708ca20d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH36/EX36.24/Ex36_24.R @@ -0,0 +1,8 @@ +#page no. 393
+#problem 24
+#function: integrate(expression,lower,upper) --->in-built function
+f = function(x) (4*exp(2*x)) #function defination --->expression
+
+lower_limit = 1
+upper_limit = 2
+integrate(f,lower_limit,upper_limit) #evaluating the integral value over limits
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.10/Ex37_10.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.10/Ex37_10.R new file mode 100644 index 00000000..8cf5a234 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.10/Ex37_10.R @@ -0,0 +1,21 @@ +#page no. 405
+#problem 10
+#function:
+term = function(a,n,d) # to find term value
+{
+ return(a+((n-1)*d))
+}
+#given:
+a6 = 17 #6th term of sequence---->(a+5d=17)
+a13 = 38 #13th term of sequence---->(a+12d=38)
+
+# using matrix method X=A(inverse)*B
+# we will find a(first value) and d(common difference) values
+
+A = array(data = c(1,1,5,12),dim = c(2,2))
+B = c(17,38)
+X = solve(A,B) # calculating a and d
+a = X[1] #first number of sequence
+d = X[2] # common difference of AP(airthmetic progression)
+a19 = term(a,19,d) # n = 19, to find 19th term of sequence
+print(a19)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.12/Ex37_12.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.12/Ex37_12.R new file mode 100644 index 00000000..f2f92590 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.12/Ex37_12.R @@ -0,0 +1,15 @@ +#page no.406
+#problem 12
+#formula used: Sn = (n/2)*(2a+(n-1)d) -->sum of n terms in AP
+#function:
+Sn = function(n,a,d) #function --->sum of n terms
+{
+ return((n/2)*(2*a+(n-1)*d))
+}
+#given:
+n = 12
+seq = c(5,9,13,17)
+a = seq[1] #first term of sequence
+d = seq[2]-seq[1] # common difference
+sum_ap = Sn(n,a,d) # sum of n-terms
+print(sum_ap)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.14/Ex37_14.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.14/Ex37_14.R new file mode 100644 index 00000000..8860f3b2 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.14/Ex37_14.R @@ -0,0 +1,15 @@ +#page no. 406
+#problem 14
+#formula used: Sn = (n/2)*(2a+(n-1)d) -->sum of n terms in AP
+# a = [2*Sn/n-(n-1)d]/2
+#function:
+find = function(Sn,n,d)
+{
+ return((((2*Sn)/n)-((n-1)*d))/2)
+}
+#given:
+S7 = 35 #sum of 7 terms
+n = 7 # number of terms
+d = 1.2 # common difference
+find_a = find(S7,n,d) # first term of sequence
+print(find_a)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.16/Ex37_16.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.16/Ex37_16.R new file mode 100644 index 00000000..44c8d8ac --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.16/Ex37_16.R @@ -0,0 +1,46 @@ +#page no.407
+#problem 16
+#load package ---->pastecs,----->dyplr
+library(dplyr)
+library(pastecs)
+#funtion used:
+
+term_n = function(a,d,an) #function ---> to find number of terms
+{
+ return(((an-a)/d)+1)
+}
+
+Sn = function(n,a,d) #function --->sum of n terms
+{
+ return((n/2)*(2*a+(n-1)*d))
+}
+
+#given:(0 to 207) AP divisible by 3
+
+a1 = 0 #starting of range
+e1 = 207 #end of range
+
+result <- vector("numeric") # prepare a container to store value
+# divisible by 3 from (0 to 207)
+for (i in c(a1:e1))
+{
+ if (i%%3 == 0)
+ {
+ result[i] <- i
+ }
+}
+
+seq = complete.cases(result) #removing the NA values from vector
+
+seq1 = c(result[seq]) #creating new vector
+
+seq2 = array(data = c(seq1)) #sequence (3,6,9....207)
+ #creating for accessing the
+ # values divisible by 3
+
+a = seq2[1] #first number of sequence
+d = seq2[2] - seq2[1] #common difference
+an = last(seq2)
+n = term_n(a,d,an)
+sum_terms = Sn(n,a,d) #sum of n-terms in AP
+print(sum_terms)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.20/Ex37_20.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.20/Ex37_20.R new file mode 100644 index 00000000..163b0d28 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.20/Ex37_20.R @@ -0,0 +1,18 @@ +#page no.409
+#problem 20
+#formula used: an = ar^(n-1)
+#function:
+find_r = function(an,a,n) #function to find common ratio
+ {return((an/a)**(1/(n-1)))}
+#given:
+a = 12 #first term of GP
+a5 = 55 #5th term of GP (ar^4)
+n = 5 #fith term given
+r = find_r(a5,a,n) #common ratio
+
+#part(a)
+a8 = a*r^7
+print(a8)
+#part(b)
+a11 = a*r^10
+print(a11)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.22/Ex37_22.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.22/Ex37_22.R new file mode 100644 index 00000000..192322cc --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.22/Ex37_22.R @@ -0,0 +1,15 @@ +#page no.409
+#problem 22
+#formula used: an = ar^(n-1)
+# sum = a(1-r^n)/(1-r)
+#function:
+Sn= function(a,r,nn) #function to find ---> sum of n-terms
+{return(a*(1-r^n)/(1-r))}
+
+#given:
+seq = c(72.0,57.6,46.08) # GP sequence given
+a = seq[1] #1st term of sequence
+r = seq[2]/seq[1] # common ratio of sequence
+n = 9 # 9 terms
+sum_n = Sn(a,r,n) #sum of 9 terms
+print(sum_n)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.23/Ex37_23.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.23/Ex37_23.R new file mode 100644 index 00000000..0365cf1b --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.23/Ex37_23.R @@ -0,0 +1,14 @@ +#page no.409
+#problem 23
+#formula used: an = ar^(n-1)
+# S2inf=a/(1-r)
+#function:
+S2inf= function(a,r)
+ {return(a/(1-r))}
+
+#given:
+seq = c(3,1,1/3) # GP sequence to infinity.......
+a = seq[1] #1st term of sequence
+r = seq[2]/seq[1]
+sum_inf = S2inf(a,r) #sum to infinity
+print(sum_inf)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.4/Ex37_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.4/Ex37_4.R new file mode 100644 index 00000000..2fc85ef6 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH37/EX37.4/Ex37_4.R @@ -0,0 +1,19 @@ +#page no. 404
+#problem 4
+#given:
+term = function(n) # to find term value
+ {
+ return(3*n+1)
+}
+ # first four term of the sequence will be a1,a2,a3,a4
+a1 = term(1)
+a2 = term(2)
+a3 = term(3)
+a4 = term(4)
+
+cat("1st term::",a1)
+cat("2nd term::",a2)
+cat("3rd term::",a3)
+cat("4th term::",a4)
+
+
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.1/Ex5_1.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.1/Ex5_1.R new file mode 100644 index 00000000..e9e1d0ce --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.1/Ex5_1.R @@ -0,0 +1,7 @@ +#page no.36
+#problem 1
+#laod package ------->formattable
+library(formattable)
+#function used: percent()
+n = 0.015 #decimal to percentage
+percent(n)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.10/Ex5_10.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.10/Ex5_10.R new file mode 100644 index 00000000..b0f3602d --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.10/Ex5_10.R @@ -0,0 +1,19 @@ +#page no.37
+#problem 10
+#function:
+#percentage of given quantity
+percent_of_quantity = function(x,y) # x---->percenatge, y----->quantity
+{
+ return((percent2deci(x))*y)
+}
+
+percent2deci = function(x)
+{
+ return(x/100)
+}
+
+#given:
+p = 27 #percentage
+n = 65 # amount of money
+result = percent_of_quantity(p,n)
+print(result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.12/Ex5_12.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.12/Ex5_12.R new file mode 100644 index 00000000..bd18d448 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.12/Ex5_12.R @@ -0,0 +1,20 @@ +#page no.38
+#problem 12
+#function:
+#percentage of given quantity
+percent_of_quantity = function(x,y) # x---->percenatge, y----->quantity
+{
+ return((percent2deci(x))*y)
+}
+
+percent2deci = function(x)
+{
+ return(x/100)
+}
+
+#given:
+cost = 190 #base price of ipod
+VAT = 20 # VAT percentage
+VAT1 = percent_of_quantity(VAT,cost)
+result = VAT1 + cost #total cost of iPod (VAT+BASE price)
+print(result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.14/Ex5_14.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.14/Ex5_14.R new file mode 100644 index 00000000..2bcba223 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.14/Ex5_14.R @@ -0,0 +1,15 @@ +#page no.38
+#problem 14
+#load package ---->measurements
+library(measurements)
+#functions:
+percent_one_wrt_second = function(x,y)
+{
+ return(percent(x/y))
+}
+#given:
+t1 = 47 #time in minutes
+t2 = 2 #time in hours
+t2 = conv_unit(t2,'hr','min')
+result = percent_one_wrt_second(t1,t2)
+print(result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.15/Ex5_15.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.15/Ex5_15.R new file mode 100644 index 00000000..6636c188 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.15/Ex5_15.R @@ -0,0 +1,12 @@ +#page no. 38
+#problem 15
+#function:
+percent_change = function(n,o) #n----> new value, o----> original value
+{
+ return(percent((n-o)/o))
+}
+#given:
+new_value = 52 #resistor value
+original_value = 45 #resistor value increases
+change = percent_change(new_value,original_value)
+print(change)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.18/Ex5_18.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.18/Ex5_18.R new file mode 100644 index 00000000..6457c222 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.18/Ex5_18.R @@ -0,0 +1,14 @@ +#page no. 39
+#problem 18
+#function:
+per_error = function(err,val) #err-->error, val ---> correct value
+{
+ return(percent(err/val))
+}
+
+#given:
+cal_vol = 50 #calculated voltage
+ac_vol = 50.4 #actual voltage
+error = ac_vol - cal_vol # error in measurements
+result = per_error(error,ac_vol) #percentage error
+print(result)
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.21/Ex5_21.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.21/Ex5_21.R new file mode 100644 index 00000000..b0b5b75a --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.21/Ex5_21.R @@ -0,0 +1,15 @@ +#page no. 40
+#problem 21
+#formula used:(new value/100-+change%)*100%
+#function:
+original_value_profit = function(new,change) #new----> new value, change in percentage
+{
+ return((new/(100+change))*100)
+
+}
+
+#given:
+c = 40 #change in percentage (profit)
+SP = 630# selling price ---->new value
+result = original_value_profit(SP,c) #cost to dealer
+print(result)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.23/Ex5_23.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.23/Ex5_23.R new file mode 100644 index 00000000..67b55368 --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.23/Ex5_23.R @@ -0,0 +1,8 @@ +#page no. 40
+#problem
+#formula used: new value = (100 + %increase)*original value/100
+#given:
+inc = 6.5 #price increased in percentage
+cost = 2400 #original cost of boiler
+new_price = (((100 + inc)*cost)/100) #new price of boiler
+print(new_price)
\ No newline at end of file diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.4/Ex5_4.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.4/Ex5_4.R new file mode 100644 index 00000000..39bdfbbc --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.4/Ex5_4.R @@ -0,0 +1,10 @@ +#page no.36
+#problem 4
+#function used:
+percent2deci = function(x)
+{
+ return(x/100)
+}
+#given:
+n = 17.5 # percentage
+print(percent2deci(n))
diff --git a/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.7/Ex5_7.R b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.7/Ex5_7.R new file mode 100644 index 00000000..fde3d0cd --- /dev/null +++ b/Basic_Engineering_Mathematics_by_John_Bird/CH5/EX5.7/Ex5_7.R @@ -0,0 +1,10 @@ +#page no.36
+#problem 7
+#laod package ------->formattable
+library(formattable)
+#function used: percent()
+n1 = 57/79 #fraction to percentage
+n2 = 49/67 #fraction to percentage
+
+percent(n1)
+percent(n2)
|