Euler's method | Numerial methods
TileStats TileStats
18K subscribers
505 views
0

 Published On Aug 8, 2023

https://www.tilestats.com/
1. A simple example
2. How to solve with some code in R (4:10)
3. The importance of using a small step size (07:40)
4. How to solve two differential equations (08:05)

y0=70
k=0.2
dt=1
t=seq(0,40,dt)
Y=NULL
Y[1]=y0
for (i in 1:(length(t)-1)){
Y[i+1]=Y[i]-k*Y[i]*dt
}
plot(t,Y,type="l",col="blue")
Analytic solution
yy=y0*exp(-k*t)
lines(t,yy,col="red")

show more

Share/Embed