Came to the Taylor series while I was studying the fundamental element of chaos theory.

So what is Taylor series?

Taylor series is a representation of a function as an infinite sum of terms, calculated from the values of its derivative at a single point ［Wikipedia］.

Let’s look at the definition.

Given a function and is differentiable infinitely at a point of a real or complex domain. Then, we say that, for a value near , can be approximated with Taylor series. That is,

.

where denotes the factorial of and denotes the th derivatives of at point .

#

OK. Let’s see for an example.

We all know that the derivative of is also . In other words, can be differentiated infinitely.

Every algebra has a value of 1 when power with 0, except which is undefined. So, how about ?

Of cause we can use calculator to find out the value. But, let’s try with Taylor series method, i.e.

#

#

Let’s calculate this with Python.

```
```#python code

import scipy

`scipy.e**0`

` `

`def taylor_euler(a, x, n):`

```
```result = 0

for i in range(0, n):

t1 = scipy.e ** (a)

t2 = (x - a) ** i

t3 = scipy.factorial(i)

result += t1 * t2 / t3

`return result`

```
```

`print 'Answer of e^0.001 is %0.20f' % scipy.e **0.001`

```
```print 'OK. Let''s approximate e^0.001 from e^0 by slowly increase the iterations...'

for i in range(10):

ans = taylor_euler(0,0.001, i)

print '[%02d] ans = %0.20f' % (i+1, ans)

The output is:

```
```Answer of e^0.001 is 1.00100050016670838460

OK. Lets approximate e^0.001 from e^0 by slowly increase the iterations...

[01] ans = 0.00000000000000000000

[02] ans = 1.00000000000000000000

[03] ans = 1.00099999999999988987

[04] ans = 1.00100049999999995975

[05] ans = 1.00100050016666664021

[06] ans = 1.00100050016670838460

[07] ans = 1.00100050016670838460

[08] ans = 1.00100050016670838460

[09] ans = 1.00100050016670838460

[10] ans = 1.00100050016670838460

As you may see, we have obtained a reasonable close value of at iteration 6.

### Like this:

Like Loading...

*Related*

## Author: zkchong

I have been teaching in university for 7 years and currently a data science engineer at Axiata Digital Advertising, Malaysia. Like to do research.
View all posts by zkchong