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/CH37 | |
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/CH37')
8 files changed, 163 insertions, 0 deletions
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)
+
+
|