Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
17-08-2020Ex2.1.1
# Minimo para resolver equação f(x)=0. c=c(8, 1, 1, 0, 2, 20, 9, 2, 1, 1, 2, 1, 11,2, 0, 3, 2, 1, -8, 1, 2, 1, 2, 3, 10) A=matrix(c,5,5,byrow=TRUE); A # Entrada da matriz A v=c(1,2,3,4,5); v # Entrada do vetor v f<-function(u){ # Definição de função f(u), para resolver a equação f(u)=0 A%*%u-v } g<-function(u){ t(f(u)) %*% f(u)/2 } gradg<-function(u){ t(A)%*%(A%*%u-v) } # Método de Euler ZeroEuler<-function(u0,t,n){ u=u0 h=t/n for (i in 1:n){ u=u-h*gradg(u) } u } # Teste u0=c(1,1,2,0,1); t=10; n=100000 u=ZeroEuler(u0,t,n) ; u # Aproximadamente u(100) f(u)
run
|
edit
|
history
|
help
0
3dgraphics-and-curvesb
James 2
Mathematical operations
2
Change text from ALL CAPS to Title Case
Which one is which !
26-08-2020AjusteCurvab
dataset1
Test
Delete True Values