# Aproximação da solução da EDO y'(t)=1+y(t)^2, ou y'=1+y^2, com y(0)=1.
fn<-function(s){
1+2*s+2*s^2+8*s^3/3+7*s^4/3
}
curve(fn,-3*pi/4+0.1,pi/4-0.1,ylim=c(-5,5),ylab='',lty=2)
# Podemos obter a solução exat por integração.
f<-function(s){
tan(s+pi/4)
}
par(new=TRUE)
curve(f,-3*pi/4+0.1,pi/4-0.1,col="blue",ylim=c(-5,5),ylab='')
legend(0,-0.5, legend=c("Aproximacao", "y(t)"),
col=c("black", "blue"), lty=2:1, cex=0.8)
Erro<-function(s){f(s)-fn(s)}
curve(Erro,-0.25,0.25,lty=2)
To embed this project on your website, copy the following code and paste it into your website's HTML: