Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
03-08-2020-Integral-Numerica
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
# Integral Numerica f<-function(x){sin(x)+cos(x)} # g'(x)=f(x) descobrir quanto vale g(1), sabendo que g(0)=0 g<-function(x){-cos(x)+sin(x)+0} f(0) h=0.00001; a=0; b=1; n=(b-a)/h;n g1=0+h*f(0) # aproximadamente g(0+h) = g(0)+h*f(0)+Erro g1 g2=g1+h*f(0+h) # aproximadamente g(0+2h) = g(h)+h*f(0+h)+Erro g2 # Generico Ifn<-function(a,b,n){ # aproximação da integral de f de a até b h=(b-a)/n p=0 for ( i in 0:(n-1)){ p=p+h*f(0+i*h) } p } Ifn(a,b,n) # aproximadamente g(1) g(1)-g(0)
[
+
]
Show input
Absolute running time: 0.67 sec, cpu time: 1.05 sec, memory peak: 47 Mb, absolute service time: 0,98 sec
edit mode
|
history
|
discussion