Pure mathematics is, in its way, the poetry of logical ideas. Do not worry about your difficulties in mathematics, I assure you that mine are still greater, Albert Einstein
Mathematics is not a careful march down a well-cleared highway, but a journey into a strange wilderness, where the explorers often get lost, W.S. Anglin.
Definition. A differential equation is an equation that involves one or more dependent variables, their derivatives with respect to one or more independent variables, and the independent variables themselves, e.g., $\frac{dy}{dx} = 3x +5y, y’ + y = 4xcos(2x), \frac{dy}{dx} = x^2y+y, etc.$
It involves (e.g., $\frac{dy}{dx} = 3x +5y$):
To solve ordinary differential equations (ODEs), several methods can be employed, each suited to different types of equations. Here are some of the key methods:
Separation of Variables. This method is used for first-order ODEs that can be written in the form $\frac{dy}{dx} = g(x)h(y)$. By separating the variables, you integrate both sides separately: $\int \frac{dy}{h(y)} = \int g(x)dx + C$
Integrating Factors. This method is applied to linear first-order ODEs of the form $\frac{dy}{dx} + P(x)y = Q(x)$. The idea is to multiply the entire equation by an integrating factor μ(x) = $e^{\int P(x)dx}$, which simplifies the left-hand side into a product derivative, making the equation easier to solve: $\frac{d}{dx}(y·μ(x)) = Q(x)·μ(x)$. Integrating both sides gives the solution.
Exact Differential Equations. These are ODEs that can be expressed in the form of a total differential of a function, M(x,y)dx + N(x,y)dy = 0, where the exactness condition $\frac{∂M}{∂y} = \frac{∂N}{∂x}$ must be satisfied. If the equation is exact, you should find the potential function f(x, y) such that $\frac{∂f}{∂x} = M$ and $\frac{∂f}{∂y} = N$. The solution is f(x,y) = C.
Geometric Interpretations. This approach involves visualizing the solution in the phase plane or using graphical methods to understand the behavior of the solutions. For example, in autonomous differential equations, the phase plane can help in understanding the equilibrium points and the stability of the solutions.
Numerical Methods. For ODEs that cannot be solved analytically, numerical methods are used to find approximate solutions.
Euler’s method is a fundamental numerical technique used to approximate the solution of a first-order differential equation (ODE) of the form y’ = f(x, y) with a given initial condition y(x_{0}) = y_{0}. Unlike analytical methods that seek an explicit formula for y(x), Euler’s method generates an approximation by creating a sequence of points (x_{k}, y_{k}) that estimate the true solution at discrete points. More precisely, each y_{k} estimates the value of the true solution y(x_{k}).
Euler's method approximates the solution curve by creating a sequence of tangent lines at successive points. Each point is determined by the slope of the tangent line at the previous point (Refer to Figure 1 for a visual representation and aid in understanding it). The slope at any point (x_{k}, y_{k}) is determined by the given differential equation y′ = f(x, y). The method progresses from one point to the next by taking small steps of size h (also known as the step size).
Given the differential equation of the form: y’ = f(x, y) and an initial condition y(x_{0}) = y_{0}, Euler’s method approximates y at points x_{1}, x_{2}, ···, x_{N}. The basic idea is to use the slope at (x_{n}, y_{n}) to estimate y at the next point x_{n+1} of the sequence using the following steps:
The Euler equations or formulas are: x_{n+1} = x_{n} + h, y_{n+1} = y_{n} + hA_{n}, A_{n} = f(x_{n}, y_{n}).
We will compute or approximate y at x = 0.1, 0.2, and 0.3.
Step-by-step table of calculations:
n | x_{n} | y_{n} | A_{n}=x_{n}^{2}-y_{n}^{2} | hA_{n} |
---|---|---|---|---|
0 | 0 | 1 | 0-1^{2}=-1 | -0.1 |
1 | 0.1 | 1-0.1 = 0.9 | 0.1^{2}-0.9^{2}=-0.8 | -0.08 |
2 | 0.2 | 0.9-0.08 = 0.82 | 0.2^{2}-0.82^{2}=-0.6324 | -0.06324 |
3 | 0.3 | 0.82−0.06324 = 0.75676 | 0.3²-0.75676²=−0.48268 | −0.048268 |
The approximated value at x = 0.3 is y_{3} ≈ y_{2} + hA_{2} ≈ 0.82-0.06324 ≈ 0.75676. Similarly, the approximated value at x = 0.4 is y_{4} ≈ y_{3} + hA_{3} ≈ 0.75676 −0.04907 = 0.70849.
Euler’s method provides a straightforward approach to approximating solutions of first-order ODEs. While simple and easy to implement, its accuracy depends on the size of the step h and the behavior of the true solution.
If the true solution is convex in the interval of interest (i.e., the second derivative y′′ is positive), Euler’s approximation tends to underestimate the true value. If the solution is concave (i.e., the second derivative y′′ is negative), Euler’s approximation tends to overestimate the true value (Refer to Figure C for a visual representation and aid in understanding it).
In our example, to determine the convexity, we calculate the second derivative using the Chain Rule: $y’’ = \frac{d}{dx}(y’) = \frac{d}{dx}(x^2-y^2) = 2x -2yy’.$
At (x_{0} = 0, y_{0} = 1): y(0) = 1 (Initial condition), y’(0) = A_{0} = -1, y’’(0) =[y’’ = 2x -2yy’] 2·0 -2·1·(-1) = 2. Since y′′(0) = 2 > 0, the solution is convex near x = 0, and Euler’s method will underestimate the true solution in the initial steps.
Euler’s method approximates the solution curve by constructing a series of tangent line segments, moving from one point to the next based on the local slope of the solution at the current point.
Each tangent line is a linear approximation, and as such, the error introduced at each step depends on how much the true solution deviates from linearity over that interval. Therefore, its accuracy can vary depending on the step size and the nature of the solution curve. For smoother (slowly changing) functions, Euler’s method performs better, while for more complex functions, smaller steps (halve the step side, halve the error, refer to Figure D) or more advanced numerical methods may be needed for improved accuracy and stability.
Euler’s method is a fundamental numerical technique used to approximate solutions to ordinary differential equations (ODEs) when an analytical solution is difficult, costly or impossible to obtain.
Step-by-step table of calculations:
n | x_{n} | y_{n} | A_{n}=x_{n}+2y_{n} | hA_{n}=0.1A_{n} |
---|---|---|---|---|
0 | 0 | 0 | 0+2*0=0 | 0 |
1 | 0.1 | 0+0.1·0 = 0 | 0.1+2·0 = 0.1 | 0.01 |
2 | 0.2 | 0 + 0.01 = 0.01 | 0.2+2·001 = 0.22 | 0.022 |
3 | 0.3 | 0.01 + 0.022 = 0.032 | 0.3 + 2·0.032=0.364 | 0.0364 |
4 | 0.4 | 0.032 + 0.0364 = 0.0684 | 0.4 + 2·0.0684=0.5368 | 0.05368 |
After four steps, the approximated value at x = 0.4 is y_{4} ≈ 0.032 + 0.0364 = 0.0684.
Solving the Differential Equation Analytically.
Conclusion: Our Euler's method approximation is y(0.4) ≈ 0.0684, whereas the exact value is approximately −0.50639. The discrepancy indicates that Euler's method with h = 0.1 is not very accurate for this problem over this interval.
Why? The exact solution involves an exponential term e^{2x}, with grows rapidly. Euler's method with a relatively large step size h = 0.1 struggles to capture this rapid change. The error accumulates at each step, leading to significant deviation from the exact solution.
$y’’ = \frac{d}{dx}(y’) = \frac{d}{dx}(x+2y) = 1 > 0$ ⇒ The solution is convex near x = 0, and Euler’s method will underestimate the true solution.
The Improved Euler’s Method, also known as the second-order Runge-Kutta method (RK2), provides a more accurate approximation of the solution to ordinary differential equations (ODEs) than the basic Euler’s method. The key idea behind this method is to use two estimates of the slope at each step: one at the beginning of the interval and one at the end of the interval. These two slopes are then averaged to get a more accurate approximation of the solution (Refer to Figure E for a visual representation and aid in understanding it).
The steps for Improved Euler’s method are as follows:
Repeat steps 1–5 for each subsequent interval to approximate the solution over the desired range.
Euler’s method is a first-order method, meaning that the error e in the solution is proportional to the step size h, i.e., e ≈ c·h, where c is some constant. This means that if you halve the step size, the error roughly halves as well.
Improved Euler's method is a second-order method, meaning the error decreases quadratically with the step size, i.e., e ≈ c·h^{2}. This quadratic dependence means that halving the step size will reduce the error by a factor of four. However, this increase in accuracy comes at the cost of more computations, as the method requires two function evaluations at each step - my dear reader, nothing comes for free! 😢
Consider the differential equation y’ = x^{2} -y^{2} with the initial condition y(0) = 1 and step size h = 0.1. Let’s walk through the first step of the Improved Euler’s Method.
First Iteration
After the first step, the Improved Euler method gives y_{1} ≈ 0.91, which is a more accurate approximation than the basic Euler method.
Second iteration
Now, after two steps, we have y_{2} ≈ 0.83680 at x = 0.2.
The improved Euler's method takes into account the change in slope over the interval by averaging the slopes at the beginning and end. By considering both the initial and predicted slopes, the Improved Euler’s method provides a better approximation of the area under the curve, similar to the trapezoidal rule in numerical integration.
It is a second-order accurate method, significantly improving the approximation compared to the first-order Euler’s method, but each step requires two evaluations of f(x, y) instead of one, increasing the computational effort (cost).
Consider the differential equation y’ = y^{2}. This is a separable differential equation and we can solve it analytically as follows:
This solution has a singularity at x = 1, meaning the solution becomes undefined (blows up) as x approaches 1. The solution curve has a vertical asymptote at x = 1.
In general, the solution to y’ = y^{2} has a singularity at x = C, where C is determined by the initial condition.
As the solution approaches the singularity at x = 1, the slope f(x, y) becomes extremely large and numerical methods fail to approximate the solution. The methods become unstable near such points because the rapidly increasing slope requires an impractically small step size h to maintain accuracy.
When dealing with ODEs that have singularities within the interval of integration, special care must be taken:
To sum up, the Improved Euler's method offers a significant improvement in accuracy over the basic Euler's method by averaging the slopes at the beginning and end of each interval. However, it is important to be aware of potential pitfalls, such as singularities in the solution, which can render numerical methods quite ineffective without appropriate adjustments.