Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sqrt - Bisection
# Square root of a real number - Bisection root <- function(number,tol = 0.00001){ bis <- function(f,a=0,b=number,tol){ while( (b-a)/2 > tol){ fa = f(a) fb = f(b) pm = (a+b)/2 fpm = f(pm) if(fpm == 0){ return(pm) break; } if( fpm*fb < 0){ a <- pm }else{ b <- pm pm <- (a+b)/2 } } cat("Root: ", pm) curve(f, pm - 10, pm + 10) abline(h=0,v=0) points(pm,0, pch = 19, col = 'red') } f <- function(x){ x^2 - number } return(bis(f,0,number,tol)) } root(1.4)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Leap Year Finder
Sierpinski curve square
survey histograms stats and fats
SimulacaoItaly-17-02-2021-linearizado
14-09-2020GRamLD
Bootstrap Method
5 # SUMMARY PART B
Erro padrão
direct_assignment
Critical correlation value calculation
Please log in to post a comment.