diff options
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.7/Ex12_7.R')
-rw-r--r-- | Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.7/Ex12_7.R | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.7/Ex12_7.R b/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.7/Ex12_7.R new file mode 100644 index 00000000..45c19d99 --- /dev/null +++ b/Numerical_Methods_by_E_Balaguruswamy/CH12/EX12.7/Ex12_7.R @@ -0,0 +1,16 @@ +# Example 7 Chapter 12 Page no.: 391
+# Romberg Estimation
+
+# Installing and importing 'pracma' library
+install.packages("pracma")
+library("pracma")
+
+#Given function
+f <- function(x){
+ return(1/x)
+}
+
+#Romberg function
+u <- romberg(f,1 ,2)
+
+cat("The value of Romberg integration of 1/x is",u$value,"and relative error is",u$rel.error,"completed in",u$iter,"iterations" )
\ No newline at end of file |