- Level: AS and A Level
- Subject: Maths
- Word count: 4205
I am going to solve equations by using three different numerical methods in this coursework and compare the methods which are Bisection, Newton-Raphson, and Rearranging method.
Extracts from this document...
Introduction
Introduction-Solving equations by numerical methods
Numerical Methodsare used for solving equations which solutions are not possible to be solved by algebraic or analytical methods. Now I am going to solve equations by using three different numerical methods in this coursework and compare the methods which are Bisection, Newton-Raphson, and Rearranging method. The comparison is about their ease of use and speed of convergence. In this coursework, I will use some software which are Microsoft Excel (used for calculations) and Autograph 3.0 (used for drawing graphs) to help me complete the coursework.
Bisection method
Bisection Method is looking for a sign change of a continuous function. Actually, we couldn’t use some normal methods which are algebraic or analytical methods to solve some particular cases. I have chosen an equation y=2x³-3x²-8x+7 which is a non-trivial equation. By using the autograph, we can see the graph (Below) cross the x axis and there are three roots. Now take the root in the interval [-2,-1] and start by taking the mid-point of the interval,-1.5.
f(-1.5)=5.5,so f(-1.5)>0.Since f(-2)<0,the root is in[-2,-1.5].
Now take the mid-point of this second interval,-1.75.
f(-1.75)=1.09375,so f(-1.75)>0.Since f(-2)<0,the root is in[-2,-1.75].
And if we continue this method, than we can find out the root that I have shown on the graph.
I am going to combine the graph and the figure I have worked out in Excel. As the figures show blow:
A | B | f(a)<0 | f(b)>0 | (a+b)/2 | y=2x³-3x²-8x+7 |
-2 | -1 | -5 | 10 | -1.5 | 5.5 |
-2 | -1.5 | -5 | 5.5 | -1.75 | 1.09375 |
-2 | -1.75 | -5 | 1.09375 | -1.875 | -1.73047 |
-1.875 | -1.75 | -1.73046875 | 1.09375 | -1.8125 | -0.26416 |
-1.8125 | -1.75 | -0.264160156 | 1.09375 | -1.78125 | 0.428162 |
-1.8125 | -1.78125 | -0.264160156 | 0.428162 | -1.796875 | 0.085365 |
-1.8125 | -1.796875 | -0.264160156 | 0.085365 | -1.8046875 | -0.08855 |
-1.804688 | -1.796875 | -0.088553429 | 0.085365 | -1.80078125 | -0.00138 |
-1.800781 | -1.796875 | -0.001383424 | 0.085365 | -1.798828125 | 0.042044 |
-1.800781 | -1.798828125 | -0.001383424 | 0.042044 | -1.799804688 | 0.020343 |
-1.800781 | -1.799804688 | -0.001383424 | 0.020343 | -1.800292969 | 0.009483 |
-1.800781 | -1.800292969 | -0.001383424 | 0.009483 | -1.800537109 | 0.004051 |
-1.800781 | -1.800537109 | -0.001383424 | 0.004051 | -1.80065918 | 0.001334 |
-1.800781 | -1.80065918 | -0.001383424 | 0.001334 | -1.800720215 | -2.5E-05 |
-1.80072 | -1.80065918 | -2.47371E-05 | 0.001334 | -1.800689697 | 0.000655 |
-1.80072 | -1.800689697 | -2.47371E-05 | 0.000655 | -1.800704956 | 0.000315 |
-1.80072 | -1.800704956 | -2.47371E-05 | 0.000315 | -1.800712585 | 0.000145 |
-1.80072 | -1.800712585 | -2.47371E-05 | 0.000145 | -1.8007164 | 6.02E-05 |
-1.80072 | -1.8007164 | -2.47371E-05 | 6.02E-05 | -1.800718307 | 1.77E-05 |
-1.80072 | -1.800718307 | -2.47371E-05 | 1.77E-05 | -1.800719261 | -3.5E-06 |
-1.800719 | -1.800718307 | -3.5084E-06 | 1.77E-05 | -1.800718784 | 7.11E-06 |
In this spreadsheet, a and b are the two values of intervals. (a+b)/2 is the mid-point.
By using the Excel, we can easily find the x value in the many terms satisfy my required degree of accuracy which is answer to 4 decimal places.
Root is -1.8007 to 4d.p
Error bounds is -1.8007±0.00005
Root bounds is -1.80075<x<-1.80065
Check X Y
-1.80075 -0.000688(negative)
-1.80065 0.001538(positive)
Therefore, my answer is correct and it lies between this interval.
Below shows the formulae for using in the Excel:
A | B | f(a)<0 | f(b)>0 | (a+b)/2 | y=2x³-3x²-8x+7 |
-2 | -1 | =2*B4^3-3*B4^2-8*B4+7 | =2*C4^3-3*C4^2-8*C4+7 | =(B4+C4)/2 | =2*F4^3-3*F4^2-8*F4+7 |
=IF(G4>0,B4,F4) | =IF(G4>0,F4,C4) | =2*B4^3-3*B4^2-8*B4+8 | =2*C4^3-3*C4^2-8*C4+8 | =(B4+C4)/3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/12 | =2*F4^3-3*F4^2-8*F4+17 |
=IF(G4>0,B4,F14) | =IF(G4>0,F4,C14) | =2*B4^3-3*B4^2-8*B4+18 | =2*C4^3-3*C4^2-8*C4+18 | =(B4+C4)/13 | =2*F4^3-3*F4^2-8*F4+18 |
=IF(G4>0,B4,F15) | =IF(G4>0,F4,C15) | =2*B4^3-3*B4^2-8*B4+19 | =2*C4^3-3*C4^2-8*C4+19 | =(B4+C4)/14 | =2*F4^3-3*F4^2-8*F4+19 |
=IF(G4>0,B4,F16) | =IF(G4>0,F4,C16) | =2*B4^3-3*B4^2-8*B4+20 | =2*C4^3-3*C4^2-8*C4+20 | =(B4+C4)/15 | =2*F4^3-3*F4^2-8*F4+20 |
=IF(G4>0,B4,F17) | =IF(G4>0,F4,C17) | =2*B4^3-3*B4^2-8*B4+21 | =2*C4^3-3*C4^2-8*C4+21 | =(B4+C4)/16 | =2*F4^3-3*F4^2-8*F4+21 |
=IF(G4>0,B4,F18) | =IF(G4>0,F4,C18) | =2*B4^3-3*B4^2-8*B4+22 | =2*C4^3-3*C4^2-8*C4+22 | =(B4+C4)/17 | =2*F4^3-3*F4^2-8*F4+22 |
=IF(G4>0,B4,F19) | =IF(G4>0,F4,C19) | =2*B4^3-3*B4^2-8*B4+23 | =2*C4^3-3*C4^2-8*C4+23 | =(B4+C4)/18 | =2*F4^3-3*F4^2-8*F4+23 |
=IF(G4>0,B4,F20) | =IF(G4>0,F4,C20) | =2*B4^3-3*B4^2-8*B4+24 | =2*C4^3-3*C4^2-8*C4+24 | =(B4+C4)/19 | =2*F4^3-3*F4^2-8*F4+24 |
=IF(G4>0,B4,F21) | =IF(G4>0,F4,C21) | =2*B4^3-3*B4^2-8*B4+25 | =2*C4^3-3*C4^2-8*C4+25 | =(B4+C4)/20 | =2*F4^3-3*F4^2-8*F4+25 |
=IF(G4>0,B4,F22) | =IF(G4>0,F4,C22) | =2*B4^3-3*B4^2-8*B4+26 | =2*C4^3-3*C4^2-8*C4+26 | =(B4+C4)/21 | =2*F4^3-3*F4^2-8*F4+26 |
=IF(G4>0,B4,F23) | =IF(G4>0,F4,C23) | =2*B4^3-3*B4^2-8*B4+27 | =2*C4^3-3*C4^2-8*C4+27 | =(B4+C4)/22 | =2*F4^3-3*F4^2-8*F4+27 |
Middle
-3.41573E-05
1.269745
1.269775
-3.41573E-05
4.17701E-05
1.26976
3.80883E-06
1.269745
1.26976
-3.41573E-05
3.80883E-06
1.269753
-1.51736E-05
1.269753
1.26976
-1.51736E-05
3.80883E-06
1.269756
-5.68226E-06
1.269756
1.26976
-5.68226E-06
3.80883E-06
1.269758
-9.36675E-07
1.269758
1.26976
-9.36675E-07
3.80883E-06
1.269759
1.43609E-06
This is a bisection failure. As the graph shows, we can't solve the other roots. We can only find one root, so the failure exists.
Newton-Raphson Method:
First of all, I am trying to estimate the root, and I start to work with tangents to find a more accurate estimation. We have to continue this method until the root is found to more than 5 decimal places. To be safe, it is necessary to evaluate f(x) at both these points and show that one value is positive and the other is negative (sign change).
The equation f(x) =0 is solved using the iteration:
I have chosen an equation y=4x³-x²-12x+2 which is a non-trivial equation and I am going to use Newton-Raphson method to solve it. By using the Autograph, see blow:
We can see the roots are in the intervals [-2,-1], [0, 1] and [1, 2].
I am going to show one root graphically which lies between [-2,-1]. Afterwards, I will combine my equation with
Now I am using the Excel to help me solve it accurately.
Xr | f(Xr) | f'(Xr) | X(r+1) |
-5 | -463 | 298 | -3.446308725 |
-3.446308725 | -132.249178 | 137.4171434 | -2.483916588 |
-2.483916588 | -35.6643303 | 67.00593259 | -1.95166028 |
-1.95166028 | -8.12437758 | 37.61105474 | -1.735649917 |
-1.735649917 | -1.09912868 | 27.62106745 | -1.695856789 |
-1.695856789 | -0.03431212 | 25.90287655 | -1.694532143 |
-1.69453214 | -3.745E-05 | 25.8463345 | -1.69453069 |
-1.694530694 | -4.48E-11 | 25.84627268 | -1.694530694 |
-1.694530694 | 3.55271E-15 | 25.84627268 | -1.694530694 |
-1.694530694 | -7.1054E-15 | 25.84627268 | -1.694530694 |
-1.694530694 | 3.55271E-15 | 25.84627268 | -1.694530694 |
In this spreadsheet, Xr = estimated value Xr.f'(Xr) =the value after differentiated f (Xr)
By using the Excel, we can easily find the x value in the many terms satisfy my required degree of accuracy which is answer to 7 decimal places.
Root is -1.694532 to 6d.p.
Error bounds is -1.69453±0.000005.
Root bounds is -1.694535<x<-1.694525.
Check X Y
-1.694535-0.00011128 (negative)
-1.6945250.000147178 (positive)
Therefore, my answer is correct and it is in the bounds.
Below shows the formulae for using in the Excel:
Xr | f(Xr) | f'(Xr) | X(r+1) |
-5 | =4*B4^3-B4^2-12*B4+2 | =12*B4^2-2*B4-12 | =B4-C4/D4 |
=E4 | =4*B4^3-B4^2-12*B4+3 | =12*B4^2-2*B4-13 | =B4-C4/D5 |
=E5 | =4*B4^3-B4^2-12*B4+4 | =12*B4^2-2*B4-14 | =B4-C4/D6 |
=E6 | =4*B4^3-B4^2-12*B4+5 | =12*B4^2-2*B4-15 | =B4-C4/D7 |
=E7 | =4*B4^3-B4^2-12*B4+6 | =12*B4^2-2*B4-16 | =B4-C4/D8 |
=E8 | =4*B4^3-B4^2-12*B4+7 | =12*B4^2-2*B4-17 | =B4-C4/D9 |
=E9 | =4*B4^3-B4^2-12*B4+8 | =12*B4^2-2*B4-18 | =B4-C4/D10 |
=E10 | =4*B4^3-B4^2-12*B4+9 | =12*B4^2-2*B4-19 | =B4-C4/D11 |
=E11 | =4*B4^3-B4^2-12*B4+10 | =12*B4^2-2*B4-20 | =B4-C4/D12 |
=E12 | =4*B4^3-B4^2-12*B4+11 | =12*B4^2-2*B4-21 | =B4-C4/D13 |
=E13 | =4*B4^3-B4^2-12*B4+12 | =12*B4^2-2*B4-22 | =B4-C4/D14 |
By using the Excel, I can find the other two roots of the equation y=4x³-x²-12x+2.
Xr | f(Xr) | f'(Xr) | X(r+1) |
0 | 2 | -12 | 0.166666667 |
0.166666667 | -0.00925926 | -12 | 0.165895062 |
0.165895062 | 5.9354E-07 | -12.001536 | 0.165895111 |
0.165895111 | 2.44249E-15 | -12.001536 | 0.165895111 |
0.165895111 | 0 | -12.001536 | 0.165895111 |
0.165895111 | 0 | -12.001536 | 0.165895111 |
0.165895111 | 0 | -12.001536 | 0.165895111 |
This root is in interval [0, 1]
Root is 0.1658951 to 7d.p.
Error bounds are 0.1658951±0.00000005.
Root bounds is 0.16589505<x<0.16589515.
Check X Y
0.165895057.34295E-07(positive)
0.16589515-4.6586E-07 (negative)
Xr | f(Xr) | f'(Xr) | X(r+1) |
4 | 194 | 172 | 2.872093023 |
2.872093023 | 54.05260858 | 81.24283396 | 2.206771469 |
2.206771469 | 13.63540073 | 42.02454085 | 1.882308656 |
1.882308656 | 2.545935114 | 26.75241321 | 1.787142097 |
1.787142097 | 0.192065226 | 22.75223831 | 1.7787005 |
1.7787005 | 0.001454566 | 22.40790463 | 1.778635587 |
1.778635587 | 8.5724E-08 | 22.4052634 | 1.778635583 |
1.778635583 | 0 | 22.40526329 | 1.778635583 |
1.778635583 | 0 | 22.40526329 | 1.778635583 |
1.778635583 | 0 | 22.40526329 | 1.778635583 |
This root is in interval [1, 2]
Root is 1.7786356 to 7d.p
Error bounds are 1.7786356±0.00000005.
Root bounds is 1.77863555<x<1.77863565.
Check X Y
1.778635651.4965E-06 (positive)
1.77863555-7.4402E-07 (negative)
Therefore, the roots of this equation are -1.694532 to 6d.p, 0.1658951 to 7d.p and 1.7786356 to 7d.p
Newton-Raphson failure:
I am going to show the failure of Newton-Raphson method. I have chosen a non-trivial equation
y=12x³-7x²-4x-0.2. And the graph shows:
Xr | f(Xr) | f'(Xr) | X(r+1) |
0.5 | -2.45 | -2 | -0.725 |
-0.725 | -5.5523125 | 25.0725 | -0.503549706 |
-0.503549706 | -1.49291202 | 12.17793891 | -0.380958188 |
-0.380958188 | -0.35552885 | 6.5580637 | -0.326745715 |
-0.326745715 | -0.05896778 | 4.417899459 | -0.313398246 |
-0.313398246 | -0.00331416 | 3.923440018 | -0.312553538 |
-0.312553538 | -1.3038E-05 | 3.892579256 | -0.312550189 |
-0.31255019 | -2.048E-10 | 3.89245699 | -0.31255019 |
-0.312550189 | 0 | 3.892456989 | -0.312550189 |
-0.312550189 | 0 | 3.892456989 | -0.312550189 |
-0.312550189 | 0 | 3.892456989 | -0.312550189 |
-0.312550189 | 0 | 3.892456989 | -0.312550189 |
Root is -0.3125502 to 7d.p
Error bounds is -0.3125502±0.00000005
Root bounds is -0.31255025<x<-0.31255015
Check X Y
-0.31255025-2.3749E-07(negative)
-0.312550151.51756E-07(positive)
As the graph shows, it occurs failure. 0.5 is chosen for Xr and it is near the turning point .By using the Newton Raphson Method, I can't get the point I want, but the further one. Therefore, it is failure.
Rearranging equation method:
This method is rearranging the equation f(x) =0 into form x=g(x).Thus y=x and y=g(x) can cross together, and then we can get a single value which can be estimated for the root.
I have chosen an equation y=2x³-3x²-5x-2 which is a non-trivial equation. By using the Autograph, the graph has been shown blow:
The equation y=2x³-3x²-5x-2 can be rearranged to different forms. But it could exist the failure, therefore I have to try. When 0=2x³-3x²-5x-2 rearranged to 5x=2x³-3x²-2, and we can gain y=x and g(x) = (2x³-3x²-2)/5.
And using the Autograph to draw the y=x and y=g(x). See blow:
I am going to combine the graph and the figure I have worked out in Excel. As the figures show blow:
x | x=(2x³+3x²–2)/5 | n | g'(x) |
0 | -0.4 | 0 | 0 |
-0.4 | -0.3296 | 1 | -0.288 |
-0.3296 | -0.349140895 | 2 | -0.26516 |
-0.3491409 | -0.343884402 | 3 | -0.27269 |
-0.3438844 | -0.345312735 | 4 | -0.27075 |
-0.34531273 | -0.344925628 | 5 | -0.27129 |
-0.34492563 | -0.345030617 | 6 | -0.27114 |
-0.34503062 | -0.345002148 | 7 | -0.27118 |
-0.34500215 | -0.345009868 | 8 | -0.27117 |
-0.34500987 | -0.345007774 | 9 | -0.27117 |
-0.34500777 | -0.345008342 | 10 | -0.27117 |
-0.34500834 | -0.345008188 | 11 | -0.27117 |
-0.34500819 | -0.34500823 | 12 | -0.27117 |
-0.34500823 | -0.345008218 | 13 | -0.27117 |
-0.34500822 | -0.345008221 | 14 | -0.27117 |
-0.34500822 | -0.345008221 | 15 | -0.27117 |
Conclusion
-0.34501
4E-06
-0.34500885
-0.345001221
4E-06
-4.4E-05
-0.34501
-2E-05
Root is -0.34501 to 5d.p
Error bounds is -0.34501±0.000005
Root bounds is -0.345015<x<-0.345005
Check X Y
-0.345015 4.3088E-05 (positive)
-0.345005 -2.04707E-05 (negative)
Newton-Raphson methods
Xr | f(Xr) | f'(Xr) | X(r+1) |
-1 | 4 | -5 | -0.2 |
-0.2 | -0.896 | -5.96 | -0.35034 |
-0.35034 | 0.033886 | -6.3656 | -0.34501 |
-0.34501 | 2.57E-05 | -6.35587 | -0.34501 |
-0.34501 | 1.53E-11 | -6.35587 | -0.34501 |
-0.34501 | 0 | -6.35587 | -0.34501 |
-0.34501 | 0 | -6.35587 | -0.34501 |
Root is -0.34501 to 5d.p
Error bounds is-0.34501±0.000005
Root bounds is -0.345015<x<-0.345005
Check X Y
-0.3450154.3088E-05 (positive)
-0.345005-2E-05 (negative)
Rearranging equation methods
x | x=(2x³+3x²–2)/5 | n | g'(x) |
0 | -0.4 | 0 | 0 |
-0.4 | -0.3296 | 1 | -0.288 |
-0.3296 | -0.349140895 | 2 | -0.26516 |
-0.3491409 | -0.343884402 | 3 | -0.27269 |
-0.3438844 | -0.345312735 | 4 | -0.27075 |
-0.34531273 | -0.344925628 | 5 | -0.27129 |
-0.34492563 | -0.345030617 | 6 | -0.27114 |
-0.34503062 | -0.345002148 | 7 | -0.27118 |
-0.34500215 | -0.345009868 | 8 | -0.27117 |
-0.34500987 | -0.345007774 | 9 | -0.27117 |
-0.34500777 | -0.345008342 | 10 | -0.27117 |
-0.34500834 | -0.345008188 | 11 | -0.27117 |
-0.34500819 | -0.34500823 | 12 | -0.27117 |
-0.34500823 | -0.345008218 | 13 | -0.27117 |
-0.34500822 | -0.345008221 | 14 | -0.27117 |
-0.34500822 | -0.345008221 | 15 | -0.27117 |
Root is -0.3450082 to 7d.p.
Error bounds is -0.3450082±0.00000005.
Root bounds is -0.34500825<x<-0.34500815.
Check X Y
-0.34500825-0.345008213
-0.34500815-0.34500824
X g'(x)
-0.34500825 -0.271173069
-0.34500815 -0.271173032
After I used each method to solve the same equation, I found that difference in the speed of convergence.
In bisection method, I have to use 18 iterations.
In Newton-Raphson method, I have to use 4 iterations.
In rearranging equation method, I have to use 15 iterations.
Now we can see the Newton-Raphson method is the fastest and the bisection method is the slowest.
All of the methods require using software, which is autograph and algebraic, spreadsheet to find out the root. And see blow there are two boxes:
Method | Algebraic | Spreadsheet | Ease of use |
Bisection method | No algebraic work | 6 formulas | Easy |
Newton-Raphson method | Work out the gradient | 4 formulas | Fair |
Rearranging equation method | Rearrangeto | 4 formulas | Fair |
Method | Advantages | Disadvantages |
Bisection method | Safe and accurate | Slow |
Has error bounds | Can’t find complex root | |
Newton-Raphson method | Require one guess only | Require differentiation |
Quick | Require calculator | |
Rearranging equation method | Easy to understand | Require rearranging equation |
In the whole project, using the Excel and Autograph is much more efficient and easier.
This student written piece of work is one of many that can be found in our AS and A Level Core & Pure Mathematics section.
Found what you're looking for?
- Start learning 29% faster today
- 150,000+ documents available
- Just £6.99 a month