Euler's Method and Backwards Euler
It's always a good idea to begin your page with a "restart" command -- so when re-running
commands, you can start with a blank slate.
> |
I will use our example equation from class.
> |
> |
Maple easily solves our initial value problem.
> |
Let's approximate using a step size of . This means we need iterations.
> |
Here's Euler's Method.
and (from our initial condition)
> |
Our approximation of is . I let's print out a decimal approximation of .
> |
The exact value of is given below:
> |
The difference between the exact value and the approximated value gives us the "global truncation error".
> |
Here's Backwards Euler's Method.
Recall the Backwards Euler's is an implicit method. So we need to solve
for each time through the loop.
and (from our initial condition)
> |
Our approximation of is . I let's print out a decimal approximation of .
> |
The exact value of is given below:
> |
The difference between the exact value and the approximated value gives us the "global truncation error".
> |
> |