# MEI numerical Methods - Sample Essay

Consider the problem x + ktanx = 1, the value of x lies between 0 and ? /2 for different values of K, it is measured in radians. Normally a solution of a mathematical problem of this nature requires the root of an equation. If we attempt to find the root algebraically, we begin by rearranging the equation to give 0, hence the equation is x + ktanx – 1 = 0. Now lets assume the value of K is 1, we are left with x + tanx – 1 = 0. The only information we are provided is that the value of x is between 0 and ? /2. Since x appears twice in the equation, the problem cannot be solved algebraically.

In the sense that there are equations which cannot be integrated and require numerical methods to approximate the answer, eg the midpoint rule. In the same way there are equations which cannot be solved algebraically and require numerical methods to approximate the root. To solve this solution I shall attempt to use numerical methods. I will be using the method of bisection, fixed point iteration, secant method and false position method. All these methods require the use of an excel spreadsheet since all methods require iterations which will get closer and closer to the real answer (converge).

This is why the Newton raphson method isn’t being used as it requires differentiation which can be hard to use on computers. The other methods can be converted into formulas and inputted into excel which can easily perform multiple iterations, simply by dragging down the cells. Strategy: Method of bisection: An approximation of the root can be obtained by this method; in order to use the method of bisection the first thing which must be done is to find an interval estimate of the root.

In order to find a better interval, add the upper and lower bounds of the estimate and divide by 2 in order to obtain the middle value. Then test this value to see if it’s positive or negative, dependent on the result the interval then becomes smaller, hence the answer gets closer to the real answer (converges). This method can be used to solve this equation as we have been given the interval estimate, 0 < x < ? /2. Hence to obtain a better estimate we test, (0 + ? /2) / 2, which is ? /4. We now do f(? /4) in order to see if its negative or positive hence making the interval smaller.

If it’s positive we replace it with the upper bound. I will make a spreadsheet with a formula that satisfies this method and I will perform multiple iterations until my answer reaches 9 significant figures. A spreadsheet can be created for this method hence this method can be used to solve the equation. Fixed point iteration: An approximation of the root can be calculated via this method. An equation can have more than one root, in order to find both roots we have to rearrange the equation so it equals x and use fixed point iteration for both equations.

To use fix point iteration we do rearrange f(x) = 0, to G(x) = x. We then do G(x1), and so on; this is called a recurrence relation. By doing this, most of the time the sequence gets closer to the final answer thus it converges. For this piece of coursework, my equation can be rearranged into two forms. The first one is, x(n+1)=1-k*tan(n) , this can be described as G(x), it can also be arranged into x(n+1) =arctan(1-x(n))/k, the rearranged form can be described as H(x). In order to find the roots, I would use a sensible starting number, I will choose ?

/4 and carry out multiple iterations on H(x) and g(x) to see if there’s more than just one root. I will make a spreadsheet with formulas that satisfy both H(x) and g(x) and drag it down to 9 significant figures. A spreadsheet can be made so this method can once again be used to find the root/s of the equation between 0 and ? /2. Secant method: Earlier I claimed that using the Newton raphson method can’t be used because differentiation on computers doesn’t always work, instead we can approximate the derivative. This creates the secant method, this requires two approximations, x(0) and x(1). Secant method:

Evaluating this formula means, the first approximation x0 multiplied by the function of the second approximation x1, minus the function of the first approximation x0 multiplied by the second approximation x1. This is then divided by the function of the second approximation minus the function of the first approximation to give the third approximation. I can use this method because my x(0) is equal to ? /2, and x(1) is equal to 0; hence if we were to substitute these values into the formula described above we would have an approximation of the root closer to the real root X(3), then I would use x(2) and x(3).

The secant method always uses the two most recent approximations of the root. I will produce an answer to 9 significant figures by the use of excel; I should be able to produce a formula on excel for the secant method thus making this method suitable for this equation. False position method: The false position method is similar to the secant method in the sense that it uses a straight line to approximate the function of the area of interest. The difference between the two methods is that the secant method uses two approximations which are the most recent approximations of the root.

The false position method also uses two approximations; it uses the most recent approximation of the root and the most recent root which has the opposite sign of the most recent approximation of the root. False position method: Evaluating this formula, lets assume f(a) = -2 and f (b) = 10, lets assume C = 3, however the f(c) = -5, this means for the new equation would involve b and a would be replaced by c. This means for the false position method to work, the two approximations of the root used in the formula, their functions would have to be opposites.

Hence unlike the secant method, we would use the most recent approximation and the most recent opposite signed approximation’s function. Other than that we treat it the same way as the secant method. For my equation, x + ktanx – 1 =0, I will use a as 0, because f(a) = -1, I will use b as ? /4 because f(b) = positive, hence the false position method will work. However to carry out multiple iterations I will have to create a spreadsheet, which can be done for the false position method. So therefore it is a suitable method for the equation. Use of technology:

Use of software: I had two options in terms of what technology to use in order to solve this equation, it was either to use a calculator or excel. In the end I chose excel for multiple reasons which include: A calculator is only accurate to 8 D. P because of its display screen, however excel is accurate to 15 D. P. My calculation was done to 9 D. P. This is because I felt it 9D. P would be close to the real root and it would still be neat and easy to understand. Furthermore on excel all you need is the formula, once you’ve created this that’s all you need.

For example we can change the value of K and the formula would take this into account and would calculate the new root accordingly. While with a calculator we would have to start from scratch. Finally to carry out iterations on excel is extremely easy, all you have to do is drag the cell down in order to copy the formula over and excel will automatically convert the formula for the new cell. If I was to do this on a calculator, fixed point iteration would be fine as all you would have to do is continuously press the = as it is a recurrence relation.

However to use a calculator for the method of bisection, would be very tedious as you would have to manually input a different values every iteration, this would also increase the chance of a mistake. Finally in order to make sure my approximation is correct I also made use of software called autograph. This piece of software allowed me to generate a graph of the equation y=+ tanx – 1, I could then compare my approximation of the root which the one autograph provided.