Professional Documents
Culture Documents
1
MEI C3 Coursework
Introduction
During this coursework I will be using 3 different numerical methods to solve a range of polynomials,
for each method I will be giving a brief explanation, an example of a root being found successfully
and then an example of the method failing. Once I have demonstrated the methods I will then be
comparing each method against each other.
Change of Sign
When using a change of sign method you would first find the intervals that the roots lie in, either
graphically or by substituting values of into the equation and looking for a change in sign of the
value. Once you have your intervals you would then split this interval down again looking for a
change of sign, and then repeat this process until the root is found to the required accuracy.
I will be using decimal search; in this method once I have found my first interval for a root I would
then go up in the interval in increments finding another change of sign, which would then give me a
new smaller interval, which I will then take smaller increments of finding another change of sign, I
will be repeating this method until I find the root to a required accuracy.
I will be finding one root of the equation
The graph of the function
when and
()
()
= 2
()
()
= -2
There is a change in sign of () and () which means that the root does lie in the interval [0,1], I
will now take increments of 0.1 to look for another change of sign
() ()
()
= 1.951
() ()
()
= 1.808
I will continue these calculations in Microsoft Excel
x f(x)
0 2
0.1 1.951
0.2 1.808
0.3 1.577
0.4 1.264
0.5 0.875
0.6 0.416
0.7 -0.107
0.8 -0.688
0.9 -1.321
1 -2
From these calculations I can see there is a change of sign between () and () this gives me
a new interval of [0.6, 0.7]
I will now take increments of 0.01 to look for another change of sign
() ()
()
= 0.366481
() ()
()
= 0.316328
Alexander White
3
I will continue these calculations in Microsoft Excel
From the calculations I can see there is a change of sign between () and () this gives me
a new interval of [0.68, 0.69]
I will now take increments of 0.001 to look for another change of sign
() ()
()
= -0.002432
() ()
()
= -0.00841
I will now continue these calculations using Microsoft Excel
X f(x)
0.68 0.002432
0.681 -0.00298
0.682 -0.00841
0.683 -0.01383
0.684 -0.01927
0.685 -0.02471
0.686 -0.03015
0.687 -0.0356
0.688 -0.04106
0.689 -0.04652
0.69 -0.05199
From the calculations I can see there is a change of sign between () and () this gives
me a new interval of [0.680, 0.681]
X f(x)
0.6 0.416
0.61 0.366481
0.62 0.316328
0.63 0.265547
0.64 0.214144
0.65 0.162125
0.66 0.109496
0.67 0.056263
0.68 0.002432
0.69 -0.05199
0.7 -0.107
Alexander White
4
I will now take increments of 0.0001 to look for another change of sign
() ()
()
=0.001891
() ()
()
=0.001349
I will now continue these calculations using Microsoft Excel
X f(x)
0.68 0.002432
0.6801 0.001891
0.6802 0.001349
0.6803 0.000808
0.6804 0.000266
0.6805 -0.00028
0.6806 -0.00082
0.6807 -0.00136
0.6808 -0.0019
0.6809 -0.00244
0.681 -0.00298
From the calculations I can see there is a change of sign between () and () this
gives me a new interval of [0.6804, 0.6805]
I will now take increments of 0.00001 to look for another change of sign
() ()
()
+2
=0.000266
() ()
()
= 0.000158
I will continue these calculations in Microsoft Excel
X f(x)
0.6804 0.000266
0.68041 0.000212
0.68042 0.000158
0.68043 0.000104
0.68044 4.98E-05
0.68045 -4.4E-06
0.68046 -5.9E-05
0.68047 -0.00011
0.68048 -0.00017
0.68049 -0.00022
0.6805 -0.00028
Alexander White
5
From the calculations I can see there is a change of sign between () and () this
gives me a new interval of [0.68044, 0.68045]
I will now take increments of 0.000001 to look for another change of sign
() ()
()
= 4.44
x10
-5
() ()
()
=3.9
x10
-5
X f(x)
0.68044 4.98E-05
0.680441 4.44E-05
0.680442 3.9E-05
0.680443 3.35E-05
0.680444 2.81E-05
0.680445 2.27E-05
0.680446 1.73E-05
0.680447 1.19E-05
0.680448 6.47E-06
0.680449 1.06E-06
0.68045 -4.4E-06
From these calculations I can see there is a change of sign between () and ()
giving me a new interval of [0.680449, 0.68045]
As both of these numbers round up to 0.68045 to 5 decimal places
To 5 decimal places
0.2 0.4 0.6 0.8 1
2
1
1
2
x
y
Root
()
()
Alexander White
6
This is a zoomed in picture of my graph showing that the root does lie in the first interval [0,1], the
decimal search method then works by finding a smaller interval that the root lies in, for this root the
next interval was [0.6,0.7]
This shows that the next interval for this root is [0.6, 0.7]
Failures of Change of sign methods
Under certain situations the change of sign methods will not work, for example the equation
The graph of ()
), this process is repeated until my estimates round to a degree of accuracy giving me the
root. However since drawing in the tangents would be inaccurate it can be done using an iterative
process and achieve the same results.
I will solve the equation
From the graph I can see that the roots lie in the intervals [-2,-1] [-1, 0] and [1, 2], I will now use
Newton-Raphson to find these roots
The general formula Newton-Raphson is
)
(
)
Before I can start finding the roots I need to find () for my function
()
()
Now that I have this I can generate my iterative formula for this function
2 1 1 2
6
4
2
2
4
x
y
y=x-5x-2
Alexander White
9
Now that I have my iterative formula I can now begin to find the root in the interval [-2,-1], I will use
as my first estimate
()
()
()
()
= -1.6800002
()
()
()
()
= -1.4795169
I will now continue these calculations using Autograph
From these calculations I can see that Autograph has found the root
The root is to 5 decimal places
To confirm this I will now use error bounds to see if there was change of sign either side of the root
( ) () -4.089022992
x10
-5
() 8.621627124
x10
-5
Since there is a change of sign in my error bounds is a root of
Alexander White
10
This shows how Autograph found the root using Newton-Raphson, after
was imputed it found
by drawing a tangent to ()
2.4 2.2 2 1.8 1.6 1.4 1.2 1
25
20
15
10
5
0
x
y
X1
Tangent to y=x5x2 at X1
X2
Tangent to y=x5x2 at X2
Root
Alexander White
11
The root in the interval [-1, 0] is to 5 decimal places
( ) () 1.207918099
x10
-5
() -3.598372658
x10
-5
Since there is a change of sign is a root of
In the interval [1,2] using
The root in the interval [1, 2] is to 5 decimal places
( ) () 2.429750662
x10
-4
() -2.023798041
x10
-5
Since there is a change of sign is a root of
Alexander White
12
Failures of Newton-Raphson
This method will sometimes fail to find a root, for example the graph of
, this
shows a root in the interval [0,1]
If I attempt Newton-Raphson on this root starting with
The iterative formula for this equation is
2 1 1 2
4
3
2
1
1
2
3
4
x
y
y=4x2x1
Alexander White
13
Showing this for
gives
()
()
()
()
= Error
This shows that it will fail as it means dividing by 0, and because this fails for
it means
will not
be found as there is no value to put into the iterative formula.
This shows that the tangent will never intersect the axis meaning that the Newton-Raphson
method will fail as a value for
Alexander White
14
Rearrangement method
The rearrangement method is another example of a fixed point iteration method, this works by
taking an equation () and then rearranging it into the form (), and then any value of
for which () will be a root of the original equation () .
The equation I will be solving using the rearrangement method is
to 5 decimal
Places.
Graph of ()
From the graph I can see that the roots lie in the intervals [-3,-2], [0, 1] and [1, 2]
Now I will rearrange () into the form () making the subject of my formula.
()
This means that the iterative formula for my equation is.
Now that I have this I will now plot and
.
3 2 1 1 2 3
3
2
1
1
2
3
4
5
x
y
y=x4x+1
Alexander White
15
This graph shows that the points of intersection of and
()
= 0.5
()
=0.28125
I will now continue these calculations using Autograph.
3 2 1 1 2 3
3
2
1
1
2
3
x
y
y=x
y=(x+1)/4
Alexander White
16
From these calculations I can see that the root in the interval [0, 1] is to 5 decimal
places.
( ) () -1.2605
x10
-5
() 2.9558
x10
-5
Since there is a change of sign is a root of
This is a graph showing how the root was found using the rearrangement method; the staircase
diagram shows that at
)) to the point on
where (
to find
satisfies the
condition
()
I can see this from looking at the original graph of
is
less steep than which has a gradient of 1.
0.2 0.4 0.6 0.8 1 1.2 1.4
0.2
0.4
0.6
0.8
1
1.2
1.4
x
y
y=x
y=(x+1)/4
X1
X2
X3
Alexander White
17
Failures of the Rearrangement method
Like all numerical methods there are some situations where this method will fail to find the root,
usually one rearrangement of () will not find all the roots
The graph shows me trying to find the root in the interval [1,2] using the rearrangement
at the point
This then gives me a new iterative formula of
This show and
plotted on the same graph and that the value for () at the
point
()
= 0.3644
Now that I know that this satisfies the condition I can find the root, I will do the calculations using
Autograph.
3 2 1 1 2 3
3
2
1
1
2
3
x
y
y=x
y=(4x1)^(1/3)
Root
Alexander White
19
This shows that the root is to 5 decimal places.
( ) () 5.8429
x10
-5
() -5.4495
x10
-6
Since there is a change of sign is a root.
Alexander White
20
Comparison of methods.
After successfully finding roots of equations using the 3 methods I will now compare them, to do this
I need to find the same root of an equation using all of the methods to the same accuracy to give a
fair comparison.
I will be using the equation
I will take
This shows that the root is to 5 decimal places.
2 1 1 2 3 4 5 6
20
15
10
5
x
y
y=x5x+2
Alexander White
21
( ) () -3.1467
x10
-5
() 2.2718
x10
-5
Since there is a change of sign is a root.
Rearrangement
I will rearrange () into the form
Graph showing and
on the same axis and the root as the point where they
intersect
This shows that the root is to 5 decimal places.
2 1 1 2
1
0.5
0.5
1
x
y
y=x
y=((x+2)/5)
Root
Alexander White
22
( ) () -3.1467
x10
-5
() 2.2718
x10
-5
Since there is a change of sign is a root.
Now that I have found the root using all 3 methods I can compare them.
Speed of convergence
To find the root using each method required a number of calculations.
Decimal Search required 62 calculations.
Newton-Raphson required 4 calculations.
Rearrangement required 9 calculations.
From this it is clear that decimal search took the most calculations to find the root, 58 more than
Newton-Raphson and 53 more than rearrangement, making this the method with the slowest speed
of convergence. Rearrangement was the 2
nd
fastest method requiring 5 more calculations than
Newton-Raphson but 53 less than decimal search. Newton-Raphson was the fastest method for
acquiring the roots only requiring 4 calculations to find the root to the same degree of accuracy as
the other methods looked at.
Method Difficulty.
All of the methods used could be done with a calculator and paper or using computer programs to
achieve the same results.
Decimal Search
With decimal search the first step with either equipment would be to find the interval that the root
lies in, using a calculator this would require setting up a table of integer values and looking for a
change or multiple changes of sign depending on how many roots the equation has. Whereas with a
program such as Autograph the graph will be drawn for you providing you with the intervals that the
root or roots lie in.
Once the intervals have been found increments will then be taken to find a smaller interval once
again looking for a change of sign. Using a calculator this would once again require a table of values
going up the interval in increments looking for another change of sign, this would require the input
of the equation and the increments into the calculator. With a computer a program could be used
such as Microsoft Excel or auto graph, this will also require the input of the equation and the
increments, using a program like excel could be difficult if not familiar and due to the way equations
are inputted could cause problems with the table of values.
Once a new interval has been found the process will be repeated once again using a table function
on a calculator or on a computer program, for each the only thing needed to change is the
increments as it requires the same equation. Now this will be repeated a number of times until the
Alexander White
23
root is found, this will require the same number of steps regardless of which equipment is being
used.
Newton Raphson
This will require the finding of the intervals to be done in the same way a decimal search first, either
by a table of values or a program like Autograph.
Once this is done an iterative formula is needed, a program like Autograph will do this automatically.
However if done using a calculator the function requires differentiation which must be done by
hand. If done by hand then each new estimate must be calculated individually; however the answer
button can be used to speed this up if
for Newton-Raphson
Using and
SHOULD TAKE UP TO
with both