Application of the Backward Euler method to the DE ...

1.4k Views Asked by At

I'm having trouble solving this question below and would like to have some help:

Apply the Backward Euler method to the differential equation:

$y' = -20y + 20\cos (t) - \sin (t)$, $0\leq t\leq 2$, $y(0)=0$, with $h=0.25$; actual solution $y(t)=-e^{20t} + \cos(t)$.

Use Newton's method to solve for $w_{i+1}$. So far, I have this code:Maple Code for Backward Euler Method

1

There are 1 best solutions below

2
On BEST ANSWER

What you have above is almost correct, assuming that you want to substitute a high-level solver for the Newton's method. Your mistakes:

  1. You are missing a minus sign in the exponent of the actual solution.
  2. Your loop should go to 7, not 9. Going to 7 gives you 9 points.
  3. Use fsolve instead of solve: y[k+1]:= fsolve(...);
  4. Get rid of the line with evalf and min because fsolve already takes care of that.