Example 6.  Find the "least squares parabola" that for the four data points  [Graphics:Images/LUFactorMod_gr_194.gif].  

Solution 6.

(a). Write down the linear system AC = B to be solved.

[Graphics:../Images/LUFactorMod_gr_195.gif]




[Graphics:../Images/LUFactorMod_gr_196.gif]

[Graphics:../Images/LUFactorMod_gr_197.gif]

(b). Solve the linear system for the coefficients [Graphics:../Images/LUFactorMod_gr_198.gif] using our  LUfactor[n]  and  SolveLU[n]  subroutines.

[Graphics:../Images/LUFactorMod_gr_199.gif]



[Graphics:../Images/LUFactorMod_gr_200.gif]

(c). Construct the polynomial  p[x].  The coefficients are stored in the array  c  and the elements are [Graphics:../Images/LUFactorMod_gr_201.gif].

[Graphics:../Images/LUFactorMod_gr_202.gif]



[Graphics:../Images/LUFactorMod_gr_203.gif]

Of course we could do all this work in two lines by using Mathematica's built in  [Graphics:../Images/LUFactorMod_gr_204.gif]  procedure.

[Graphics:../Images/LUFactorMod_gr_205.gif]


[Graphics:../Images/LUFactorMod_gr_206.gif]

We are done.

We can graph the polynomial, this is just for fun !

[Graphics:../Images/LUFactorMod_gr_207.gif]


[Graphics:../Images/LUFactorMod_gr_208.gif]

[Graphics:../Images/LUFactorMod_gr_209.gif]
[Graphics:../Images/LUFactorMod_gr_210.gif]
[Graphics:../Images/LUFactorMod_gr_211.gif]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004