Keywords

1 Introduction

For numerically solving ordinary differential equations (ODEs) and partial differential equations (PDEs) in various engineering problems, some typical and traditional methods have been presented so far, including the finite difference method (FDM), the boundary element method (BEM) and so on, too many results about their developments, accuracy, convergence, stability have arisen since they were presented. These can be partly seen in [1,2,3,4,5,6,7,8,9,10,11] and references therein.

In this paper, based on the Taylor series, we present a new numerical method for the ordinary differential equation

$$ \begin{aligned} \sum\limits_{k = 0}^{n} {a_{n - k + 1} x^{k} y^{\left( k \right)} } = x^{n} f\left( x \right),x \in \left( {0,1} \right), \hfill \\ y^{\left( k \right)} \left( 0 \right) = 0,k = 0,1, \cdots ,n - 1, \hfill \\ \end{aligned} $$
(1)

where \( a_{k} \), k = 1, 2,···, n + 1 are all constants, y(x) is the function to be determined. This method is quite different from such the existed methods as the FDM, FEM and BEM.

In the next sections, by some theoretical analyses and experimental demonstrations, we find this method has some evident characteristics:

  • It can provide the unique numerical solution of (1);

  • It can achieve accuracy \( O\left( {h^{m + 1} } \right) \) when \( f\left( x \right) \in C^{m + 1} \left[ {0,1} \right] \);

  • It does not lead to complicated and large linear systems.

The remainder of the paper is organized as follows. In Sect. 2, we describe our method in details, including the construction of this method, the existence, uniqueness, the accuracy of the numerical solution and the computational complexity of this method. In Sect. 3, some examples are given to check this presented method in Sect. 2. Finally, we draw some conclusions about our method, point out some shortages which are expected to be overcome.

2 The Method of Undetermined Coefficients

Supposing the equation

$$ y^{\left( 2 \right)} \left( x \right) + y^{\prime}\left( x \right) + y\left( x \right) = d\left( x \right), \, x = \left[ {0,1} \right] $$
(2)

has a unique solution \( y\left( x \right) \in C^{2} \left[ {0,1} \right] \).

Case 1:

If the function d(x) is a given 2 order polynomial, namely,

$$ d\left( x \right) = d_{0} + d_{1} x + d_{2} x^{2} , $$
(3)

we can guess that y(x) is also a 2 order polynomial of the form

$$ y\left( x \right) = t_{0} + t_{1} x + t_{2} x^{2} . $$
(4)

Substituting (4), (3) into (2), we get the equality

$$ \left( {t_{0} + t_{1} + 2t_{2} } \right) + \left( {t_{1} + 2t_{2} } \right)x + t_{2} x^{2} = d_{0} + d_{1} x + d_{2} x^{2} $$

for all \( x = \left[ {0,1} \right] \). Consequently, by comparing the coefficients, one immediately gets

$$ t_{2} = d_{2} ,t_{1} = d_{1} - 2t_{2} ,t_{0} = d_{0} - t_{1} - 2t_{2} , $$
(5)

and thus the solution y(x) is exactly found.

Case 2:

When the d(x) is not a polynomial, we can subdivide the domain (0, 1) into \( \cup_{i = 1}^{N} \varOmega_{i} \). On each sub-domain \( \varOmega_{i} \), (i = 1,2,⋯, N), we replace d(x) with its 2 order Taylor series, and the remaining work is repeating the above course from (3) to (5) for seeking an approximate solution of (2) in \( \varOmega_{i} \).

For convenience, we assume that \( y\left( x \right) \in C^{m + 1} \left( {\bar{\varOmega }} \right), \) \( f\left( x \right) \in C^{m + 1} \left( {\bar{\varOmega }} \right), \) \( m \ge 1 \). For \( \bar{\varOmega } = \left[ {0,1} \right] \), let \( \Delta_{x} = \left\{ {0 = x_{0} < x_{1} < \cdots < x_{M} = 1} \right\} \) be uniform partitions of \( \varOmega \) with mesh sizes \( h_{x} = h \). Throughout this paper, we denote by \( \tau_{i} ,i = 1,2, \ldots ,M \) the midpoints of \( \Delta_{x} \), and by \( \varOmega_{i} = \left( {x_{i - 1} ,x_{i} } \right) \).

