Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
23-09-2020IntNewtform
# Forma de Newton por diferenças divididas x=seq(0,1,by=0.1);x f<-function(s){ log(s^2*sin(s)+cos(s)) } curve(f,0,1) y=f(x);y points(x,y,col="red") n=length(x) A=matrix(0,n,n) A[,1]=y for ( i in 2:n){ for (j in 1:(n+1-i)){ A[j,i]=(A[j,i-1]-A[j+1,i-1])/(x[j]-x[j+i-1]) } } A # Polinômio interpolador na forma de Newton # # p(s)=f[x0]+f[x0,x1](x-x0)+f[x0,x1,x2](x-x0)(x-x1)+...+f[x0,x1,x2,...,xn](x-x0)(x-x1)...(x-x(n-1)) N<-function(i,s){ p=1 for (j in 1:i){p=p*(s-x[j])} p } PoliNewt<-function(s){ p=A[1,1] for ( i in 2:(n-1)){p=p+A[1,i]*N(i-1,s)} p } curve(PoliNewt,0,1) points(x,y,col="red")
run
|
edit
|
history
|
help
0
subset_in_r
Inter-11-03-21
lab 1
Pendulum Experiment
Variance Gamma process 3
Mathematical operations 1
Figura
Practice series1(37)
gamma_01
EulerEx2