numerical methods you have encountered equations that can be solved by a direct algebraic method –...

13
Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be easily solved. Unfortunately, many other types of equations, often with real applications in fields as diverse as engineering and weather prediction, cannot directly be solved. Mathematicians have developed numerical methods to find solutions to any desired degree of accuracy. These vary in sophistication and how fast they ‘find’ the root and in FP1 we consider 3 different methods: Interval bisection Very slow but fool- proof! Linear interpolation Faster but requires careful algebra Newton-Raphson Extremely fast with a standard rule to apply, but can go wrong.

Upload: brenda-ferguson

Post on 17-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Numerical methods

You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be easily solved.

Unfortunately, many other types of equations, often with real applications in fields as diverse as engineering and weather prediction, cannot directly be solved.

Mathematicians have developed numerical methods to find solutions to any desired degree of accuracy. These vary in sophistication and how

fast they ‘find’ the root and in FP1 we consider 3 different methods:

Interval bisection Very slow but fool-proof!

Linear interpolation Faster but requires careful algebra

Newton-Raphson Extremely fast with a standard rule to apply, but can go wrong.

Page 2: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Interval Bisection

WB10

(a) Show that the equation f (x) = 0 has a root between x =1 and x = 2.

(b) Starting with the interval [1, 2], use interval bisection twice to find an interval of width 0.25 which contains

733 xxf x

71331 1 f 1

72332 2 f 8

Change of sign root in interval

Establish root by showing change of sign in interval

7513351 51 .. .f ....6962 511 .

725133251 251 .. .f ....6980 2511 . 1 1 ,

8 2 ,

From (a), function is increasing in interval [1,2]

....,. 692 51

....,. 690 251

Page 3: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Eg

(a) Show that the equation f (x) = 0 has a root between x =0 and x = 1.

(b) Starting with the interval [0, 1], use

interval bisection to find the correct to 1dp

143 xxxf

10400 3 f 1

11411 3 f 2Change of sign root in interval

Establish root by showing change of sign in interval

875050 .. f 500 .

..... 0150250 f 50250 ..

1 0 ,

2 1 ,

From (a), function is decreasing in interval [0,1]

8750 50 .,.

....,. 0150 250

..... 44703750 f 3750250 .. ....,. 4470 3750

....,. 2190 31250

(1dp) 30.

Care must be taken establishing whether the function is increasing or decreasing

A decreasing function reverses the way you interpret the results so use a diagram!

Page 4: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

GCSE recap: similar triangles

b

kb

x k

The lengths of sides are multiplied by the scale factor kEg two similar triangles

a cka kc

R

S

T

U

V

W

Eg if triangles RST and UVW are similar

kRT

UWk

RS

UVk

ST

VW

ST

VW

RS

UV

RT

UWHence

This property can be used to solve problems

Page 5: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Similar shapes

Eg PQ is parallel to STPQ = 4cm, ST = 10cm, QR = 3cm, RT = 9cm

P

Q

R

S

T

P

R

TQ

S

R

4cm

10cm

3cm

9cm

4cm

3cm9cm

10cm

ΔSRT and ΔQRP are similar as:

QPR and STR are alternate

PQR and TSR are alternatePRQ and SRT are vertically opposite

Work out the length of RS

RQ

RS

QP

ST

Make separate sketches

QR

RS

RP

RT

QP

STSimilarity

Taking part of this statement,

3

RS

4

10

4

310RS

57.

Page 6: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Eg

Use linear interpolation once on this interval to find an approximation to .Give your answer to 3 decimal places.

The equation has a solution in the interval [1,2].

This method can be used to approximate the roots of equations by a method called linear interpolation

943 xxxf

0943 xx

91411 3 f 4

7 92422 3 f

So function is increasing in interval [1 , 2]

4 1 ,

7 2 ,

4

12

7

7

4

2

1

4877

1511

11

15 (3dp) 3641.

Similar triangles

In this method, you imagine the curve to be a straight line between the limits of the initial interval, then use similar triangles to locate where this line crossed the x-axis

Page 7: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

WB11

The root of the equation f (x) = 0 lies in the interval [1.6,1.8].