According to the conditions \( y^{\left( k \right)} \left( 0 \right) = 0,k = 0,1, \ldots ,n - 1 \), the solution y(x) can be expressed as \( y = x^{n} u\left( x \right) \) with \( u\left( x \right) \) the new unknown function. Substituting this into (1), by some computations, we obtain the equivalent system

$$ \sum\limits_{k = 0}^{n} {b_{k + 1} x^{k} u^{\left( k \right)} } = f\left( x \right),x \in \left( {0,1} \right), $$
(6)

where

$$ b_{k + 1} = \sum\limits_{t = 1}^{n - k + 1} {{{a_{t} C_{n - t + 1}^{k} n!} \mathord{\left/ {\vphantom {{a_{t} C_{n - t + 1}^{k} n!} {\left( {t + k - 1} \right)!}}} \right. \kern-0pt} {\left( {t + k - 1} \right)!}}} ,k = 0,1, \ldots ,n. $$

In every sub-interval \( \varOmega_{i} \), let

$$ \hat{f}\left( x \right) = \sum\limits_{k = 0}^{m} {{{f^{\left( k \right)} \left( {\tau_{i} } \right)\left( {x - \tau_{i} } \right)^{k} } \mathord{\left/ {\vphantom {{f^{\left( k \right)} \left( {\tau_{i} } \right)\left( {x - \tau_{i} } \right)^{k} } {k!}}} \right. \kern-0pt} {k!}}} $$
(7)

after expanding all the polynomials \( \left( {x - \tau_{i} } \right)^{k} \), \( k = 0,1, \ldots ,m \) and combining like terms, (7) reads

$$ \hat{f}\left( x \right) = \sum\limits_{k = 0}^{m} {g_{k + 1} x^{k} ,} $$
(8)

where

$$ g_{k + 1} = \sum\limits_{t = k}^{m} {{{f^{\left( t \right)} \left( {\tau_{i} } \right)C_{t}^{t - k} \left( { - \tau_{i} } \right)^{t - k} } \mathord{\left/ {\vphantom {{f^{\left( t \right)} \left( {\tau_{i} } \right)C_{t}^{t - k} \left( { - \tau_{i} } \right)^{t - k} } {t!}}} \right. \kern-0pt} {t!}}} . $$

Then, for the right function f(x) in (6), we can easily write its m order Taylor series on the point \( \tau_{i} \) in sub-domain Ω i (i = 1,2,…, M) as

$$ f\left( x \right) = \hat{f}\left( x \right) + {{\left( {x - \tau_{i} } \right)^{m + 1} f^{{\left( {m + 1} \right)}} \left( {\theta_{i} } \right)} \mathord{\left/ {\vphantom {{\left( {x - \tau_{i} } \right)^{m + 1} f^{{\left( {m + 1} \right)}} \left( {\theta_{i} } \right)} {\left( {m + 1} \right)!}}} \right. \kern-0pt} {\left( {m + 1} \right)!}} $$
(9)

With \( \theta_{i} \in \bar{\varOmega }_{i} \).

By using the idea similar to (4), taking approximate solution \( u_{h} \) as

$$ u_{h} = \sum\limits_{t = 0}^{m} {c_{t} x^{t} ,} $$
(10)

with c t, t = 0, 1,…, m undetermined coefficients, we get

$$ \sum\limits_{k = 0}^{n} {b_{k + 1} x^{k} u_{h}^{\left( k \right)} } = \sum\limits_{k = 0}^{n} {s_{k} x^{k} } , $$
(11)

where

