2018-05-29
Simple methods of numerical solution of some differential equations
A large number of numerical methods solving differential equations in General [1,2]. Many of them realizowany and software are available as ready modules. Unfortunately, generalized methods do not always give a sufficiently accurate result, because there is a natural limitation of computing power. Also, the use of ready-made modules often takes the solution beyond the capacity of a processor, which greatly limits the input range.
In this note we show more simple and fast algorithms to solve some diff. equations. The main differences from the traditional in them is optimized for a specific task, which ensures the passage of the entire algorithm in a single cycle, a smaller number of iterations, a more stable computational process and of simple methods of obtaining them. Suffice it to say that such an approach can be made available even for high school students high school — search algorithm is reduced to solving simple algebraic equations.
For consideration of the proposed method it is necessary to remember that the process of numerical solution consists of iteration — repetition of some computations [3], and the number of such iteration step is denoted by the symbol \(i\). Immediately consider the example in the following diff. equation: \[\dot Y = f(x)\,Y + a \qquad (1)\] Here: \(Y=Y(x)\), \(\dot Y\) — some increment of \(Y(x)\) to change the coordinates \(x\), i.e. \[\dot Y = {dY \over dx} \approx {\Delta Y \over \Delta x}, \] \(f(x)\ ) be some function of the coordinates, and \(a\) is a constant. By the way, if \(f(x)\) will be a complex dependence, the analytical solution of this equation is impossible, and here is the solution by numerical methods — always and with any accuracy.
To do this, imagine \(\Delta Y\) as the difference between the current value and the value at the previous iteration step: \[\Delta Y = Y(x_i) - Y(x_{i-1}) \qquad (2)\] the coordinate will change to \(\Delta x = x_i - x_{i-1}\), and this change of coordinates will be constant and at any step. From \(\Delta x\) depends on the accuracy of the entire method and the total number of iterations: \(i \in 1, 2, 3, ..., N\), and the coordinate value is simply: \(x_i = i\,\Delta x\).
Then our equation can be written as: \[{Y(x_i) - Y(x_{i-1}) \over \Delta x} = f(x_{i})\,Y(x_{i}) + a \qquad (3)\] now find the current value of the function, which will be the output of numerical solution for each iteration step: \[Y(x_i) = {Y(x_{i-1}) + a\,\Delta x \over 1 - f(x_i)\,\Delta x} \qquad (4)\] Also, it is necessary to determine the value of \(Y(x_{i-1})\) in the first step, i.e. when \(i=1\), and \(x_0=0\). This will be the initial value of our function, which in Mat. analysis osoznaetsya as \(Y(0)\). Then the total record numerical solution would be: \[Y(x_i) = {Y(x_{i-1}) + a\,\Delta x \over 1 - f(x_i)\,\Delta x}, \quad Y(x_0) = Y(0) \qquad (5)\] With the simplicity of the functions found is a fast and robust algorithm for the numerical solution of this equation!
A more complex example
Enthusiasts free energy will be interested to know that in the linear Bernoulli equation is hidden one of the ways of its receipt. Find numerical solution of this equation: \[g(x)\,\dot Y = f(x)\,Y + h(x) \qquad (6)\] First suggest an analytical approach [4], then the above method to find the numerical solution. Having done almost the same steps soon to obtain at the output of the following algorithm: \[Y(x_i) = {g(x_i)\,Y(x_{i-1}) + h(x_i)\,\Delta x \over g(x_i) - f(x_i)\,\Delta x}, \quad Y(x_0) = Y(0) \qquad (7)\] For comparison, if we look for numerical solution of this equation using the approach [4], it will be so: \[Y(x_i) = \left[ Y(x_{i-1}) + \frac{h(x_i)}{g(x_i)} \Delta x \right] \left[ 1 + \frac{f(x_i)}{g(x_i)} \Delta x \right], \quad Y(x_0) = Y(0) \qquad (8)\] it is Interesting that in practice, programming algorithm (7) gives more accurate values at the outlet than (8), and the calculation process is more stable.
The function in the exponent
This solution should unleash the full power of this method. For this we take the following equation: \[\dot Y = f(x) \exp(a\,Y) + h(x) \qquad (9)\] and try to find its numerical solution by the proposed method. But first recall that an exponential function with small changes, can be expanded in a Taylor series [5]: \[\exp(a\,Y_i) = \exp(a\,Y_{i-1})\exp(a\,\Delta Y) = \exp(a\,Y_{i-1})(1 + a(Y_i-Y_{i-1})) \qquad (10)\] Here, for a better perception introduced the following simplification: \(Y_i = Y(x_i), Y_{i-1} = Y(x_{i-1})\). Now, in the proposed method, we form the General equation: \[{Y_i - Y_{i-1} \over \Delta x} = f(x_i) \exp(a\,Y_{i-1})[1 + a(Y_i-Y_{i-1})] + h(x_i) \qquad (11)\] and derive from it the desired function: \[Y_i = Y_{i-1} + {f(x_i) \exp(a\,Y_{i-1}) + h(x_i) \over 1 + a\,f(x_i) \exp(a\,Y_{i-1}) \Delta x } \Delta x \qquad (12)\]
On the next page we will talk about numerical solution of some differential. equations of the second order.
The materials used