Tuesday, February 28, 2012

Organizing the Work for Euler's method

Trying to figure out a way to organize Euler's method, I thought the following might do a decent job. I saw several nice tables similar to this in submitted homework. Definitely play around and do whatever works best for you.

We put Example 4 into a table, where $F(x,y)=15-3y$ and $y(0)=0$. The goal is to determine $y(0.5)$, so we first start with the following:
$\begin{array}{cccccccc}
n & x_{n} & y_{n} & = & y_{n-1} & + & h & F(x_{n-1},y_{n-1})\\
0 & 0 & 0\\
1 & 0.1 & \phantom{1.5} & = & \phantom{0} & + & 0.1 & \phantom{(15-3\cdot0)}\\
2 & 0.2 & \phantom{2.55} & = & \phantom{1.5} & + & 0.1 & \phantom{(15-3\cdot1.5)}\\
3 & 0.3 & \phantom{3.285} & = & \phantom{2.55} & + & 0.1 & \phantom{(15-3\cdot2.55)}\\
4 & 0.4 & \phantom{3.7995} & = & \phantom{3.285} & + & 0.1 & \phantom{(15-3\cdot3.285)}\\
5 & 0.5 & \phantom{4.15965} & = & \phantom{3.7995} & + & 0.1 & \phantom{(15-3\cdot3.7995)}
\end{array}$

Notice I fill the table out until I get to $x=0.5$. Thus when I determine $y_5$, I'd be done, because $y_5$ is the approximation of $y(0.5)$.

We continue, filling in the parts to determine $y_1$.
$\begin{array}{cccccccc}
n & x_{n} & y_{n} & = & y_{n-1} & + & h & F(x_{n-1},y_{n-1})\\
0 & 0 & 0\\
1 & 0.1 & \phantom{1.5} & = & 0 & + & 0.1 & (15-3\cdot0)\\
2 & 0.2 & \phantom{2.55} & = & \phantom{1.5} & + & 0.1 & \phantom{(15-3\cdot1.5)}\\
3 & 0.3 & \phantom{3.285} & = & \phantom{2.55} & + & 0.1 & \phantom{(15-3\cdot2.55)}\\
4 & 0.4 & \phantom{3.7995} & = & \phantom{3.285} & + & 0.1 & \phantom{(15-3\cdot3.285)}\\
5 & 0.5 & \phantom{4.15965} & = & \phantom{3.7995} & + & 0.1 & \phantom{(15-3\cdot3.7995)}
\end{array}$

Either below, or on the side of the table, we do the calculation to determine that $y_1=1.5$. We fill it in.
$\begin{array}{cccccccc}
n & x_{n} & y_{n} & = & y_{n-1} & + & h & F(x_{n-1},y_{n-1})\\
0 & 0 & 0\\
1 & 0.1 & 1.5 & = & 0 & + & 0.1 & (15-3\cdot0)\\
2 & 0.2 & \phantom{2.55} & = & \phantom{1.5} & + & 0.1 & \phantom{(15-3\cdot1.5)}\\
3 & 0.3 & \phantom{3.285} & = & \phantom{2.55} & + & 0.1 & \phantom{(15-3\cdot2.55)}\\
4 & 0.4 & \phantom{3.7995} & = & \phantom{3.285} & + & 0.1 & \phantom{(15-3\cdot3.285)}\\
5 & 0.5 & \phantom{4.15965} & = & \phantom{3.7995} & + & 0.1 & \phantom{(15-3\cdot3.7995)}
\end{array}$

Now we're ready for the next row:
$\begin{array}{cccccccc}
n & x_{n} & y_{n} & = & y_{n-1} & + & h & F(x_{n-1},y_{n-1})\\
0 & 0 & 0\\
1 & 0.1 & 1.5 & = & 0 & + & 0.1 & (15-3\cdot0)\\
2 & 0.2 & \phantom{2.55} & = & 1.5 & + & 0.1 & (15-3\cdot1.5)\\
3 & 0.3 & \phantom{3.285} & = & \phantom{2.55} & + & 0.1 & \phantom{(15-3\cdot2.55)}\\
4 & 0.4 & \phantom{3.7995} & = & \phantom{3.285} & + & 0.1 & \phantom{(15-3\cdot3.285)}\\
5 & 0.5 & \phantom{4.15965} & = & \phantom{3.7995} & + & 0.1 & \phantom{(15-3\cdot3.7995)}
\end{array}$

So we get $y_2=2.55$ and fill that in.
$\begin{array}{cccccccc}
n & x_{n} & y_{n} & = & y_{n-1} & + & h & F(x_{n-1},y_{n-1})\\
0 & 0 & 0\\
1 & 0.1 & 1.5 & = & 0 & + & 0.1 & (15-3\cdot0)\\
2 & 0.2 & 2.55 & = & 1.5 & + & 0.1 & (15-3\cdot1.5)\\
3 & 0.3 & \phantom{3.285} & = & \phantom{2.55} & + & 0.1 & \phantom{(15-3\cdot2.55)}\\
4 & 0.4 & \phantom{3.7995} & = & \phantom{3.285} & + & 0.1 & \phantom{(15-3\cdot3.285)}\\
5 & 0.5 & \phantom{4.15965} & = & \phantom{3.7995} & + & 0.1 & \phantom{(15-3\cdot3.7995)}
\end{array}$

Continue this process until finally, we have the following work nicely organized on our paper. Again, the calculations should be nearby. Doing the calculations below the table works best, giving you a lot of room to avoid making mistakes.
$\begin{array}{cccccccc}
n & x_{n} & y_{n} & = & y_{n-1} & + & h & F(x_{n-1},y_{n-1})\\
0 & 0 & 0\\
1 & 0.1 & 1.5 & = & 0 & + & 0.1 & (15-3\cdot0)\\
2 & 0.2 & 2.55 & = & 1.5 & + & 0.1 & (15-3\cdot1.5)\\
3 & 0.3 & 3.285 & = & 2.55 & + & 0.1 & (15-3\cdot2.55)\\
4 & 0.4 & 3.7995 & = & 3.285 & + & 0.1 & (15-3\cdot3.285)\\
5 & 0.5 & 4.15965 & = & 3.7995 & + & 0.1 & (15-3\cdot3.7995)
\end{array}$

Check your homework answers with a friend! It'll save you a lot of grief.

No comments:

Post a Comment