Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
# Bisection (numerical method) - Método da Bissecção
# Bisection (numerical method) - Método da Bissecção #….......................................... # Inserir sua função abaixo: g <- function(x){ x^3 - 6*x^2 - 33*x + 76 } #............................................ bis <- function(f,a,b,tol){ if( f(a)*f(b) > 0){ warning("Não existem raízes no intervalo: [",a,",",b,"]") }else{ while( (b-a)/2 > tol){ fa = f(a) fb = f(b) pm = (a+b)/2 fpm = f(pm) if( fpm*fb < 0){ a <- pm }else{ b <- pm pm <- (a+b)/2 } } } cat("Raíz: ", pm) curve(f, pm - 10, pm + 10) abline(h=0,v=0) points(pm,0, pch = 19, col = 'red') } bis(g,-5,1,0.00001) cat("\n ") bis(g,0,3,0.00001) cat("\n") bis(g,5,10,0.00001)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
hello world
Skewed Right
Why is height normal
Hiring Discrimination
Lote
practica 4
Arithmetic operations in vector
test
Comparison of two normal distributions, example Treatment with HCQ
taylorsen7
Please log in to post a comment.