Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Área sob curvas de funções: Integração numérica utilizando a regra do ponto médio.
#.........................# # by: Berg Silva # #.........................# ex = function(x) exp(-x) area <- function(fx,a,b,n){ deltax = (b-a)/n intervalos = seq(a,b,deltax) ponto.medio = c() for( i in 1:n){ ponto.medio[i] = (intervalos[i+1] + intervalos[i])/2 } s = c() for(i in 1:n){ s[i] = fx(ponto.medio[i])*deltax } plot(fx, col = "purple",a,b,tcl = 0.2,bty = "l",panel.first= grid(16,16),ylab = "f(x)",lwd = 1.5) abline(h=0,v=0) polygon(x = c(a,seq(a,b,l=50),b) , y = c(0,fx(seq(a,b,l=50)),0), col = "darkorange", density = 30, border = F) segments(a,0,a,fx(a),col = "purple", lty = 2) segments(b,0,b,fx(b),col= "purple",lty =2) cat("\n A área sob a curva no intervalo ","[",a,",",b,"]", "é: ", sum(s)) } area(ex,0,2,10000)
run
|
edit
|
history
|
help
0
3dgraphics-and-curvesb
jcruet_bi variate r regression
As1-1
Tidyverse: Estructuras
Mobile-Sprite-image-Interval
Quiz 2
Vector
Football weights
SimulacaoItaly-17-02-2021
Integracao-Interpolacaa