summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Mathematics_by_John_Bird/CH14
diff options
context:
space:
mode:
authorprashantsinalkar2019-10-04 12:24:07 +0530
committerprashantsinalkar2019-10-04 12:24:07 +0530
commitb3f3a8ecd454359a2e992161844f2fb599f8238a (patch)
tree7bb3f64824627ef179d5f341266a664fd0b69011 /Basic_Engineering_Mathematics_by_John_Bird/CH14
parent80492d3788738910b80dc16f918511057b7321d6 (diff)
downloadR_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/CH14')
-rw-r--r--Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.18/Ex14_18.R31
-rw-r--r--Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.19/Ex14_19.R31
-rw-r--r--Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.22/Ex14_22.R34
-rw-r--r--Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.26/Ex14_26.R27
-rw-r--r--Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.5/Ex14_5.R31
-rw-r--r--Basic_Engineering_Mathematics_by_John_Bird/CH14/EX14.7/Ex14_7.R31
6 files changed, 185 insertions, 0 deletions
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