Monday, August 14, 2023

Solution to Numerical Analysis (Part 6) Problem:

 Fit a second degree polynomial  to the ordered pairs in the table below:


Hence, find a, b and c for the polynomial: axi 2 +  bxi    c 

Solution:

 We use functional form and choose a, b, c to minimize the functional, so that:

F(a,b,c) =  å 4 =1  (axi  2 +  bxi    c   -  yi 2 

This can be done by solving the linear system of equations:

  f/a = 0,        f/b = 0,    f/c = 0

Compute using functionals below by inserting respective values for  (xi,  yi) from the table:

Start with:

f/a =  2 (axi  2 +  bxi    c   -yi)xi 2  = 0

Then:

(-1,0): 2a -  2b + 2c   = 0

(0, -2):  0

(1, -2):   2a + 2b  + 2c  - 4  = 0

(2, 0):  32a  + 16b + 8c   = 0

            ------------------------

Summing: 36a  +16b +12c - 4 = 0


f/=  2 (axi  2 +  bxi    c   -yi)xi   = 0

(-2,1 ): - 16a + 8b - 4c + 4 = 0

(-1, -1):  -2a  + 2b - 2c -2  = 0

(0, 2):      0

(1, 1):     2a  + 2b  + 2c  - 2 = 0

---------------------------------

     Sum:   -16a + 12b  - 4c =  -4

 

f/c =  2 (axi  2 +  bxi    c   -yi)   = 0

(-2, 1):  8a - 4b + 2c - 2 = 0

(-1, -1): 2a - 2b + 2c + 2 = 0

(0, 2): 2c - 4 = 0

(1, 1): 2a  +2b + 2c - 2 = 0

 -----------------------------

Sum:  12a - 4b + 8c - 2 = 0

From the 3 sums we arrive at a 3 x 3 system given by:

36a - 16b +12c  = 4

-16a + 12b  - 4c = -4

12a - 4b + 8c      = 2

Or, written in matrix form:

The values for a, b, c can then be found using either Gaussian elimination with pivotal condensation or matrix inversion.  Since a website Gaussian elimination calculator was provided at the end of the Part 6 post, it is easiest to choose the former.

Plugging in the values from the matrix eqn. we obtain:

Then hit "solve the system" to get at the very end:

x1 = -0.25x2 = -0.55x3 = 0.35

So:  a  =  -0.25   b = -0.55    c = 0.35

 A check of the results appears at the bottom of the process.

Make a check:

36·(-0.25) - 16·(-0.55) + 12·0.35 = -9 + 8.8 + 4.2 = 4
-16·(-0.25) + 12·(-0.55) - 4·0.35 = 4 - 6.6 - 1.4 = -4
12·(-0.25) - 4·(-0.55) + 8·0.35 = -3 + 2.2 + 2.8 = 2

No comments:

Post a Comment