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(x0) = y0. Unlike analytical methods that seek an explicit formula for y(x), Euler’s method generates an approximation by creating a sequence of points (xk, yk) that estimate the true solution at discrete points. More precisely, each yk estimates the value of the true solution y(xk).
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 (xk, yk) 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(x0) = y0, Euler’s method approximates y at points x1, x2, ···, xN. The basic idea is to use the slope at (xn, yn) to estimate y at the next point xn+1 of the sequence using the following steps:
The Euler equations or formulas are: xn+1 = xn + h, yn+1 = yn + hAn, An = f(xn, yn).
We will compute or approximate y at x = 0.1, 0.2, and 0.3.
Step-by-step table of calculations:
n | xn | yn | An=xn2-yn2 | hAn |
---|---|---|---|---|
0 | 0 | 1 | 0-12=-1 | -0.1 |
1 | 0.1 | 1-0.1 = 0.9 | 0.12-0.92=-0.8 | -0.08 |
2 | 0.2 | 0.9-0.08 = 0.82 | 0.22-0.822=-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 y3 ≈ y2 + hA2 ≈ 0.82-0.06324 ≈ 0.75676. Similarly, the approximated value at x = 0.4 is y4 ≈ y3 + hA3 ≈ 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 (x0 = 0, y0 = 1): y(0) = 1 (Initial condition), y’(0) = A0 = -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 | xn | yn | An=xn+2yn | hAn=0.1An |
---|---|---|---|---|
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 y4 ≈ 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 e2x, 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·h2. 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’ = x2 -y2 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 y1 ≈ 0.91, which is a more accurate approximation than the basic Euler method.
Second iteration
Now, after two steps, we have y2 ≈ 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’ = y2. 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’ = y2 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.