summaryrefslogtreecommitdiff
path: root/Numerical_Methods_by_E_Balaguruswamy/CH6/EX6.11/Ex6_11.R
blob: f36ea8e88f2385a7c8c453514e792b8e58b36e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)