# C3 COURSEWORK - comparing methods of solving functions

Extracts from this document...

Introduction

Change of signs

First of all, I would like to use change of signs method to find the roots of the function y=x³+3x²–3.

It is presented by the graph of y=f(x)

y= x³+3x²–3

By using the change of signs method, we can find out that there are 3 changes of signs in the range [-3, -2], [-2, -1] and [0, 1]

x³+3x²–3 | |

-3 | -3 Change of sign |

-2 | 1 |

-1 | -1 Change of sign |

0 | -3 Change of sign |

1 | 1 |

2 | 17 |

The first 2 calculations of x³+3x²–3:

The change of sign here tells us that there is a root in the interval [0, 1], where roots are not trivial. (f (x) not equal to zero)

Roots to f(x) =0

y= x³+3x²–3

x | x³+3x²–3 |

0 | -3 |

0.1 | -2.969 |

0.2 | -2.872 |

0.3 | -2.703 |

0.4 | -2.456 |

0.5 | -2.125 |

0.6 | -1.704 |

0.7 | -1.187 |

0.8 | -0.568 Change of sign |

0.9 | 0.159 |

1 | 1 |

The change of sign here tells us that there is a root in the interval [0.8, 0.9].

x | y=x³+3x²–3 |

0.8 | -0.568 |

0.81 | -0.50026 |

0.82 | -0.43143 |

0.83 | -0.36151 |

0.84 | -0.2905 |

0.85 | -0.21838 |

0.86 | -0.14514 |

0.87 | -0.0708 Change of sign |

0.88 | 0.004672 |

0.89 | 0.081269 |

0.9 | 0.159 |

The change of sign here tells us that there is a root in the interval [0.87, 0.88].

x | y=x³+3x²–3 |

0.87 | -0.0708 |

0.871 | -0.0633 |

0.872 | -0.05579 |

0.873 | -0.04827 |

0.874 | -0.04074 |

0.875 | -0.0332 |

0.876 | -0.02565 |

0.877 | -0.01809 |

0.878 | -0.01051 |

0.879 | -0.00293 Change of sign |

0.88 | 0.004672 |

The change of sign here tells us that there is a root in the interval [0.879, 0.880].

x | y=x³+3x²–3 |

0.879 | -0.00293 |

0.8791 | -0.00217 |

0.8792 | -0.00141 |

0.8793 | -0.00065 Change of sign |

0.8794 | 0.000112 |

0.8795 | 0.000872 |

0.8796 | 0.001632 |

0.8797 | 0.002392 |

0.8798 | 0.003152 |

0.8799 | 0.003912 |

0.88 | 0.004672 |

The change of sign here tells us that there is a root in the interval [0.8793, 0.8794].

x | y=x³+3x²–3 |

0.8793 | -0.00065 |

0.87931 | -0.00057 |

0.87932 | -0.0005 |

0.87933 | -0.00042 |

0.87934 | -0.00034 |

0.87935 | -0.00027 |

0.87936 | -0.00019 |

0.87937 | -0.00012 |

0.87938 | -4E-05 Change of sign |

0.87939 | 3.61E-05 |

0.8794 | 0.000112 |

Middle

4

-3.52734

-3.52688

5

-3.52688

-3.52688

6

-3.52688

-3.52688

We can see that root is near to -3.5269 to 5 sf

Using Newton Raphson and Autograph to find the root in the interval [-4,-3]:

We now are using the Newton Raphson and Autograph to find the other two roots.

I can see that the other roots lie within these intervals [-1, 0] and [0, 1]:

From the table below, I can find out that the root in the interval of [-1, 0] is near to 0-3.5269 of 5 significant figures.

n | xn | |

1 | -1.00000 | -0.30000 |

2 | -0.30000 | -0.20283 |

3 | -0.20283 | -0.19613 |

4 | -0.19613 | -0.19609 |

5 | -0.19609 | -0.19609 |

