maths.free › Differential Equations › 7. Differential Equations › Euler's method
Euler's method
In Section, we saw how a slope field can be used to sketch solutions to a differential equation.
Introduction
In Section, we saw how a slope field can be used to sketch solutions to a differential equation. In particular, the slope field is a plot of a large collection of tangent lines to a large number of solutions of the differential equation, and we sketch a single solution by simply following these tangent lines. With a little more care, we can use this same idea to approximate numerically the solutions of a differential equation.
Exploration
Exploration
Euler's Method
Preview Activity demonstrates an algorithm known as Euler's Euler is pronounced Oy-ler. Among other things, Euler is the mathematician credited with the famous number \(e\); if you incorrectly pronounce his name You-ler, you fail to appreciate his genius and legacy. Method, which generates a numerical approximation to the solution of an initial value problem. In this algorithm, we will approximate the solution by taking horizontal steps of a fixed size that we denote by \(\Delta t\).
Before explaining the algorithm in detail, let's remember how we compute the slope of a line: the slope of a given line is the ratio of the vertical change to the horizontal change, as shown in Figure.
In symbols, \(m = \frac{\Delta y}{\Delta t}\). Solving for \(\Delta y\), we see that the vertical change is the product of the slope and the horizontal change, or \[\begin{aligned}\end{aligned}\].
In words, this says that (along a line), the change in \(y\) between two points is the product of the slope times the change in \(x\).
Now, suppose that we would like to solve the initial value problem \[\begin{aligned}\end{aligned}\].
Using more advanced techniques from differential equations, it's possible to find an algebraic formula for the solution to this initial value problem, and we can check that this solution is \(y(t) = t -1 + 2e^{-t}\). Here we are instead interested in generating an approximate solution by creating a sequence of points \((t_i, y_i)\), where \(y_i\approx y(t_i)\), but we'll use the algebraic formula as a way to check the accuracy of our approximation.
For this first example, we choose \(\Delta t = 0.2\). Since we know that \(y(0) = 1\), we will take the initial point to be \((t_0,y_0) = (0,1)\) and move horizontally by \(\Delta t = 0.2\) to the point \((t_1,y_1)\). Thus, \(t_1=t_0+\Delta t = 0.2\). Now, the differential equation tells us that the slope of the tangent line at this point is \[\begin{aligned}\end{aligned}\],
so to move along the tangent line by taking a horizontal step of size \(\Delta t=0.2\), we must also move vertically by \[\begin{aligned}\end{aligned}\]. We then have the approximation \[\begin{aligned}\end{aligned}\]. At this point, we have executed one step of Euler's method, as seen graphically in Figure.
Now we repeat this process: at \((t_1,y_1) = (0.2,0.8)\), the differential equation tells us that the slope is \[\begin{aligned}\end{aligned}\].
Condensed — the full section is in Boelkins, Active Calculus.
The error in Euler's method
Since we are approximating the solutions to an initial value problem using tangent lines, we should expect that the error in the approximation will be smaller when the step size is smaller. Consider the initial value problem \[\begin{aligned}\end{aligned}\], whose solution we can easily find.
The question posed by this initial value problem is what function do we know that is the same as its own derivative and has value 1 when \(t=0\)? Observe that the solution is \(y(t) = e^t\). We now apply Euler's method to approximate \(y(1) = e\) using several values of \(\Delta t\). These approximations will be denoted by \(E_{\Delta t}\), and we'll use them to see how accurate Euler's Method is.
To begin, we apply Euler's method with a step size of \(\Delta t = 0.2\). In that case, we find that \(y(1) \approx E_{0.2} = 2.4883\). The error is therefore \[\begin{aligned}\end{aligned}\].
Repeatedly halving \(\Delta t\) gives the following results, expressed in both tabular and graphical form.
| \(\Delta t\) | \(E_{\Delta t}\) | Error |
| \(0.200\) | \(2.4883\) | \(0.2300\) |
| \(0.100\) | \(2.5937\) | \(0.1245\) |
| \(0.050\) | \(2.6533\) | \(0.0650\) |
| \(0.025\) | \(2.6851\) | \(0.0332\) |
Notice, both numerically and graphically, that the error is roughly halved when \(\Delta t\) is halved. This example illustrates the following general principle.
If Euler's method is used to approximate the solution to an initial value problem at a point \(\overline{t}\), then the error is proportional to \(\Delta t\). That is, \[\begin{aligned}\end{aligned}\] for some constant of proportionality \(K\).
Summary
Euler's method is an algorithm for approximating the solution to an initial value problem by following the tangent lines while we take horizontal steps across the \(t\)-axis.
If we wish to approximate \(y(\overline{t})\) for some fixed \(\overline{t}\) by taking horizontal steps of size \(\Delta t\), then the error in our approximation is proportional to \(\Delta t\).
Symbols used here
2.71828…, the base whose exponential is its own derivative.
Equal to the precision shown, not exactly.
The value f(x) approaches as x approaches a.
Instantaneous rate of change; slope of the graph.
Antiderivative (indefinite) or signed area from a to b (definite).
Prime notation for derivatives with respect to x (or t).
Constants of integration fixed by initial conditions.
Rate of change in time; sum of second partials (the diffusion operator).
How to: Euler's method
- What is Euler's method and how can we use it to approximate the solution to an initial value problem?
- How accurate is Euler's method?
Questions people ask
What is a differential equation?
An equation whose unknown is a function, relating it to its own derivatives. "The rate of growth is proportional to the population" is y′ = ky, and solving it means finding y as a function of time.
Why does the solution have arbitrary constants?
Integrating loses information: many functions share the same derivative. An n-th order equation has n constants, fixed by n initial or boundary conditions.
તમારા પોતાના પ્રયત્ન કરો
Parts of this page are adapted from Boelkins, Active Calculus (CC BY-SA 4.0). Condensed and re-explained here; errors are ours.
આમાં વધુ Differential Equations
Separable equationsFirst-order linear equationsSecond-order, constant coefficientsNonhomogeneous equationsModelling with differential equations