diff options
author | Prashant S | 2019-10-04 12:27:32 +0530 |
---|---|---|
committer | GitHub | 2019-10-04 12:27:32 +0530 |
commit | ac2986488a9731cff5cbb517d8f0ef98e2561d64 (patch) | |
tree | 7bb3f64824627ef179d5f341266a664fd0b69011 /Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6 | |
parent | cbb2770fb2f88246175add29623103a56ba338b8 (diff) | |
parent | b3f3a8ecd454359a2e992161844f2fb599f8238a (diff) | |
download | R_TBC_Uploads-master.tar.gz R_TBC_Uploads-master.tar.bz2 R_TBC_Uploads-master.zip |
Added R TBC
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6')
-rw-r--r-- | Numerical_Methods_by_E_Balaguruswamy/CH11/EX11.6/Ex11_6.R | 25 |
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 |