On the other hand, from the table below, I can find out that the root in the interval of [0, 1] is near to –0.19609 of 5 significant figures.

n | xn | |

1 | 1.00000 | 0.78571 |

2 | 0.78571 | 0.72753 |

3 | 0.72753 | 0.72300 |

4 | 0.72300 | 0.72297 |

5 | 0.72297 | 0.72297 |

6 | 0.72297 | 0.72297 |

Graphical Interpretation of the Newton Raphson method

Example: y=2x y=0.5x³+1.5x²–x–0.25

Graph of y=f(x)

I will first use the method to find the root at the interval [-3, -4]

y=0.5x³+1.5x²–x–0.25

X2

X3

X4

X1

At first, let’s start with a close approximation, let X1= -3, on the x-axis (shown on the graph above), draw a verticle line until it meet y=0.5x³+1.5x²–x–0.25.

When the line met the curve, a tangent is drawn and extended until it meets the x-axis and there is a new point on the x-axis, called X2, which is equal to -3.7858.

From X2, draw a vertical line until it meet the curve y=f(x). When the line met the curve, a tangent is drawn and extended until it meets the x-axis and it is a new point on the x-axis, called X3, which is equal to -3.5566.

From X3, draw a vertical line until it meet the curve y=f(x). When the line met the curve, a tangent is drawn and extended until it meets the x-axis and it is a new point on the x-axis, called X4, which is equal to -3.5273.

This procedure is repeated and the points generated on the x axis get nearer and nearer to the root.

At last, I can see that Newton Raphson converges to a value near to -3.5269.

Error Bounds

We need to use the change of sign method to trap the root between two solution bounds

I evaluate f(-3.52695) and f(-3.52685):

f(-3.52685)=-0.00051

f(-3.52695)=0.000193

This change of sign shows that the root must be between these two values. Therefore,

I can state that the error bounds are -3.52695 and -3.52685

I can also write the solution bounds as the error bounds-3.5269±0.00005

I can see that all values in the range (-3.52685, -3.52695) round to -3.5269. Therefore, I can say that the root is -3.5269to 5 sig.figs.

Failure Case

Example: y= (0.5x³+1.5x²–x–0.25)1/3

Reason cause to failure is that the graph crosses the x axis with a very steep gradient

Graph is y=f(x)

The steep crossing points were caused by the power 1/3

On the graph, the Newton Raphson method will fail to reach a root

y= (0.5x³+1.5x²–x–0.25)1/3

X3

X2

X1

Newton Raphson method does not work everytime. Newton Raphson method will fail when I consider operating the process on the function f(x) = x1/3, start with the initial value x=-3.

As you can see, from the start point of -3, the values of Xn become further and further away from the root between -3.52695 and -3.52685. This is because of the steep gradient where the graph crosses the x-axis, meaning that the resulting tangent is directed further away from the root.

x=g(x) method

y=0.8x³+2x²–x–1

I am now using the example y=0.8x³+2x²–x–1 to illustrate the method of x=g(x).

Graph of y=f(x) function

Now, rearrangement of the equation f(x) =0 to the form x = g(x)

I have got the function y=0.8x³+2x²–x–1,

Therefore, 0.8x³+2x²–x–1= 0

0.8x³= -2x²+x+1

At last, I can see that

Use the example 0.8x³+2x²–x–1= 0 and find the root in the interval [-3, -2], let X1 = -3,

By using x=g(x), I can find the root in the interval [-3,-2]

X | |

-3 | -2.924017738 |

-2.924017738 | -2.875647098 |

-2.875647098 | -2.844605553 |

-2.844605553 | -2.824579887 |

-2.824579887 | -2.811616438 |

-2.811616438 | -2.803205853 |

-2.803205853 | -2.797741161 |

-2.797741161 | -2.794187153 |

-2.794187153 | -2.79187434 |

-2.79187434 | -2.790368641 |

