Let y = f(x) be the solution to the differential equation (dy/dx) = x + y with the initial condition f(1) = 2. What is the approximation for f(2) if Euler's method is used, starting at x = 1 with a step size of 0.5?
l'm not too keen on Euler's method, if anyone cares to enlighten me, or better yet... twist a red hot knife into my innards. Be my guest.
I dont think finding f(2) is possible....
f'(x)=x+f(x)--------->
f'''(x)=(x)''+f''(x)=f''(x)----->
f''(x)=c1*ex------->
f(x)=c1*ex+c2*x+c3
f(1)=c1*e+c2+c3=2-------------->
c3=2-c2-c1*e
f(2)=c1*e2+c2*2+c3=
c1*e2+c2+2-c1*e
edit: OH SHOOT I FORGOT SOMETHING
f'(x)=c2+c1*ex=x+c3+c2*x+c1*ex | subtract c1*ex ----->
c2=x+c3+c2*x. therefore, c2=-1(the only option. that means c3=c2=-1 and that means
f(1)=c1*e-2=2 therefore c1=4/e
that means f(2)=4*e-2-1=4e-3.
You are right not to be keen on Euler's method, especially with a step size this large - see the comparison below:
.
Hm l think l've developed a method of doing a shortened Eulers method, I got the same answer afterwards. It may help!
yn - (dy/dx) * (step size) = yn+1