Because it's wrong.porcupineman23 said:Hey
I don't understand this backward euler solution, in particular why the f(y,t+h) is equal to y(t+2)
I agree with you there!Chestermiller said:Because it's wrong.
Actually, it should be y(t+h)=y(t)+h*y'(t+h). Given that y'(t)=-y(t), this becomes y(t+h)=y(t)-h*y(t+h), or y(t+h)=y(t)/(1+h).It should be:
y(t+2)=y(t)+y'(t+2)h
Better: ##y(t+2)=\frac {y(t)}{3}##.Solving for y(t+2) gives:
y(t+2)=\frac{y(t)}{1+2h}
Chet
Thanks DH. I'm usually more careful about checking over what I've written before I submit my replies. I hope I didn't confuse the OP too much.D H said:I agree with you there!
Actually, it should be y(t+h)=y(t)+h*y'(t+h). Given that y'(t)=-y(t), this becomes y(t+h)=y(t)-h*y(t+h), or y(t+h)=y(t)/(1+h).
Better: ##y(t+2)=\frac {y(t)}{3}##.
You've already set h=2.