06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

CHAPTER 5. APPROXIMATION THEORY 199<br />

which gives the (n +1)normal equations for the cont<strong>in</strong>uous least squares problem:<br />

n∑<br />

∫ b<br />

a j x j+k dx =<br />

j=0<br />

a<br />

∫ b<br />

a<br />

f(x)x k dx (5.11)<br />

for k =0, 1, ..., n. Note that the only unknowns <strong>in</strong> these equations are the a j ’s, hence this is<br />

a l<strong>in</strong>ear system of equations. It is <strong>in</strong>structive to compare these normal equations <strong>with</strong> those<br />

of the discrete least squares problem:<br />

(<br />

n∑ m<br />

)<br />

∑<br />

m∑<br />

a j = y i x k i .<br />

j=0<br />

i=1<br />

x k+j<br />

i<br />

Example 86. F<strong>in</strong>d the least squares polynomial approximation of degree 2 to f(x) =e x on<br />

(0, 2).<br />

Solution. The normal equations are:<br />

2∑<br />

∫ 2<br />

a j x j+k dx =<br />

j=0<br />

k =0, 1, 2. Here are the three equations:<br />

Comput<strong>in</strong>g the <strong>in</strong>tegrals we get<br />

0<br />

∫ 2<br />

0<br />

i=1<br />

e x x k dx<br />

∫ 2 ∫ 2 ∫ 2<br />

a 0 dx + a 1 xdx + a 2 x 2 dx =<br />

0<br />

0<br />

∫ 2 ∫ 2 ∫ 2<br />

a 0 xdx + a 1 x 2 dx + a 2 x 3 dx =<br />

0<br />

0<br />

∫ 2 ∫ 2 ∫ 2<br />

a 0 x 2 dx + a 1 x 3 dx + a 2 x 4 dx =<br />

0<br />

0<br />

0<br />

0<br />

0<br />

∫ 2<br />

0<br />

∫ 2<br />

0<br />

∫ 2<br />

0<br />

e x dx<br />

e x xdx<br />

e x x 2 dx<br />

2a 0 +2a 1 + 8 3 a 2 = e 2 − 1<br />

2a 0 + 8 3 a 1 +4a 2 = e 2 +1<br />

8<br />

3 a 0 +4a 1 + 32<br />

5 a 2 =2e 2 − 2<br />

whose solution is a 0 =3(−7+e 2 ) ≈ 1.17, a 1 = − 3 2 (−37+5e2 ) ≈ 0.08,a 2 = 15<br />

4 (−7+e2 ) ≈ 1.46.<br />

Then<br />

P 2 (x) =1.17+0.08x +1.46x 2 .<br />

The solution method we have discussed for the least squares problem by solv<strong>in</strong>g the

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

Saved successfully!

Ooh no, something went wrong!