-2.790368641 | -2.789388135 |

-2.789388135 | -2.788749524 |

-2.788749524 | -2.788333544 |

-2.788333544 | -2.788062564 |

-2.788062564 | -2.787886031 |

-2.787886031 | -2.787771023 |

-2.787771023 | -2.787696097 |

-2.787696097 | -2.787647282 |

-2.787647282 | -2.787615479 |

-2.787615479 | -2.787594759 |

-2.787594759 | -2.787581259 |

-2.787581259 | -2.787572464 |

-2.787572464 | -2.787566734 |

-2.787566734 | -2.787563001 |

-2.787563001 | -2.787560569 |

-2.787560569 | -2.787558984 |

-2.787558984 | -2.787557952 |

-2.787557952 | -2.787557279 |

-2.787557279 | -2.787556841 |

-2.787556841 | -2.787556555 |

-2.787556555 | -2.787556369 |

-2.787556369 | -2.787556248 |

-2.787556248 | -2.787556169 |

-2.787556169 | -2.787556118 |

-2.787556118 | -2.787556084 |

From the table above, I can see that root is near to -2.7876 to 5 sf

Illustrating the convergence using x = g(x) by using Autograph.

y= x

X1

X2

X3

X4

X5

y=

First of all, we can see that the root is near -1, so start at a point x1 , which is -1, on the x axis line and draw a line vertically downwards to meet the curve y=f(x).

When the line meets the curve y= f(x), a horizontal line is drawn to meet the line y= x.

The x co-ordinate of this new point becomes x2

From x2, we draw a line vertically downwards until it meet the curve y= f(x) again. And a horizontal line is drawn and meet the straight line y=x.

The x co-ordinate of this new point becomes x3

These steps will repeat and new points are generated nearer and nearer to the point of interception of y=x and y=g(x) which is the root of equation of f(x) =0

Examining g’(x) graphically

y=x so gradient 1

We can see 0<g’(x)<1

Root to f(x) =0

Since 0<g’(x)< 1 we expect to get staircase convergence and it is a success staircase and the result is the same as the expectations.

A rearrangement of the same equation is applied in a situation where the iteration fails to converge to the required root

Roots are given by 0.8x³+2x²–x–1= 0,

Then, make a new rearrangement of the function f(x)= 0 to the form x = g(x)

0.8x³+2x²–x–1= 0

Then x= 0.8x³+2x²–1

xn+1= 0.8xn3+2 xn2-1

To find root in the interval [0, -1]

Let X1=0,

n | x | 0.8xn3+2 xn2-1 |

1 | 0 | -1 |

2 | -1 | 0.2 |

3 | 0.2 | -0.9136 |

4 | -0.9136 | 0.05929 |

5 | 0.05929 | -0.9928 |

6 | -0.9928 | 0.188464 |

7 | 0.188464 | -0.92361 |

Conclusion

Nevertheless, if we cannot see there is going to be a clear change of signs, Newton Raphson method would probably the quickest method among three of them, though it may be a bit complicated.

If you also have Excel

All these methods can be carrying out simply by using the spreadsheet such as Excel. But among the three methods, I think change of signs method should be chosen as the easiest and quickest one. There isn’t any iteration and rearrangement involved in the formulae and it is very easy to enter all the information into Excel.

Whereas we need to rearrange the formulae for Newton Raphson method and x=g(x) method, which we may enter the wrong figure into Excel by mistake and it is really complicated.

If you also have Autograph

Obviously, we can find the roots in no time by using Autograph. For change of signs method, we simply draw a graph by using Autograph and find the roots when f(x) = 0. It’s very easy for us to use autograph and it just involves one step. After finding the roots, we can leave Autograph and use Excel to proof the rest of the change of signs method.

For other two methods, we need to do more steps. For example, we need to set up another equation y=x in x=g(x) so that we can continue to do the rest of the x=g(x) method.

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