summaryrefslogtreecommitdiff
path: root/Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6
diff options
context:
space:
mode:
authorprashantsinalkar2019-10-04 12:24:07 +0530
committerprashantsinalkar2019-10-04 12:24:07 +0530
commitb3f3a8ecd454359a2e992161844f2fb599f8238a (patch)
tree7bb3f64824627ef179d5f341266a664fd0b69011 /Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6
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 'Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6')
-rw-r--r--Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6/Ex11_6.R25
1 files changed, 25 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6/Ex11_6.R b/Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6/Ex11_6.R
new file mode 100644
index 00000000..fb55e716
--- /dev/null
+++ b/Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6/Ex11_6.R
@@ -0,0 +1,25 @@
+# Example 6 Chapter 11 Page no.: 359
+# Estimating Acceleration
+
+T <- c(5,6,7,8,9) # Time
+S <- c(10.0,14.5,19.5,25.5,32.0) # Distance
+
+#distance time function
+ss <- function(t1){
+ s <- S[t1-4]
+ return(s)
+}
+
+#Difference value h
+h1 <- 1
+
+#Acceleration is given by second derivative of distance
+
+a <- function(t,h){
+ return((ss(t+h)-(2*ss(t))+ss(t-h))/(h^2))
+}
+
+h1 <- 1
+t1 <- 7 # given time
+
+cat("Acceleration of car at t=",t1,"s is",a(t1,h1),"km/s^2") \ No newline at end of file