Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
19-08-2020-JacobiSistema
# Método de Gauss-Jacobi c=c(3,2,1,2,3,2,1,1,3) b=c(39,34,26) b A=matrix(c,3,3) A c=0*b B=0*A Gjacobi<-function(A,b,erro){ n=length(b) Erro=erro+1 for ( i in 1:n){ c[i]=b[i]/A[i,i] B[i,]=A[i,]/A[i,i] B[i,i]=0 } x=0*b cont=1 while (Erro>=erro){ y=x x=c-B%*%y cont=cont+1 Erro=sum(abs(x-y)) if (cont>=10^6){Erro=0}} x } x=Gjacobi(A,b,10^(-6)) x A%*%x GSeidel<-function(A,b,erro){ n=length(b) Erro=erro+1 for ( i in 1:n){ c[i]=b[i]/A[i,i] B[i,]=A[i,]/A[i,i] B[i,i]=0 } x=0*b cont=1 while (Erro>=erro){ y=x for (i in 1:n){ x[i]=c[i]-B[i,]%*%x} cont=cont+1 Erro=sum(abs(x-y)) if (cont>=10^6){Erro=0}} x } x=GSeidel(A,b,10^(-6)) x A%*%x
run
|
edit
|
history
|
help
0
gh
root of a real number (bisection)
31-08-2020-Exemplo AjusteNaoL
24-08-2020-GradConj
Grade.r
Children in Canada
plot_cars
Área de un cuadrado
Sierpinski curve square
Quiz 2