Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
21-09-2020IntpoliLag
x=c(9,8,1,6,10,5,3);x y=c(3,2,1,5,12,7,13);y plot(x,y) # Supomos y=f(x) e que f(x_i)=p(x_i), em que p(s)=a_0+a_1s+a_2s^2+a_3s^3+a_4s^4 é um polinômio. # Vamos resolver o problema agora usando a ideia de Lagrange p(s)=y_0L_0(s)+y_1L_1(s)+...+y_(n-1)L_(n-1)(s) n=length(x) L<-function(i,s){ p=1 for (j in 1:n){ if ( i!=j){p=p*(s-x[j])/(x[i]-x[j])} } p } poliLag<-function(s){ p=0 for ( i in 1:n){p=p+y[i]*L(i,s)} p } curve(poliLag,min(x),max(x)) points(x,y,col="red")
run
|
edit
|
history
|
help
0
subset_in_r
Gamma
,k
Example for barplot
Monte Carlo Integration
sinimona
Iron suco fatorial
error de redondeo
Julia set variant 2
Inter-11-03-21