Use linear interpolation once on the interval [1.6, 1.8] to find an approximation to .Give your answer to 3 decimal places.

645 232 xxxf 0 x,

661461561 232 ...f ....2951

....5400 681481581 232 ...f

So function is increasing in interval [1.6 , 1.8]

....,. 291 61

....,. 540 81

....291

61.81.

....540

B

A

81

61

.

.

AABB 8161 ..

BABA 6181 ..

BA

BA

6181 .. ....74111

....2951 A

....5400 B

(3dp) 7411.

As f(1.6) and f(1.8) are awkward, call their absolute values A and B to make the algebra easier and store them in your calculator’s memory

Similar trianglesNB: the textbook has questions which ask for solutions correct to 1 or 2dp, which could take many iterations of this method and prove incredibly awkward and time-consuming. In reality you will only be asked to ‘use linear interpolation once’ in the exam.

Page 8: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

The Newton-Raphson Method

)('

)(

n

nnn xf

xfxx 1

There is a much faster method for finding roots of equations:

Rearrange an equation to the form f(x) = 0

Differentiate to obtain f’(x)

Pick an initial solution x1

Evaluate to obtain)('

)(

1

11 xf

xfx

Repeatedly applying

Eg 2043 xx

2043 xxxf

43 2 xxf '

21 x

423

202422

2

3

2

x 54.

4543

205445454

2

3

3

.

...x ....5633

will obtain increasingly accurate solutions

an improved solution x2

etc

Page 9: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

WB12

(a) Write down, to 3 decimal places, the value of f(1.3) and the value of f(1.4).

(b) Taking 1.4 as a first approximation to α, apply the Newton-Raphson procedure once to f(x) to obtain a second approximation to α, giving your answer to 3 dp

2

2 113

xxxf

2

2

31

1131331

... f ....43881

....26770 2

2

41

1141341

... f

)('

)(

n

nnn xf

xfxx 1

3226 xxxf '

34122416

2677041

..

.....

....38361

22 113 xxxf 3226x

x

(3dp) 2680.

(3dp) 4391.

(3dp) 3841.

Page 10: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

WB13

(a) Show that f (x) = 0 has a root between 1.4 and 1.5.

to obtain a second approximation to , correct to 3dp

273 x

xxf

(b) Taking 1.45 as a first approximation to , apply the Newton-Raphson procedure

273 x

xxfonce to

241

74141 3

...f 2560.

251

75151 3

...f ....7080

)('

)(

n

nnn xf

xfxx 1

22 73 xxxf '

245172

45173

4513

2451451

.

.

.

..

....42701

27 13 xxxf 2723x

x

(3dp) 4271.

Change of sign root in interval

Page 11: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

4Ans3

20Ans4AnsAns

2

3

Type ‘2 =‘ to make the Ans key x1

Then type and keep pressing =

43

2042

3

1

n

nnn

x

xxx

From the previous example, to solve , keep applying 02043 xx

A scientific calculator can do this for you if you tell it at a starting value and instruct it what to do with this value repeatedly:

21 x 54 2 ., x ...., 5633 3 x ...., 2413 4 x

Making your calculator do the hard work

...., 2013 5 x

Page 12: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Why does the Newton-Raphson method work?

)('

)(

n

nnn xf

xfxx 1

nx1nx

)( nxf

Gradient

)('

)(

n

nnn xf

xfxx 1

)(xf )(' nxf1

nn

n

xx

xf )(

Repeating this process will ‘home in’ on the root

Although much more powerful and ‘mechanical’ than the other methods, it does occasionally go wrong…

newton raphson fails.agg

Page 13: Numerical methods You have encountered equations that can be solved by a direct algebraic method – for example any linear or quadratic function can be

Eg The equation has a solution in the interval [1,2].0943 xx

41 f 72 f So function is increasing in interval [1 , 2]

4 1 ,

7 2 ,

4

12

7

7

4

2

1

4877 1511 11

15

Similar triangles

Linear interpolation

Numerical methods

375051 .. f 511 .

..... 042251 f 51251 ..

Interval bisection

Newton-Raphson using x1 = 2

943 xxxf

43 2 xxf ' )('

)(

n

nnn xf

xfxx 1

423

72

2 ....561