Differential Equations - Euler's Method - Small Step Size
Consider a linear differential equation of the following form: \(y'= \dfrac { dy }{ dx } =f(x,y).\) When solving differential equation we usually encounter an equation that can be solved with specific techniques, but in most cases differential equations can't be put into a simplified form. So to go around this barrier, a numerical method of approximation was devised. One of the simplest and oldest methods for approximating differential equations is known as the Euler's method.The Euler method is a first-order method, which means that the local error is proportional to the square of the step size, and the global error is proportional to the step size. The Euler method often serves as the basis to construct more complex methods.
Euler's method relies on the fact that close to a point, a function and its tangent have nearly the same value. Let \(h\) be the incremental change in the \(x\)-coordinate, also known as step size.
From the figure above we have the slope of the tangent line at the point \((x_{0},y_{0})\) to be \(y' (x_{0})=f(x_{0},y_{0})\). Given the slope of the tangent line and an initial point \((x_{0},y_{0})\), we want to find out the value of \(y_{1}\) located at \(x_{1}=x_{0}+h\).
We have from coordinate geometry
\[y_{1}=y_{0}+hf(x_{0},y_{0}).\]
Now we recursively continue with \((x_{1},y_{1})\) to find the values of \((x_{2},y_{2})\). The slope of the tangent line at \((x_{1},y_{1})\) is equal to \(y' (x_{1})=f(x_{1},y_{1})\). Then using the same step as above, we have
\[y_{2}=y_{1}+hf(x_{1},y_{1}).\]
In a general form, we have
\[y_{n}=y_{n-1}+hf(x_{n-1},y_{n-1}).\]
Now, to understand what the purpose of what we just did, let's look at the figure below which shows what happens as the \(h\) gets smaller and smaller:
The line in blue is the one with the smallest \(h\) value, so as \(h\) gets smaller and smaller the value of the tangent gets closer and closer to the real value.
Consider a function \(f(x)\) such that \(f(2)=10\) and \(f'(x)=x^{2}+3x\) . Using Euler's method with step size \(1,\) find the resulting approximation of \(f(5).\)
Using Euler's method with step size \(1,\) we have
\[\begin{align} f(3)&=f(2)+1\times f'(2)=20\\ f(4)&=f(3)+1\times f'(3)=20+18=38\\ f(5)&=f(4)+1\times f'(4)=38+40=78. \end{align}\]
So we have \(f(5)=78\). \(_\square\)
Consider a function \(f(x)\) such that \(f(1)=2\) and \(f'(x)=6x^{2}+2x\). Using Euler's method with step size \(\frac{1}{2},\) find the resulting approximation of \(f(8).\)
Using Euler's method with step size \( \frac{1}{2},\) we have
\[\begin{align} f(1.5)&=f(1)+f'(1)\times 0.5\\&=2+[6(1)^{2}+2(1)](0.5)\\&=2+4=6\\ \\ f(2)&=f(1.5)+f'(1.5)\times 0.5\\&=6+[6(1.5)^{2}+2(1.5)](0.5)\\&=14.25\\ \\ f(2.5)&=f(2)+f'(2)\times 0.5\\&=14.25+[6(2)^{2}+2(2)](0.5)\\&=28.25\\ &\cdot \\ &\cdot \\ f(8)&=f(7.5)+f'(7.5)\times 0.5\\&=814.5+[6(7.5)^{2}+2(7.5)](0.5)\\&=990.75. \ _\square \end{align}\]