Skip to content

Commit

Permalink
Adicionado arquivo feito em aula de séries (R)
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoJM committed Oct 11, 2019
1 parent 7c36bea commit 35200c0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/r/Aula 4 - Series.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Serie de Taylor e MacLaurim

x <- 3
taylor <- exp(2) + exp(2) * (x - 2) + exp(2)*(x-2)^2/factorial(2) + exp(2)*(x-2)^3/factorial(3) + exp(2)*(x-2)^4/factorial(4)
maclaurim <- 1 + x + x^2/factorial(2) + x^3/factorial(3) + x^4 / factorial(4)

taylor
maclaurim
exp(x)



# Serie de Taylor generica

N <- 100
a <- 2
f <- exp(a)
x <- -1
taylor <- 0

for(n in 0:N) {
termo <- (f * ((x - a)^n)) / factorial(n)
taylor <- taylor + termo
}

taylor
exp(x)

0 comments on commit 35200c0

Please sign in to comment.