Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
EulerSIR
# Movimento de pêndulo simples # # N=73774 # parâmetros da Equação beta=1.68 gama=0.44 a=0 # tempo inicial S0=N-1 # condições iniciais I0=1 R0=0 b=14 # tempo final em segundos n=20 h=(b-a)/n t=seq(a,b,by=h) # vetor com inverlados entre a e b, de h em h. y=matrix(0,3,n+1) # espaço para guardar as aproximações y_0, y_1, y_2, ..., y_15. y[,1]=c(S0,I0,R0) # y_0 F<-function(s,u){ # Equação y'(t)=F(t,y(t)) S=u[1]; I=u[2]; R=u[3] c(-beta*S*I/N, beta*S*I/N-gama*I, gama*I) } for ( i in 1:n){ # Método de Euler y[,i+1]=y[,i]+h*F(t[i],y[,i]) # t_i=a+(i-1)*h } plot(t,y[1,],'l') # Linha 1 de y plot(t,y[2,],'l') # linha 2 de y plot(t,y[3,],'l') # linha 3 de y plot(y[1,],y[2,],'l') # linha 1 e 2 de y y[,n+1] # aproximação para y(14)=(S(14), I(14),R(14)).
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Data Transformation
errores resta
Ex11-03-21EdsonAmanda
Camelcase
number game 2
error de redondeo
Sampling Distribution for the Wald-Wolfowitz 2-Sample Runs Test
Erro padrão
Sentiment Analysis - using input field
Ex15-12
Please log in to post a comment.