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 ...
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#.........................# # 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)
[
+
]
Show input
edit mode
|
history
|
discussion