2 This question concerns the following algorithm which operates on a given function, f. The algorithm finds a point between A and B at which the function has a minimum, with a maximum error of 0.05 .
| Step 1 | Input A |
| Step 2 | Input B , where \(\mathrm { B } > \mathrm { A }\) |
| Step 3 | Let \(\mathrm { R } = \mathrm { A } + \left( \frac { \sqrt { 5 } - 1 } { 2 } \right) \times ( \mathrm { B } - \mathrm { A } )\) |
| Step 4 | Let \(\mathrm { L } = \mathrm { A } + \mathrm { B } - \mathrm { R }\) |
| Step 5 | Find \(f ( \mathrm {~L} )\) and \(f ( \mathrm { R } )\) |
| Step 6 | If \(\mathrm { f } ( \mathrm { L } ) \leqslant \mathrm { f } ( \mathrm { R } )\) then let \(\mathrm { B } = \mathrm { R }\) and go to Step 8 |
| Step 7 | If \(\mathrm { f } ( \mathrm { L } ) > \mathrm { f } ( \mathrm { R } )\) then let \(\mathrm { A } = \mathrm { L }\) and go to Step 8 |
| Step 8 | If \(\mathrm { B } - \mathrm { A } < 0.1\) then go to step 10 |
| Step 9 | Go to step 3 |
| Step 10 | Print \(\frac { ( \mathrm { A } + \mathrm { B } ) } { 2 }\) and stop |
- Working correct to three decimal places, perform two iterations of the algorithm for \(\mathrm { f } ( x ) = 2 x ^ { 2 } - 15 x + 30\), when \(\mathrm { A } = 3\) and \(\mathrm { B } = 4\). Start at Step 1 and stop when you reach Step 8 for the second time.
- The \(\left( \frac { \sqrt { 5 } - 1 } { 2 } \right)\) factor in Step 3 ensures that either the new ' \(L\) ' is equal to the old ' \(R\) ', or vice versa. Why is this important?
- This algorithm is used when the function is not known explicitly, but where its value can be found for any given input. Give a practical example of where it might be used.