## Taylor Method

Back to Programming

### Description

This method is used to solve the first-order differential equation. This is one of the earliest analytic numeric algorithms which can give an approximate solution of initial value problems for ordinary differential equations. This algorithm is not applied frequently.

DERIVATION

Let consider the first-order differential equation

Differentiating the equation with respect to x, we get

Differentiating successively we can obtain y”, y’’’, ...

We get y(x) for all values of x the above equation converges.

Let,

And let

And we get

In this way, we get a discrete set of values ${\mathbf{y}}_{\mathbf{n}}$ which are the approximations to the actual values of y at the points

### Algorithm

INPUT:

A function f(x)

OUTPUT:

The value after performing the differentiation

PROCESS:

``````Step 1: [defining a function f(x)]
Return exponential(x)/(x^3 - 1)
[End of function ‘f(x)’]

Step 2: [Taylor’s Method]
Set a ← 2.5
Set b ← 4.5
for k = 0 to 3 repeat
Set t1 ← 0
Set h ← (b-a)/2^k
Set n ← 2^k
Set q ← 0
Set e ← f(a)
Print h
Print a
Print b
Print q, a, e
for i = 1 to n - 1 repeat
Set x1 ← a + h × i
Set c ← f(x1)
Set t1 ← t1 + c
Print i, x1, c
[End of ‘for’ loop]
Set g ← f(b)
Print n, b, g
Set l[k] ← h × ((e/2) + t1 + (g/2))
Set d[k] ← l[k]
Print l[k]
[End of ‘for’ loop]
Set p ← 2
for s = 1 to 3 repeat
for r = 0 to p repeat
Set d[s][r] ← d[s-1][r+1]+(d[s-1][r+1]-d[s-1][r])/(2^2s-1)
[End of ‘for’ loop]
Set p ← p - 1
[End of ‘for’ loop]
Print d
Print d, d
Print d, d, d
Print d, d, d, d
[End of Taylor’s method]``````

### Code

1. It is very useful for derivations.

2. This method can be used to get theoretical error bounds.

3. Power series can be inverted to develop the inverse function.

4. Object reference model parameters are embedded as variables in this method.

1. In this method the successive terms get very complex and become difficult to derive.

2. Truncation error tends to grow rapidly which is away from the expansion point.

3. It is always not as efficient as curve fitting or direct approximation.

APPLICATIONS

1. This method is used to calculate the value of an entire function at each point while all of its derivatives are known at a single point.

2. The partial sums can be used as approximations of the function.