$$ s_{k} = \left\{ \begin{array}{ll} \sum\nolimits_{t = 0}^{k} {{{k!b_{t + 1} c_{k} } \mathord{\left/ {\vphantom {{k!b_{t + 1} c_{k} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} , \, if \, k = 0,1, \ldots ,n, \\ \sum\nolimits_{t = 0}^{n} {{{k!b_{t + 1} c_{k} } \mathord{\left/ {\vphantom {{k!b_{t + 1} c_{k} } {\left( {k - t} \right)}}} \right. \kern-0pt} {\left( {k - t} \right)}}!} , \, if \, k = n + 1, \ldots ,m. \\ \end{array} \right. $$
(12)

Substituting (8)–(12) into (6), and dropping the remainder term

$$ {{\left( {x - \tau_{i} } \right)^{m + 1} f\left( {\theta_{i} } \right)^{{\left( {m + 1} \right)}} } \mathord{\left/ {\vphantom {{\left( {x - \tau_{i} } \right)^{m + 1} f\left( {\theta_{i} } \right)^{{\left( {m + 1} \right)}} } {\left( {m + 1} \right)!}}} \right. \kern-0pt} {\left( {m + 1} \right)!}} $$

in sub-domain Ω i , we obtain the approximate system

$$ \sum\limits_{k = 0}^{n} {b_{k + 1} x^{k} u_{h}^{\left( k \right)} } = \hat{f}\left( x \right),x \in \left( {0,1} \right), $$
(13)

namely

$$ \sum\limits_{k = 0}^{m} {s_{k} x^{k} } = \sum\limits_{k = 0}^{m} {g_{k + 1} x^{k} } $$

in Ω i . Let the corresponding coefficients be equal to each other in this equality, then the coefficients \( c_{k} \), k = 0,…, m can be expressed as:

$$ c_{k} = \left\{ \begin{array}{ll} {{g_{k + 1} } \mathord{\left/ {\vphantom {{g_{k + 1} } {\sum\nolimits_{t = 0}^{k} {{{k!b_{t + 1} } \mathord{\left/ {\vphantom {{k!b_{t + 1} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} }}} \right. \kern-0pt} {\sum\nolimits_{t = 0}^{k} {{{k!b_{t + 1} } \mathord{\left/ {\vphantom {{k!b_{t + 1} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} }}, \, if \, k = 0,1, \ldots ,n, \hfill \\ {{g_{k + 1} } \mathord{\left/ {\vphantom {{g_{k + 1} } {\sum\nolimits_{t = 0}^{n} {{{k!b_{t + 1} } \mathord{\left/ {\vphantom {{k!b_{t + 1} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} }}} \right. \kern-0pt} {\sum\nolimits_{t = 0}^{n} {{{k!b_{t + 1} } \mathord{\left/ {\vphantom {{k!b_{t + 1} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} }}, \, if \, k = n + 1, \ldots ,m. \hfill \\ \end{array} \right. $$
(14)

From (14), we immediately have the following result about existence and uniqueness for approximate system (13).

Theorem 1.

Supposing \( \sum\nolimits_{t = 0}^{k} {{{k!b_{t + 1} } \mathord{\left/ {\vphantom {{k!b_{t + 1} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} \ne 0 \) when \( k \le n, \) \( \sum\nolimits_{t = 0}^{n} {{{k!b_{t + 1} } \mathord{\left/ {\vphantom {{k!b_{t + 1} } {\left( {k - t} \right)!}}} \right. \kern-0pt} {\left( {k - t} \right)!}}} \ne 0 \) when \( n + 1 \le k \le m, \) and \( f\left( x \right) \in C^{m + 1} \left( {\bar{\varOmega }} \right), \) then the approximate solution \( u_{h} \) defined by (10) can be uniquely solved by the Eq. (13).

Now, we analyze the convergence of this method, we denote by

$$ Lu = \sum\limits_{k = 0}^{n} {b_{k + 1} x^{k} u_{{}}^{\left( k \right)} } ,u \in \varOmega , $$
(15)

then the following theorem is true.

Theorem 2.

Assuming that Eq. (1) has unique solution y(x), and \( y\left( x \right),f\left( x \right) \in C^{m + 1} \left( {\bar{\varOmega }} \right). \) Let \( e \equiv y - y_{h} \) with \( y_{h} = x^{n} u_{h}. \) Then

$$ \left| e \right| \le C_{1} C_{2} \left( {{h \mathord{\left/ {\vphantom {h 2}} \right. \kern-0pt} 2}} \right)^{m + 1} , $$
(16)

where h is the step length, \( C_{1} \) is a constant corresponding to the operator L−1, and

$$ C_{2} = \mathop {\hbox{max} }\limits_{i = 1}^{M} {{f\left( {\theta_{i} } \right)^{{\left( {m + 1} \right)}} } \mathord{\left/ {\vphantom {{f\left( {\theta_{i} } \right)^{{\left( {m + 1} \right)}} } {\left( {m + 1} \right)!}}} \right. \kern-0pt} {\left( {m + 1} \right)!}},\theta_{i} \in \bar{\Omega }_{i} ,i = 1,2, \ldots , M. $$

Furthermore, this error satisfies

$$ \mathop {\lim }\limits_{{\left| {a_{n} + 1} \right| \to + \infty }} \left| e \right| = 0. $$
(17)

Proof.

In fact, by (6), (13), we can get

$$ L\left( {u - u_{h} } \right) = f - \hat{f}, $$

on each sub-domain \( \bar{\Omega }_{i} \), i = 1, 2,…, M.

Because Eq. (1) has unique solution \( y\left( x \right) \in C^{m + 1} \left( {\bar{\Omega }} \right) \), by the relation \( y\left( x \right) = x^{n} u\left( x \right) \), we know (1) is equivalent to (6), and the operator L is an invertible bounded linear operator on \( C^{m + 1} \left( {\bar{\Omega }_{i} } \right) \), i = 1, 2,…, M, which shows that (16) is true.

Furthermore, by \( b_{k + 1} = \sum\nolimits_{t = 1}^{n - k + 1} {{{a_{t} C_{n - t + 1}^{k} n!} \mathord{\left/ {\vphantom {{a_{t} C_{n - t + 1}^{k} n!} {\left( {t + k - 1} \right)!}}} \right. \kern-0pt} {\left( {t + k - 1} \right)!}}} ,k = 0,1, \ldots ,n, \) we know \( \lim_{{a_{n} + 1 \to + \infty }} b_{1} = \infty \). Combining with (13), (6), we have \( u - u_{h} = {{\left( {f - \hat{f}} \right)} \mathord{\left/ {\vphantom {{\left( {f - \hat{f}} \right)} {b_{1} }}} \right. \kern-0pt} {b_{1} }} - \sum\nolimits_{k = 1}^{n} {{{b_{k + 1} x^{k} u^{\left( k \right)} } \mathord{\left/ {\vphantom {{b_{k + 1} x^{k} u^{\left( k \right)} } {b_{1} }}} \right. \kern-0pt} {b_{1} }}} \) in \( \bar{\varOmega }_{i} \), i = 1, 2,…, M, which leads to (17), and the proof of Theorem 2 is completed.

3 Numerical Examples

In this section, we give some numerical examples to show the performance of our method. In these examples, we mainly check the result (16) and (17) in Theorem 2: the relation of accuracy with the order of Taylor series of the function f(x) and a n+1. We always take the step length \( h = 0.1 \), and in each sub-domain Ω i, i = 1, 2,…, N, we compute Taylor series of f(x) in the center point \( \tau_{i} \) of this sub-domain.

In the following tables, for convenience, the notation \( x.y_{1} y_{2} - p \) means \( x.y_{1} y_{2} \times 10^{ - p} \). We test errors in the center and all endpoints of all sub-domains:

  • E n – the maximum absolute errors at the centers \( \left\{ {\tau_{i} } \right\}_{i = 1}^{N} \);

  • E v – the maximum absolute errors at the endpoints \( \left\{ {x_{i} } \right\}_{i = 0}^{N} \).

The tested equations have respectively the following information:

Example 1.

$$ a_{1} = a_{2} = 1,n = 2,y = x^{2} e^{x} ; $$

Example 2.

$$ a_{1} = a_{2} = a_{3} = a_{4} = a_{5} = 1,n = 5,y = x^{5} \sin \left( {0.2x + 1} \right). $$

From Tables 1 and 2, we can clearly see that the results are in accordance with the theoretical analysis in Sect. 2: the method basically achieves accuracy of \( O\left( {h^{m + 1} } \right) \), in the same time, just as we expected, the errors of u and \( u_{h} \) is inversely proportional to \( \left| {a_{n + 1} } \right| \).

Table 1. Results of Example 1
Table 2. Results of Example 2

4 Conclusions

In this paper, we introduced a new numerical method for solving a class of ordinary differential equation. By giving direct formulas of the undetermined coefficients, we showed this method can avoid solving complicated and large linear systems. Theoretically analysis and numerical experiments demonstrated this method can achieve accuracy \( O\left( {h^{m + 1} } \right) \) when \( f\left( x \right) \in C^{m + 1} \left( {\bar{\Omega }} \right) \).