Date: July 29, 2019
As part of the course, we will be not only focussing on the computing part, but we will also be proving relevant theorems that are useful in the context of error estimates and convergence analysis.
However, before getting into the above let's pause for a moment and look at the following.
Consider the recurrence $a_{n+1} = 10a_n-9a_{n-1}$, with $a_0 = 2.95$ and $a_1 = 2.95$.
import numpy as np;
N = 20;
a = np.zeros(N+1);
a[0] = 2.95;
a[1] = 2.95;
for n in range(1,N):
a[n+1] = 10*a[n]-9*a[n-1];
display(a)
array([ 2.95 , 2.95 , 2.95 , 2.95 , 2.95 , 2.95 , 2.95 , 2.95 , 2.95 , 2.95 , 2.94999996, 2.94999966, 2.9499969 , 2.94997213, 2.94974915, 2.94774237, 2.92968133, 2.76713194, 1.30418746, -11.86231289, -130.36081598])
Let's see what happens if I were to change the initial data from $2.95$ to $2.9375$.
import numpy as np;
N = 50;
a = np.zeros(N+1);
a[0] = 2.9375;
a[1] = 2.9375;
for n in range(1,N):
a[n+1] = 10*a[n]-9*a[n-1];
display(a)
array([2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375, 2.9375])
Surprisingly, I seem to get the right answer even if I run the recurrence till $50$ terms. What is happening here?
To answer, the above questions, we first need to look at how numbers get stored on our machine. In mathematics, we have uncountably infinite real numbers. However, our computers are finite machines and hence only a finite set of numbers can be represented. We will look more at this in the next class.