32
NUMERICAL ANALYSIS Maclaurin and Taylor Series

NUMERICAL ANALYSIS Maclaurin and Taylor Series. Preliminary Results In this unit we require certain knowledge from higher maths. You must be able

Embed Size (px)

Citation preview

NUMERICAL ANALYSIS

Maclaurin and Taylor Series

Preliminary Results

In this unit we require certain knowledge from higher maths.

You must be able to DIFFERENTIATE.Remember the general rule:

1

1

( ) so ( )

so

n n

n n

f x x f x nx

dyor y x nx

dx

Preliminary Results

We must also remember how to differentiate more complicated expressions:

E.g

( ) (4 1)f x x

Preliminary Results

We must write in a form suitable for differentiation:

f(x) = (4x – 1)1/2 then we differentiate

1

2

1

2

1( ) 4 (4 1)

2

( ) 2(4 1)

f x x

f x x

Preliminary Results

There are 2 new derivatives that we need for this unit,

f(x) = ex and f(x) = ln x.For ex we can look at the graphs of

exponential functions along with their derivatives –

we will consider 2x , 3x and ex.

Preliminary Results

y = 2x is the thicker graph

dy

dx

Preliminary Results

Notice that the two graphs are almost the same, but not quite

y = 3x

dy

dx

Preliminary Results

y = ex

This time the two graphs overlap exactly

Preliminary Results

The graphs show that the derivative of ex is ex.

We will not show the derivative of ln x but you need to remember that it is

1

x

Maclaurin

We are now in a position to start looking at Maclaurin series.

These are polynomial approximations to various functions close to the point where x = 0.

Historical Note

Colin Maclaurin was one of the outstanding mathematicians of the 18th century.

Born Kilmodan Argyll 1698, went to Glasgow University at the age of 11.

Obtained an MA when 15, in 1713.In 1717 became professor at Aberdeen.

Historical Note

In 1725 joined James Gregory as professor of maths at Edinburgh.

Helped the Glasgow excisemen find a way of getting the volume of the contents of partially filled rum casks arriving from the West Indies.

Also set up the first pension fund for widows and orphans.

Historical note

In 1745 fled from the Jacobite uprising and went to York where he died in 1746.

Colin Maclaurin

Maclaurin

ExampleFind a polynomial expansion of degree 3

for sin x near x=0. AnswerFirst we must differentiate sin x three times

( ) sin( ) ( ) cos( ) ( ) sin( )

( ) cos( )

f x x f x x f x x

f x x

Maclaurin

We now put x = 0 in each of these.

(0) sin(0) 0

(0) cos(0) 1

(0) sin(0) 0

(0) cos(0) 1

f

f

f

f

Maclaurin

We can now build up the polynomial:we choose the coefficients of the

polynomial so that the values of f and its derivatives are the same as the values of p and its derivatives at x = 0.

For example we know that f(0) = 0, and so if our polynomial is

Maclaurin

pn(x) = a0 + a1x + a2x2 + a3x3 + ……

then we require pn(0) = 0 as well.

pn(0) = a0 + a10 + a202 + a303 + ……

= a0 + 0 = a0 .

We want this to be 0 so a0 = 0.

Maclaurin

Now we differentiate both f(x) and pn(x).

( ) cosf x x 2

1 2 3( ) 2 3 ......np x a a x a x

Now put x = 0 in both expressions

(0) cos0 1f

1(0) 0 0......np a

Maclaurin

This gives a1 = 1.

Differentiate again to get( ) sinf x x

2 3( ) 2 3 2 .......np x a a x

Put x = 0 again and we get that

2

2

(0) 0 and (0) 2

so a 0.nf p a

Maclaurin

To get the cubic polynomial approximation we must differentiate once more.

3( ) cos and ( ) 6 other terms in xnf x x p x a

For the last time we put x = 0 to get

3(0) 1 and (0) 6nf p a

Maclaurin

6a3 = -1 and so a3 =

We now have the following coefficients for the polynomial:

a0 = 0 a1 = 1 a2 = 0 a3 =

Giving sin x = 1x

1

6

1

6

31

6x

Maclaurin

pn(x) = a0 + a1x + a2x2 + a3x3 + ….

f(0) = pn(0) = a0

Differentiate once so that2

n 1 2 3p ( ) 2 3 ......x a a x a x

Because

2

2

(0) (0) we see that (0) 2

(0)

2

nf p f a

fa

Maclaurin

This can be written assin x = x – x3 6

It is possible to generalise this process as follows:

let the polynomial pn(x) approximate the function f(x) near x = 0.

Maclaurin

f(x) = pn(x) = a0 + a1x + a2x2 + a3x3 + …

f(0) = pn(0) = a0

so a0 = f(0)

Differentiate2

n 1 2 3

n 1

f (x) = p (x) a + 2a x + 3a x .......

so f (0) = p (0) a

Maclaurin

Differentiate again

n 2 3

n 2

f (x) = p (x) = 2a + 3 2a x + ......

so f (0) = p (0) = 2a

2

f (0)giving a =

2

Maclaurin

To get a cubic polynomial we must differentiate once more.

(If we wanted a higher degree polynomial we would continue.)

n 3

n 3

f (x) = p (x) = 3 2a + other terms in x

so f (0) = p (0) = 6a

3

f (0)finally a =

6

Maclaurin

We can now write the polynomial as follows:

This is called the Maclaurin expansion of f(x).

2 3n

f (0) f (0)p (x) = f(0) + f (0) x + x + x + .....

2 6

Maclaurin

The numbers 2 and 6 come about from 2x1 and 3x2(x1).

We can write these in a shorter way as

2! and 3! – read as factorial 2 and factorial 3.

4! = 4x3x2x1 = 24 5! = 5x4x3x2x1 = 120

Maclaurin

This allows us to write the Maclaurin expansion as

2 3(0) (0)( ) ( ) (0) (0) ...

2! 3!n

f ff x p x f f x x x

Maclaurin

Example : obtain the Maclaurin expansion of degree 2 for the function defined by

( ) 1f x x

Maclaurin

First get the coefficients:1

2( ) 1 (1 ) (0) 1f x x x f

1

21 1

( ) (1 ) (0)2 2

f x x f

3

21 1 1

( ) (1 ) (0)2 2 4

f x x f

0 1 2

1 (0) 1so (0) 1, (0) and

2 2! 8

fa f a f a

Maclaurin

This gives the polynomial

21 11 1

2 8for values of x near 0

x x x