« previous | Tuesday, January 28, 2014 | next »
Best Floating Point Adding Algorithm
- sort collection of numbers
- arrange in "baskets" of size for . (e.g. 1/32, 1/16, 1/8, 1/4, 1/2, 1, 2, 4, 8, 16, 32)
- starting with smallest basket, remove 2 numbers and insert their sum into the next basket
- repeat (3) until only one number remains in the largest basket
Roundoff error will be minimized.
Polynomial Interpolation
Given for , we want to approximate with a simpler function .
Stuff to show:
- there exists only one polynomial
- find it
- find the error
Existence
Proof. [Omitted in the book, so we will not cover it here]
quod erat demonstrandum
The good news: every function can be approximated by a polynomial. Weierstrass proved the existence of such polynomials, but Bernstein actually found one.
Lagrange Interpolating Polynomial
For , given measurements , where , We want to find such that for , and .
Theorem 1. There exists a unique which satisfies the conditions above:
Proof. We take our initial conditions and construct a matrix equation :
There is only one unique solution if and only if .
Basis.
- Given one point , the determinant is just .
- Given two points , the determinant is since points are distinct.
- Given three points , the determinant is
Induction. In general,
To find , We construct a polynomial that is 0 at all points except when , in which case .
Therefore , or in short
quod erat demonstrandum
Example
|
0 |
1 |
2 |
3
|
|
4 |
1 |
7 |
28
|
.
Error Estimation