MTH3051 Introduction to Computational Mathematics - User Web ...
MTH3051 Introduction to Computational Mathematics - User Web ...
MTH3051 Introduction to Computational Mathematics - User Web ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
School of Mathematical Sciences<br />
Monash University<br />
no reason <strong>to</strong> trust the answers from a 4-digit computer. This is better seen in the third<br />
table which lists the relative errors. Here you can see that the 2 and 4 digit computers<br />
yield answers that are 100% in error – they produce junk!<br />
The first big question is What causes this problem? When λ ≪ 1, the numbers 1 and<br />
√<br />
1 − 4λ are almost equal. Thus when we compute their difference we introduce a large<br />
relative error.<br />
The second big question is Can we cure this problem? In this case, yes, we have at least<br />
two options, both of which entail a re-working of the mathematics prior <strong>to</strong> handing<br />
control over <strong>to</strong> the computer. That is we search for different algorithms <strong>to</strong> compute x<br />
in the case where λ ≪ 1.<br />
Option 1. Here we do some simple algebra<br />
x =<br />
=<br />
1 − (1 − 4λ)(1/2)<br />
2<br />
2λ<br />
1 + (1 − 4λ) (1/2)<br />
=<br />
1 − (1 − 4λ)(1/2)<br />
2<br />
(<br />
)<br />
1 + (1 − 4λ) (1/2)<br />
1 + (1 − 4λ) (1/2)<br />
We see that when λ ≪ 1 we do not have any problem with cancellation between nearly<br />
equal numbers (i.e no loss of precision).<br />
Relative errors for Option 1<br />
λ Exact 2-digits 4-digits 6-digits 8-digits<br />
1.00e-01 1.1270e-01 2.3972e-02 1.4777e-05 2.9691e-06 4.7730e-08<br />
1.00e-02 1.0102e-02 1.0102e-02 2.0307e-04 5.0924e-06 4.3889e-08<br />
1.00e-03 1.0010e-03 1.0010e-03 2.0030e-06 2.0030e-06 5.0090e-09<br />
1.00e-04 1.0001e-04 1.0001e-04 1.0001e-04 2.0003e-08 2.0003e-08<br />
Option 2. This time we use a Taylor series. For λ ≪ 1 we can expnad √ 1 − 4λ as<br />
1 − 2λ + O (λ 2 ). Thus we find, for λ ≪ 1,<br />
x = λ + O ( λ 2)<br />
Relative errors for Option 2<br />
λ Exact 2-digits 4-digits 6-digits 8-digits<br />
1.00e-01 1.1270e-01 1.1270e-01 1.1270e-01 1.1270e-01 1.1270e-01<br />
1.00e-02 1.0102e-02 1.0102e-02 1.0102e-02 1.0102e-02 1.0102e-02<br />
1.00e-03 1.0010e-03 1.0010e-03 1.0010e-03 1.0010e-03 1.0010e-03<br />
1.00e-04 1.0001e-04 1.0001e-04 1.0001e-04 1.0001e-04 1.0001e-04<br />
16-Feb-2014 36