OCR D1 2011 June — Question 2

Exam BoardOCR
ModuleD1 (Decision Mathematics 1)
Year2011
SessionJune
TopicFixed Point Iteration

2 Consider the following algorithm.
STEP 1 Input a number \(N\)
STEP 2 Calculate \(R = N \div 2\)
STEP 3 Calculate \(S = ( ( N \div R ) + R ) \div 2\)
STEP 4 If \(R\) and \(S\) are the same when rounded to 2 decimal places, go to STEP 7
STEP 5 Replace \(R\) with the value of \(S\)
STEP 6 Go to STEP 3
STEP 7 Output the value of \(R\) correct to 2 decimal places
  1. Work through the algorithm starting with \(N = 16\). Record the values of \(R\) and \(S\) each time they change and show the value of the output.
  2. Work through the algorithm starting with \(N = 2\). Record the values of \(R\) and \(S\) each time they change and show the value of the output.
  3. What does the algorithm achieve for positive inputs?
  4. Show that the algorithm fails when it is applied to \(N = - 4\).
  5. Describe what happens when the algorithm is applied to \(N = - 2\). Suggest how the algorithm could be improved to avoid this problem, without imposing a restriction on the allowable input values.