diff options
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH6/EX6.11/Ex6_11.R')
-rw-r--r-- | Numerical_Methods_by_E_Balaguruswamy/CH6/EX6.11/Ex6_11.R | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH6/EX6.11/Ex6_11.R b/Numerical_Methods_by_E_Balaguruswamy/CH6/EX6.11/Ex6_11.R new file mode 100644 index 00000000..f36ea8e8 --- /dev/null +++ b/Numerical_Methods_by_E_Balaguruswamy/CH6/EX6.11/Ex6_11.R @@ -0,0 +1,21 @@ +# Example 11 Chapter 6 Page no.: 161
+# Fixed point method
+
+# Installing and importing package 'spuRs'
+install.packages("spuRs")
+library("spuRs")
+
+#Given function when converted in terms of 'x'
+f <- function(x){
+ 2-(x^2)
+}
+cat("Let initial value be 0")
+x0 <- 0
+
+F1 <- fixedpoint(f,x0)
+cat("Root is",F1)
+
+cat(" Let us assume x0=-1")
+x0 <-1
+F2 <- fixedpoint(f,x0)
+cat("Another Root is",F2)
|