summaryrefslogtreecommitdiff
path: root/Numerical_Methods_by_E_Balaguruswamy/CH4/EX4.10/Ex4_10.R
diff options
context:
space:
mode:
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH4/EX4.10/Ex4_10.R')
-rw-r--r--Numerical_Methods_by_E_Balaguruswamy/CH4/EX4.10/Ex4_10.R35
1 files changed, 35 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH4/EX4.10/Ex4_10.R b/Numerical_Methods_by_E_Balaguruswamy/CH4/EX4.10/Ex4_10.R
new file mode 100644
index 00000000..b2d8c768
--- /dev/null
+++ b/Numerical_Methods_by_E_Balaguruswamy/CH4/EX4.10/Ex4_10.R
@@ -0,0 +1,35 @@
+# Example 10 Chapter 4 Page no.: 77
+# Error propagation
+
+# Given Values
+x <- 2.35
+y <- 6.74
+z <- 3.45
+
+#Given Arithmetic operation
+w <- x*y +z
+
+#Roundoff error in x,y &z
+erx <- 5E-3
+ery <- 5E-3
+erz <- 5E-3
+
+cat("Roundoff error in x,y &z is",erx,",",ery,"&",erz)
+
+#Error in x,y&z
+
+ex <- x*erx
+ey <- y*ery
+ez <- z*erz
+cat("Error in x=",ex)
+cat("Error in y=",ey)
+cat("Error in z=",ez)
+
+# Error in x*y
+exy <- x*ey + y*ex
+cat("Absolute Error in x*y=",exy)
+
+# Absolute error in computing w
+ew <- exy + ez
+cat("Absolute error in computing w=",ew)
+