03.03.2014 Views

Numerical Methods Course Notes Version 0.1 (UCSD Math 174, Fall ...

Numerical Methods Course Notes Version 0.1 (UCSD Math 174, Fall ...

Numerical Methods Course Notes Version 0.1 (UCSD Math 174, Fall ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9.1. LEAST SQUARES 117<br />

The answer is not so enlightening as the means of finding the solution.<br />

We should, for a moment, consider whether this is indeed the solution. Our calculations have<br />

only shown an extrema at this choice of (a, b); could it not be a maxima?<br />

9.1.3 Least Squares from Basis Functions<br />

In many, but not all cases, the class of functions, F, is the span of a small set of functions. This<br />

case is simpler to explore and we consider it here. In this case F can be viewed as a vector space<br />

over the real numbers. That is, for f, g ∈ F, and α, β ∈ R, then αf + βg ∈ F, where the function<br />

αf is that function such that (αf)(x) = αf(x).<br />

Now let {g j (x)} m j=0<br />

be a set of m + 1 linearly independent functions, i.e.,<br />

c 0 g 0 (x) + c 1 g 1 (x) + . . . + c m g m (x) = 0 ∀x ⇒ c 0 = c 1 = . . . = c m = 0<br />

Then we say that F is spanned by the functions {g j (x)} m j=0 if<br />

⎧<br />

⎫<br />

⎨<br />

F =<br />

⎩ f(x) = ∑ ⎬<br />

c j g j (x) | c j ∈ R, j = 0, 1, . . . , m<br />

⎭ .<br />

j<br />

In this case the functions g j are basis functions for F. Note the basis functions need not be unique:<br />

a given class of functions will usually have more than one choice of basis functions.<br />

Example 9.1. The class F = {f(x) = ax + b | a, b ∈ R } is spanned by the two functions g 0 (x) = 1,<br />

and g 1 (x) = x. However, it is also spanned by the two functions ˜g 0 (x) = 2x + 1, and ˜g 1 (x) = x − 1.<br />

To find the least squares best approximant of F for a given set of data, we minimize the square<br />

of the l 2 norm of the error; that is we minimize the function<br />

⎡⎛<br />

⎞ ⎤2<br />

n∑<br />

φ (c 0 , c 1 , . . . , c m ) = ⎣ c j g j (x k ) ⎠ − y k<br />

⎦<br />

(9.1)<br />

k=0<br />

Again we set partials to zero and solve<br />

⎡⎛<br />

0 = ∂φ n∑<br />

= 2 ⎣⎝ ∑<br />

c i<br />

j<br />

This can be rearranged to get<br />

m∑<br />

If we now let<br />

j=0<br />

[ ∑<br />

k<br />

d ij =<br />

k=0<br />

g j (x k )g i (x k )<br />

⎝ ∑ j<br />

⎞ ⎤<br />

c j g j (x k ) ⎠ − y k<br />

⎦ g i (x k )<br />

]<br />

c j =<br />

n∑<br />

g j (x k )g i (x k ), e i =<br />

k=0<br />

n∑<br />

y k g i (x k )<br />

k=0<br />

n∑<br />

y k g i (x k ),<br />

Then we have reduced the problem to the linear system (again, called the normal equations):<br />

⎡<br />

⎤ ⎡ ⎤ ⎡ ⎤<br />

d 00 d 01 d 02 · · · d 0m c 0 e 0<br />

d 10 d 11 d 12 · · · d 1m<br />

c 1<br />

e 1<br />

d 20 d 21 d 22 · · · d 2m<br />

c 2<br />

=<br />

e 2<br />

(9.2)<br />

⎢<br />

⎣<br />

.<br />

. . . ..<br />

⎥ ⎢ ⎥ ⎢ ⎥<br />

. ⎦ ⎣ . ⎦ ⎣ . ⎦<br />

d m0 d m1 d m2 · · · d mm c m e m<br />

k=0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!