Skip to content

Commit

Permalink
Correção pequena no LaTeX e adicionado código R sobre séries
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoJM committed Nov 1, 2019
1 parent e434df6 commit 24b7cb8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/latex/notes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ \chapter{Série de Taylor e Maclaurim}
Uma função $f$ contínua e infinitamente derivável pode ser representada por uma série de potências da forma
$$
f(x)=
\sum_{n=0}{\infty} \frac{f^{(n)}(a)}{n!} (x-a)^n
\sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!} (x-a)^n
=
f(a)
+ \frac{f'(a)}{1!}(x-a)
Expand Down
30 changes: 30 additions & 0 deletions src/r/Aula 5 - Series (com while).R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Maclaurin<-function(x) {
n<-0
mac<-0
valor<-exp(x)
while(abs(valor-mac)>0.001){
termo<-(x^n)/factorial(n)
mac<-mac+termo
n<-n+1
}
#print(mac)
cat("Maclaurin=",mac,"Numero de interacoes=",n,"\n")
}

b<-1
exp(b)
Maclaurin(b)

Taylor<-function(a,x){
n<-0
tay<-0
valor<-exp(x)
while(abs(valor-tay)>0.01) {
termo <- exp(a)/factorial(n)*(x-a)^n
tay <- tay + termo
n<-n+1
}
cat("Taylor=",tay,"Numero de interacoes=",n,"\n")
}

Taylor(2,1)

0 comments on commit 24b7cb8

Please sign in to comment.