Euler's method estimate y(2)
h=0.5, y(1)=2, y'=t^2+1-y
I tried to use \[f_{n}=f_{n-1}+hf(x_{0},y_{0})\]
@ganeshie8
okay so what did you get for the value f(t_0,y_0)?
|dw:1411859877265:dw|
y'=f(t,y) so i want to actually find f(1,2)=1^2+1-2=f(y0) then we can find y1=y0+hf(y0) then we can find y2=y1+hf(y1) and so on...
f(1,2)=0
ok so y1=2+.5(0)=2 then y2=y1+hf(y_1)
t1 would be 1.5 in that case and you already found y1 which is 2
\[t_n=t_0+nh\]
y2=2+0.5(1.25)
2.625
y3=2.625+0.5(f(2,2.625))?
yes
and we have \[y_n \approx y(t_n) \text{ so } y_2 \approx y(t_2)=y(t_0+2*h)=y(1+2*.5)=y(1+1)=y(2)\] so it looks like we only need to go just to y_2
we only needed to go to y2 because we were asked to estimate y(2)
i wonder if that is a good approximation
yes, it is
we could use runge trapezoidal
for better aprox
\[y'+y=t^2+1 \\ e^t y'+e^ty=e^t(t^2+1)\\ (e^ty)'=e^t(t^2+1) \\ e^t y=e^t(2t+1)-e^t(2+0)+C \\ y=2t+1-2+Ce^{-t} \\ y(1)=2 \text{ gives us } \\ 2=2+1-2+Ce^{-1} \\ 1=Ce^{-1} \\ C=e \\ y=2t-1+e^{-t+1} \\ y(2)=4-1+e^{-1}=3+e^{-1} \approx 3.368\] if i did everything right
oops i made a booboo
\[y'+y=t^2+1 \\ e^t y'+e^ty=e^t(t^2+1)\\ (e^ty)'=e^t(t^2+1) \\ e^t y=e^t(t^2+1)-e^t(2t+0)+2e^t+C \\ y=t^2+1-2t+2+Ce^{-t} \\ y(1)=2 \text{ gives us } \\ 2=1^2+1-2+2+Ce^{-1} \\ 0=Ce^{-1} \\ C=0 \\ y=t^2-2t+3 \\ y(2)=2^2-2(2)+3=4-4+3=3\]
this was a linear differential equation
first order*
first order linear differential equaiton you can solve these by finding an integrating factor
like the first line i multiplied by e^t so i could write the left hand side as (e^ty)' because (e^ty)'=(e^t)'y+e^t(y)' =e^t*y+e^t *y'
the other side perform integration by parts but wait you should know this i think euler's method comes after this
Join our real-time social learning platform and learn together with your friends!