submit by email only - haringeymath's blog · submit by email only . methods for advanced...
TRANSCRIPT
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
2
Introduction..........................................................................................................................................3
Terminology.........................................................................................................................................3
Activity 1.................................................................................................................................4
Why use numerical methods? ..............................................................................................................5
Change of sign .....................................................................................................................................5
Activity 2.................................................................................................................................6
Interval Bisection .................................................................................................................................7
Decimal Search ....................................................................................................................................8
Coursework Requirements on Change of sign........................................................................9
Activity 3...............................................................................................................................10
Setting up a spreadsheet to do Decimal Search........................................................10
Activity 4...............................................................................................................................12
Fixed point iteration using x = g(x) ...................................................................................................13
Activity 5...............................................................................................................................13
Staircase and Cobweb Diagrams ..........................................................................................14
Activity 6...............................................................................................................................15
Exploring cobweb and staircase diagrams...............................................................15
Activity 7...............................................................................................................................17
Setting up a spreadsheet to do x = g(x) fixed point iteration....................................17
Activity 8..............................................................................................................................19
When x = g(x) method fails to converge..............................................................................19
Why the method fails .............................................................................................19
Coursework Requirements on x = g(x) fixed point iteration................................................20
Newton-Raphson method .................................................................................................................21
Activity 9..............................................................................................................................22
Setting up a spreadsheet for Newton-Raphson method............................................22
Activity 10............................................................................................................................23
Investigating why the Newton-Raphson method fails..............................................23
Coursework Requirements on Newton-Raphson method.....................................................23
Coursework Requirements on Comparison of the methods..................................................24
Coursework Requirements on Oral Communication............................................................24
Coursework Overview.......................................................................................................................25
Change of sign method......................................................................................................................26
x = g(x) method.................................................................................................................................29
Newton-Raphson method..................................................................................................................31
Comparison of methods....................................................................................................................33
Written Communication....................................................................................................................33
Oral Communication.........................................................................................................................33
Methods for Advanced Mathematics (C3) Coursework: Assessment Sheet......................................34
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
3
−4 −3 −2 −1 1 2 3 4 5 6
−4
−3
−2
−1
1
2
3
4
x
y
root
x = −1.384
root
x = 0
root
x = 0.4086
root
x = 0.9756
Solution (1 solution, 4 roots)
x = −1.384, x = 0, x = 0.4086, x = 0.9756
Graph y = f(x)
Function f(x) = 2.9x⁴ − 4.4x² + 1.6x
Equation 2.9x⁴ − 4.4x² + 1.6x = 0
Introduction In this coursework you will investigate numerical methods of solving equations.
By the end of the coursework, you should be able to:
Use the terms equation, function, root and solution appropriately
Understand that some equations cannot be solved analytically by, for example, factorising
Apply different methods for the numerical solution of such equations to any degree of
accuracy using computers and calculators
Compare the methods in terms of their efficiency and ease of use
Be able to explain how the methods work with the help of graphs
The methods you will learn are
Systematic search for a change of sign (decimal search, bisection or linear interpolation)
Fixed point iteration after rearranging the equation f(x) = 0 into the form x = g(x)
Fixed point iteration using the Newton-Raphson method.
This coursework represents 20% of the assessment for this module.
Terminology You must use the following terms correctly:
You can obtain up to one mark for the correct use of notation and terminology:
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
4
1 2 3 4 5
10
20
x
y
Solution: x = 0.2355
Solution: x = 4.488
−6 −4 −2 2 4 6 8
−40
−20
20
40
x
y
Solution: x = 4.488
solution: x = 4.488
1 mark Correct terminology throughout
½ mark Some errors in terminology
0 marks Repeated failure to use the correct terminology
Activity 1 Find all the mistakes in the following:
In order to find the three roots of the expression 2x = 5x we could draw the functions
y = 2x and y = 5x then find the points at which they intersect.
Alternatively the function 2x = 5x can be rearranged to give 2
x – 5x = 0.
If we now let f(x) = 2x -5x we can check if one of the solutions, x = 4.488, found before will work:
f(0.2355) = 24.488
-5(4.488) = - 1.20 x 10-5
This gives a value that is close to zero. It is not exactly zero because the x-values we obtained were
rounded to four decimal places and so were not exact.
If we draw the graph of y = f(x) then this curve will cross the y-axis at the roots of the function.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
5
+
−
Why use numerical methods? If we want to find the solution to the equation x
3 – x = 0 we can factorise it, so that
0)1)(1( xxx so the three roots are .1,,1,0 xandxx
If we want to find the solution to the equation, 08102 xx we can use the quadratic equation:
a
acbbx
2
42 ’ which gives the two roots: .).4(8769.0 pdx and .).4(1231.9 pdx
Some equations, however, like 0355 xx cannot be solved by algebraic or analytical methods
(factorising or by a simple equation).
To solve these equations we use numerical methods.
You will be asked to investigate using three numerical methods and will have to choose your own
equations to use.
You will lose marks if you choose equations which can be solved algebraically or analytically as we
should only use numerical methods when we cannot solve them otherwise.
Change of sign The first method we are going to explore uses the fact that around a root, the value of a function
changes sign.
As an example consider the function: .35)( 5 xxxf
19310323)2(5)2()2( 5 f
73513)1(5)1()1( 5 f
Since the function changes sign between -2 and -1 (it goes from -19 to +7) then there must be
a root in the interval [-2, -1].
+
−
ROOT
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
6
Activity 2
One player chooses a number between 1 and 100 and writes it
down. The other player can ask yes/no questions to try and
find out the number.
How many questions did you take?
What is the smallest number of questions you can guarantee
finding the number in?
What if the number chosen was between 1 and 1000?
What if the number chosen is between 1 and n?
48 Is your number
less than 15?
No!
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
7
−2 −1 1 2
−20
−10
10
x
y
f(−2) = −19
f(−1) = 7
Next try midpoint
f(−1.5) = 2.91 (3 s.f.)
−5 −4 −3 −2 −1
−20
−10
10
20
x
y
f(−2) = −19
f(−1) = 7
f(−1.5) = 2.91 (3 s.f.)
f(−1.75) = −4.66 (3 s.f)
Interval Bisection Consider the equation 0355 xx
We use the function .35)( 5 xxxf and we have already seen that there is a sign change and
therefore a root in the interval [-2, -1].
With interval bisection, we now bisect the interval, in other words we next try the midpoint of the
interval (-2 + -1)/2 = -1.5
.).3(91.23)5.1(5)5.1()5.1( 5 fsf
We know that there is a sign change from f(-2) = -19 to f(-1.5) = 2.91 and so the root must lie in the
interval [-2, -1.5].
We can repeat this process until any required degree of accuracy is obtained.
We now repeat the process.
The midpoint of the current interval is
(-2 + -1.5)/2 = -1.75
and f(-1.75) = -4.66
We know that there is a sign change
from f(-1.75) = -4.66
to f(-1.5) = 2.91
and so the root must lie in the interval
[-1.75, -1.5]
Our current estimate of the root is
(-1.75 + -1.5)/2 = -1.625
The maximum possible error is
-1.625 – (-1.75) = 0.125 so
Root = -1.625 ± 0.125
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
8
−1.7 −1.65 −1.6 −1.55 −1.5
−3
−2
−1
0x
y
Decimal Search Consider the equation 0355 xx
We use the function .35)( 5 xxxf and we have already seen that there is a sign change and
therefore a root in the interval [-2, -1].
−2 −1 1 2
−20
−10
10
x
y
f(−2) = −19
f(−1) = 7
In this method, you first take increments in x of size 0.1 within the interval and work out the value of
the function for each one:
x -2 -1.9 -1.8 -1.7 -1.6 -1.5 -1.4 -1.3 -1.2 -1.1 -1
f(x) -19.00 -12.26 -6.90 -2.70 0.51 2.91 4.62 5.79 6.51 6.89 7.00
From the table we can see that there is a sign change from -1.7 to -1.6 and so this is our new interval
in which the root must lie [-1.7, -1.6]
We now repeat the process by considering steps of size 0.01 from -1.7 to -1.6 :
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
9
0.1 0.2 0.3 0.4 0.5 0.6 0.7
−0.2
−0.1
0.1
0.2
x
y
Roots that are very close together will cause the change of sign method to fail.
x -1.7 -1.69 -1.68 -1.67 -1.66 -1.65 -1.64 -1.63 -1.62 -1.61 -1.6
f(x) -2.70 -2.34 -1.98 -1.64 -1.30 -0.98 -0.66 -0.36 -0.06 0.23 0.51
We can see that there is a sign change from -1.62 to -1.61 and so this is the new interval in which the
root must lie [-1.62, -1.61]
x -1.62 -1.619 -1.618 -1.617 -1.616 -1.615 -1.614 -1.613 -1.612 -1.611 -1.61
f(x) -0.0577 -0.0283 0.0010 0.0302 0.0594 0.0884 0.1174 0.1463 0.1751 0.2038 0.2324
We can see that there is a change of sign from -1.619 to -1.618 and so our estimate of the root at this
stage is (-1.619 + -1.618)/2 = -1.6185 with a maximum error of ± 0.0005
Coursework Requirements on Change of Sign You will need to demonstrate one change of sign method for your coursework.
You can use Interval Bisection or Decimal Search
You should find a root of an equation that cannot easily be found using algebraic or analytical
methods. You must choose an equation yourself that does not appear in these notes and must not be
the same equation as anyone else. (1 mark).
You must explain the method you have used, and your explanation must include graphs to illustrate
the method. (1/2 mark).
You must correctly state the error bounds for your answer (e.g ± 0.0005) (1/2 mark).
You must give an example of an equation where one of the roots cannot be found using your chosen
change of sign method. You must include an explanation with graphs to illustrate why the method
does not work in this case. ( 1 mark)
Examples of why change of sign might not work.
0.1 0.2 0.3 0.4 0.5 0.6 0.7
−0.2
−0.1
0.1
0.2
x
y
A repeated root causes change of sign to fail. Note that the root must be t 2 d.p. or it will be easily found.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
10
Activity 3
Setting up a spreadsheet to do Decimal Search We are going to use an Excel spreadsheet to do a decimal search for a root of the equation:
22 xx
We need to rearrange the equation to give 022 xx. We will draw the graph of 22 xy x
(using Autograph) in order to locate a root of the function 22)( xxf x
−4 −2 2 4
−1
1
2
3
x
y
It appears from the graph that there is a root at 2x and if we check:
0222)2( 2 f , this confirms that one root is 2. As this root was easily located from the
graph, it was not appropriate to use numerical methods to find it.
Also looking at the graph we can see there is a root between -2 and -1 which we can confirm by
looking for a sign change.
25.02)2(2)2( 2 f 5.02)1(2)1( 1 f
The sign change shows that there is a root between -2 and -1.
We will set up an Excel spreadsheet to do a decimal search for this root.
The diagram below shows the formulae we need to enter. You will find it easier if you drag the
formulae in cells C1 and B2 across the page.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
11
This should give a spreadsheet that looks like this. Set the format of row 2 to four decimal places so
that the information can be read easily.
We can see from the table that there is a sign change between -1.7 and -1.6 so we now need to zoom
in on this interval. Copy and paste the first table then change it to look at this interval.
You will have to change B4 to be -1.7 and remember to change the increment to 0.01 instead of 0.1 in
cell C4 then copy the new formula across.
The spreadsheet should then look like this:
Now we can see that the sign change is between -1.7 and -1.69 so we zoom in on this interval. Again
copy and paste the table down then change it.
Set the increment in the formula in C7 to 0.001 then copy the formula across.
Our estimate of the root is (-1.691 + -1.690)/2 = -1.6905 and the error bounds are ± 0.0005
(since the root must lie between -1.691 and -1.690).
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
12
Activity 4 Explain why a change of sign method will not work in the following cases.
1. The equation 033
13
2
xx
xxis to be solved using a change of sign method.
Show that the function 3
2
33
1)(
xx
xxxf
gives a sign change from x =2 to x =3 and
explain with the aid of a graph why the sign change method fails to find a root in this case.
2. The equation 016116 234 xxxx has a root 2.618 (3 d.p.) but testing for a sign
change from x = 2 to x = 3 fails.
Show that the function 16116)( 234 xxxxxf does not give a sign change from
x = 2 to x = 3 and explain with the aid of a graph why the sign change method fails to find the
root in this case.
3. The equation 01101025 23 xxx is to be solved using a change of sign method.
Show that the function 1101025)( 23 xxxxf does not have a sign change from
X = -1 to x = 0 and explain with the aid of a graph why the sign change method fails to find a
root in this interval even though one exists.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
13
2 4 6 8 10
−2
2
4
x
y
y = x − cos x
2 4 6 8 10
−2
2
4
x
y
y = cos x
y = x
Fixed point iteration using x = g(x)
Activity 5 1. Set your calculator in radian mode.
Enter the following keys:
0 =
Cos ANS =
Press = repeatedly and describe what happens.
2. Enter the following keys:
0.5 =
√ ANS =
Press = repeatedly and describe what happens.
Repeat the process with other positive values in place of 0.5. What happens?
3. Enter the following keys:
0.5 =
√ (ANS + 1) =
Press = repeatedly and describe what happens.
Repeat the process with other positive values in place of 0.5. What happens?
4. A diagram that goes with the first equation above is given below:
The equation that this solves is x = cos x (why?) or x – cos x = 0.
Check that your final value for question 1 is a root of this equation.
Draw similar diagrams for questions 2 an 3.
Write down the equations that they solve.
5. Two graphs connected with question 1 are:
Indicate which points on each of these graphs corresponds to the root you found. Sketch similar
graphs for questions 2 and 3 and indicate which points the roots correspond to.
0 cos
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
14
0.5 1 1.5
−1.5
−1
−0.5
0.5
1
1.5
2
x
y
y = x
y = cos x
Staircase and Cobweb Diagrams
To solve the equation x = cos x we firstly rearrange it so that it is in the form
X = g(x) which in this case would be x = cos x
If we write this as an iterative formula:
rr xx cos1
This says that the next x is the cosine of the previous x.
If we start with x0 = 0 then
x1 = cos x0 = cos 0 = 1
x2 = cos x1 = cos 1 = 0.540302
x3 = cos x2 = cos 0.540302 = 0.857553 and so on
Drawing the graphs of y = x and y = cos x, we can show these values on the graph.
The diagram shows how the iterative process converges in on the root. This type of diagram is called
a cobweb diagram.
Looking at the second example, to solve 02 xx we can rearrange to xx
Note that this equation would not normally be solved using numerical methods because it can be
solved by factorising and would not be suitable for your coursework.
If we write this as an iterative formula:
rr xx 1
This says that the next x is the square root of the previous x
If we start with x0 = 0.5 then
840896.07071070
707107.050
12
01
xx
xx
x1 x0 x2 x3
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
15
0.2 0.4 0.6 0.8 1
0.2
0.4
0.6
0.8
1
x
y
917004.0840896.023 xx and so on.
Drawing graphs xy and xy we can show these values on a graph:
0.5 1 1.5 2
−0.5
0.5
1
x
y
y = x
y =√x
The diagram shows how the iterative process converges in on the root. This type of diagram is
called a staircase diagram.
Activity 6
Exploring cobweb and staircase diagrams
1. Below are the graphs of xy and 4
13 xy used to illustrate how the equation
0144 3 xx can be solved using fixed point iteration.
a) Show that the equation 0144 3 xx can be rearranged in the form x = g(x)
b) Starting with x0 = 0.7 draw lines to show whether this is a staircase or a cobweb.
c) What happens if you started with x0 = 0.9?
x0
x1
x2
x3
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
16
2 4 6
2
4
x
y
−1 −0.5 0.5 1
−0.6
−0.4
−0.2
0.2
0.4
0.6
x
y
2. Below are the graphs of y = x and 50
43x
y used to illustrate how the equation
0200503 xx can be solved using fixed point iteration.
a) Show that the equation 0200503 xx can be rearranged to )(xgx
b) Starting with 20 x draw lines to show whether this is a staircase or a cobweb.
3. Below are the graphs of xy and 2
122 2 xy x
a) Which equation of the form 0)( xf do these graphs illustrate the solution of?
b) Starting with 5.00 x draw lines to show fixed point iteration.
c) Explain why the iteration starts out as a staircase then becomes a cobweb.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
17
2 4
−1
1
2
x
y
y = x
g(x) = sinx + cosx + (x/2)
f(x) = 2(sinx + cosx) −x
Activity 7
Setting up a spreadsheet to do x = g(x) fixed point iteration
We are going to set up a spreadsheet to solve 0)cos(sin2 xxx
1. Show that this can be rearranged into the form 2
cossinx
xxx
2. Use a graph drawing program to check the graphs below.
What do these graphs illustrate?
3. Set up a new spreadsheet as shown below (the top left cell is A1). Enter the first formula
(for r =2) and then use the autofill tool to copy the formula down the spreadsheet.
r 2,,2
)sin()cos( 111 rwhen
xxxx r
rrr
1 2
2 =COS(B2)+SIN(B2)+0.5*B2
3 =COS(B3)+SIN(B3)+0.5*B3
4 =COS(B4)+SIN(B4)+0.5*B4
5 =COS(B5)+SIN(B5)+0.5*B5
6 =COS(B6)+SIN(B6)+0.5*B6
7 =COS(B7)+SIN(B7)+0.5*B7
8 =COS(B8)+SIN(B8)+0.5*B8
9 =COS(B9)+SIN(B9)+0.5*B9
10 =COS(B10)+SIN(B10)+0.5*B10
11 =COS(B11)+SIN(B11)+0.5*B11
12 =COS(B12)+SIN(B12)+0.5*B12
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
18
0.5 1 1.5 2
−0.5
0.5
1
1.5
2
x
y
4. You should obtain results like those below:
r 1,),( 1 rwhenxgx rr
1 2
2 1.49315059
3 1.82113012
4 1.631667484
5 1.753148092
6 1.678651138
7 1.725869049
8 1.696482877
9 1.714997379
10 1.703417901
11 1.710694444
12 1.706135202 If you continue the spreadsheet downwards, you should find that the iterative process converges to the
root 1.7079 to 5 s.f.
5. Use the sign change method with xxxxf )cos(sin2)( to show that this root is
correct to 5 s.f.
Calculate f(1.70785)
Calculate f(1.70795)
Show that there is a sign change between these and therefore the root must be between
1.70785 and 1.70795. Since all the values in this range are 1.7079 (5 s.f.) then the root must be correct
to 5 s.f.
6. Draw lines on the graph below to show whether it is a staircase or cobweb diagram:
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
19
0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
x
y
Activity 8
When the x = g(x) method fails to converge
Consider the equation 0355 xx
1. Show that this can be rearranged to give 5
35
xx
2. Set up the spreadsheet to do fixed point iteration using this rearrangement. Start with 11 x
to find a root of the equation between 0x and 1x correct to 5 significant figures.
On the graph below illustrate this process:
3. Change your starting value to 3.11 x to try and find the root between 1.2 and 1.3.
What happens? Show on the diagram above what is happening.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
20
0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
x
y
y = g(x)y = x
Gradient of g(x) > 1 (steeper than y =x)and so the sequence does not converge
Gradient of g(x) < 1 (less steep than y =x)and so the sequence converges
Why the method fails
4. Show that another arrangement of 0353 xx is 5 35 xx
5. Use Autograph to show xy and 5 35 xy on the same axes
6. Set up a spreadsheet to iterate 5 35 xx and try to find each of the three roots of the
equation 0353 xx correct to 5 s.f. (don’t forget to check your roots with a sign
change)
7. Using your graph from 5 and looking at the gradient of 5 35 xy around each of the
roots, explain why some of the roots can be found but not all of them.
Coursework Requirements on x = g(x) fixed point iteration Using x = g(x) fixed point iteration you should find one root of an equation that cannot easily be
found using algebraic or analytical methods. You must choose an equation for yourself that does not
appear in these notes, must not be the same as anyone else and should be different from the equation
you used for the change of sign method. ( 1 mark)
You must show using a graph of your y = x and your y = g(x) how the convergence works (cobweb or
staircase diagram) (½ mark)
Explain using your graphs how the gradient of g(x) near to the root means that the iteration
converges. (½ mark)
You must give an example, using the same original equation, where x = g(x) fixed point iteration fails
to converge. This could be using the same x = g(x) rearrangement as above (if there is another root
for which it does not converge) or using a different rearrangement of the same original equation.
( 1 mark)
You must show using a graph of your y = x and your y = g(x) how the convergence fails to work.
(½ mark)
Explain using your graphs how the gradient of g(x) near the root means that the iteration does not
converge. (½ mark)
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
21
1 2 3
10
20
30
x
yDraw a tangent
at the estimate x = 2
Root we are finding
Second
estimate
Initial
estimateThird
estimate
Newton-Raphson Method This is another fixed point iteration method and, as with x = g(x) iteration, you need an estimate of the
root as a starting place.
Consider finding a root of the graph 0)( xf with an initial estimate of 21 x
If we draw a tangent to the curve at 2x , then where that tangent crosses the x-axis is a better
estimate of the root.
1 2 3
10
20
30
x
y
Draw a tangent
at the estimate x = 2
Root we are finding
Where the tangent
crosses the x axis
is the next estimate
We can then iterate (repeat the procedure) to find better and better estimates:
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
22
The Newton-Raphson iterative formula is:
)(
)('1
r
rrr
xf
xfxx
Activity 9
Setting up a spreadsheet for Newton-Raphson method
Consider the equation 0355 xx
We want to solve 0)( xf where 35)( 5 xxxf
1. Differentiate f(x) to find f’(x)
The Newton-Raphson formula will become:
55
354
5
1
x
xxxx rr
and we will start with an initial estimate 21 x
2. Set up the spreadsheet. The formulae are given below. Once you have entered the formula into
cell B3, drag it down.
You should find that the iterations converge to 1.2757 (5 s.f.).
Check with a sign change that this is correct:
Calculate f(1.27565)
Calculate f(1.27575)
Show that there is a sign change between these values and hence the root lies between them. All
values in this interval round to 1.2757 (5 s.f.)
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
23
Activity 10
Investigating why the Newton-Raphson Method fails 1. Investigate what happens when you try to use the Newton-Raphson method to solve the
equation 0355 xx with an initial value 11 x .
Draw a graph to explain the problem.
2. Investigate what happens when you try to use the Newton-Raphson method to find the root of
the equation xxy )2log( between -1 and -2
Draw a graph to explain the problem.
3. Investigate what happens when you try to use the Newton-Raphson method to find the root of
the equation 05
5
xx
with an initial value of 11 x
Draw a graph to explain what is happening.
Coursework Requirements on the Newton-Raphson Method Using the Newton-Raphson Method you should find all the roots (at least 2) of an equation that
cannot easily be found using algebraic or analytical methods. You must choose an equation for
yourself that does not appear in these notes, must not be the same as anyone else and should be
different from the equation you used for either of the other methods (change of sign and x = g(x)
iteration).
One root found (1 mark)
All the roots are found (+1 mark = 2 marks total)
You must show using a graph of your chosen equation how the convergence works for one of the roots
(1 mark)
You must use the change of sign method to establish error bounds for one of your roots (1 mark).
You must give an example of an equation where the Newton-Raphson Method fails to find a particular
root, despite a starting value close to it (the starting point should be the nearest integer on either side
of the root). Using a graph of your chosen function you must explain why the method fails (1 mark)
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
24
Coursework Requirements on Comparison of methods You must select one of the three equations you have used so far for your examples of the 3 different
methods and use the other two methods on that same equation so that you can compare the methods.
You should use the same starting point for each method and obtain the answer to the same accuracy
using each method. (1 mark)
You must compare the three methods in terms of speed of convergence (how many
calculations/iterations were involved). (1 mark)
You must compare the three methods in terms of how easy they were to apply with the software and
hardware you used. (1 mark)
Coursework Requirements on Oral Communication You will have a short interview with one of your teachers about your coursework. They will ask you to
explain what you have done, and will ask you to go through the working for one of the methods to
check your understanding. (2 marks)
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
26
Change of sign method
A 1. Choose an equation, f(x) = 0, that cannot be solved using analytical methods.
You should not choose a quadratic or linear function as these are easily solved using
methods you already know.
A cubic or higher degree polynomial would be suitable as long as it does not factorise
easily or have obvious roots from the graph.
o For example 03 23 xxx is no good because it can be factorised
0)13( 2 xxx then one root is x =0 and the quadratic can be solved
using the quadratic equation.
2. Find one root using decimal search or interval bisection.
If your equation has more than one root, you only have to find one.
Draw a graph of your function to see where the root is approximately.
o See which two integer x values your root is between to use as your starting
points for your method
o You could check that these two values give you a sign change as a starting
point.
Apply the method of decimal search or interval bisection to find the root (see 3 below
for details of error bounds)
o You will probably use a spreadsheet to do this – see example in the
coursework book.
3. Make sure you include the correct error bounds
Your error bounds should be ± 0.0005
Suppose the last sign change interval you find is from 1.456 to 1.457 then you know
the root is somewhere in this interval. If you use 1.4565 (the midpoint of the interval)
as your estimate then the maximum error (the most you could be wrong by)
is ± 0.0005
4. Explain your working using graphs that show your function.
If your function was 132)( 23 xxxxf then you would start with a graph of
132 23 xxxy . You will probably use a graph drawing program to produce
this. You may need to zoom in and out to obtain a good graph. You will then need
further graphs for the subsequent stages.
Your explanation should combine graphs and words to explain what you have done –
see the examples in the coursework book for help.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
27
0.38 0.4 0.42 0.44 0.460
0.02
0.04
0.06
0.08
0.1
0.12
0.14
x
y
B 1. Choose an equation for which the change of sign method fails to find a root.
2. Explain why the change of sign method fails in this case using a graph of your function.
The equation must not be trivial (they must require a graph to be drawn in order to
determine why they don’t work).
Examples of trivial equations are:
0)2(,0)3(
1,0
1 2
xxx
Three possible ways of designing an equation that fails with change of sign to find one of
the roots are given below – you only need 1.
o Designing an equation with repeated roots (done in Polynomials chapter of C1)
will give a function which touches the x-axis and thus the method will fail as no
root is detected. You should, however, choose the repeated root to be a number to
at least 2 DECIMAL PLACES. Otherwise the first table in the decimal change
procedure will solve the equation on its own.
For example 0)43.0)(2(50 2 xx will give the graph below.
The 50 factor in the example is simply to “sharpen” the vertex at 0.43 and emphasise the fact that the
graph merely touches at this point. Note that although the initial design of the failure is artificial and
uses a squared factor, when writing up the coursework give ALL the equations in expanded form
(without brackets) – otherwise the solution is obvious by algebraic techniques.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
28
−5 −4 −3 −2 −1
−20
20
40
x
y
o Designing an equation with close roots is similar to the repeated roots example
above. For example
0)43.0)(42.0)(2(50 2 xxx
o Designing an equation with a discontinuity can be done with a function that is a
fraction where the denominator has roots.
For example
023
2323
23
xx
xx
The function 23)( 23 xxxh in the denominator has a root between 3 and 4
so the whole fraction equation has an asymptote between 3 and 4 causing the
change of sign method to think there is a root in the interval when no root exists.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
29
x = g(x) Method A 1. Choose a different equation, f(x) = 0, that cannot be solved using analytical methods.
The equations that you use for the three methods must all be different to each other and to
everybody else doing the coursework (no copying).
As with change of sign, a quadratic or linear function is no good. Cubics or higher degree
polynomials are ok if they do not factorise easily.
2. Rearrange the equation into the form x = g(x)
You may have to try several rearrangements until you find one that will converge with
this method. If you find rearrangements that don’t work then you can use one of these
to demonstrate failure (see B below).
3. Find one root using x = g(x) iteration.
Draw a graph of your function, y = f(x) , to establish an integer close to a root as a
starting point.
You will probably use a spreadsheet to do the calculations – see the example in the
coursework booklet.
4. Establish the accuracy of the root using a change of sign.
Suppose you obtain a root 0.68232 (5 d.p.) then you should check that the original f(x)
(not rearrangement g(x) formula) gives a sign change from 0.682315 to 0.682325. As
all the numbers in this interval would round to 0.68232 you can conclude that this is
the root to 5 d.p.
5. Explain your working using a graph that shows your function.
You should draw the graph of your y =f(x) to establish a starting point (see 3 above).
You should draw y = x and your chosen y = g(x) on the same axes and use your graph
to show whether it is a cobweb diagram or a staircase diagram that converges on the
root you have found.
You have to explain why the method converges by comparing the gradient of y = x
with the gradient of y = g(x) around the root you are finding. The gradient of g(x)
should be less than the gradient of should be less than the gradient of y = x (i.e.
between -1 and 1) if it converges. The graph drawing program has a ‘gradient’
function which you can use to draw the gradient graph y = g’(x) which will help with
your explanation.
Your explanation should combine graphs and words to explain what you have done –
see examples in the coursework book for help.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
30
B 1. Choose a rearrangement of the equation used in A for which the x = g(x) method fails to find
a root.
Starting with the same f(x) = 0 equation, try rearranging it in a different way to obtain
x = g(x). Usually an alternative rearrangement will fail to find the root that you found
in A.
2. Explain why the x = g(x) method fails in this case using a graph of your function.
Draw y = x and y = g(x) graphs on the same axes for your rearrangement that doesn’t
work and draw lines on it to show that the method diverges rather than converges on
the root.
You have to explain why the method diverges by comparing the gradient of y = x
with the gradient of y = g(x) around the root you are finding. The gradient of g(x)
should be more than the gradient of y = x(i.e less than -1 or more than 1) if it
diverges. The graph drawing program has a ‘gradient’ function which you can use to
draw the gradient graph y = g’(x) which will help with your explanation.
Your explanation should combine graphs and words to explain what you have done –
see examples in the coursework book for help.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
31
Newton-Raphson Method A 1. Choose a different equation, f(x) = 0, with at least 2 roots that cannot be solved using
analytical methods.
With the Newton-Raphson method your equation must have at least 2 roots and
you have to find all of them.
The equations that you use for the three methods must all be different to each
other and to everybody else doing the coursework (no copying).
As with the change of sign, a quadratic or linear equation is no good. Cubics or
higher degree polynomials are ok if they do not factorise easily.
2. Differentiate your function and set up the Newton-Raphson formula.
Check your differentiation to make sure it is correct.
The Newton-Raphson iterative formula is:
)(
)('1
r
rrr
xf
xfxx
You do not have to derive this formula
You should give your own version of it in your coursework with your f(x) and
f’(x) substituted into it.
3. Find all the roots using the Newton-Raphson method.
Draw a graph of the function ( y = f(x) ) to establish roughly where the roots are.
You will start the search for each root at the closest integer to that root.
You will probably use a spreadsheet for this – see the coursework booklet for an
example.
4. Establish the accuracy of the roots using the change of sign method.
Suppose you obtain a root 0.68232 (5 d.p.) then you should check that the original f(x)
gives a sign change from 0.682315 to 0.682325. As all the numbers in this interval
would round to 0.68232 you can conclude that this is the root to 5 d.p.
5. Explain your working using graphs that show your function.
On a graph of your curve y = f(x) draw the appropriate tangents to show the method
converging on the root.
Your explanation should combine graphs and words to explain what you have done –
see examples in the coursework book for help.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
32
2 2.2 2.4 2.6 2.8 3 3.2 3.4
−0.2
−0.1
0
0.1
0.2
x
y
B 1. Choose an equation for which the Newton-Raphson fails to find a root.
2. Explain why the Newton-Raphson method fails in this case using a graph of your function.
The failure should not be because you have started too far away from the root – you
must start at one of the integers either side of the required root.
One possible way of designing an equation that fails with the Newton-Raphson
method to find one of the roots is given below. Other examples are given in the
coursework booklet and could be used to find other examples that fail with this
method.
o Start with an equation f(x) = 0 with a repeated root, then subtract a constant
from the function f(x):
Example 0)3)(2( 2 xx has a repeated root at x = 3
If we subtract a (small) constant from the left hand side:
00753.0)3)(2( 2 xx
Then the equation will have a root close to 3, but starting with x = 3 using the
Newton-Raphson method will not work as the tangent is horizontal at this
point:
Note that although the initial design of the failure is artificial and uses a squared factor, when
writing up the coursework give ALL the equations in expanded form (without brackets) –
otherwise the solution is obvious by algebraic techniques.
Methods for Advanced Mathematics (C3) Coursework
Numerical Methods
33
Comparison of Methods 1. Choose one of the equations you have used already for the change of sign, x = g(x) or Newton-
Raphson method.
It does not matter which one you choose but remember you will have to be able to
differentiate in order to do the Newton-Raphson and the gradient of the g(x) method
must be less than 1.
2. Find that same root using the other 2 methods (using the same starting value and finding the
answer to the same accuracy).
You must start from the same starting value for all three methods (and it must
converge to the same root for all three methods).
You must obtain the same root to the same degree of accuracy (and check that
accuracy using a sign change where necessary).
You must use the same technology (e.g. a spreadsheet) for each method so that you
can compare how easy each of the methods was using the technology.
3. Compare the three methods in terms of speed of convergence (how many iterations to find a
root) and ease of use of the hardware/software.
How many iterations did each of the methods take?
Talk about how easy each of the methods was to set up in your case (e.g. how easy to
find a rearrangement of the equation for x = g(x), how easy the function was to
differentiate for Newton-Raphson) and how these considerations would influence your
choice of method for other equations.
Talk about how easy each of the methods was to implement using the technology you
chose.
Written Communication Check through to make sure you have used the correct terminology throughout your work. Be
particularly careful with equation, function, graph, root and solution.
Oral Communication You will be given a short interview on your work in which you will be asked to explain what you did
in general and explain one of the methods in detail.