Why is my Lagrange polynomial not working?

163 Views Asked by At

(Hi! I am a G11 IB Math AA SL student and I am really struggling to understand what I am doing wrong. First time using this site, so please forgive me if I mess up ).

My set of data is: {{3.8, 1.69},{4, 1.24},{4.2, 0.33},{4.4, 0.294}{4.6, 0.347},{4.8, 0.487},{5, 0.286},{5.2, 0.898},{5.4, -0.58}}

I used this formula to find the Ls for each point

This is what I got

$$L(3.8) = x^8 - 37.6x^7 + 617.68x^6 - 5790.4x^5 + 33879.6304x^4 - 126692.68864x^3 + 295695.78163x^2 - 393821.36524x + 229154.36544$$

and etc.

I multiplied each $L$ by the $y$ value of its $x$ point. For example, $1.69 L(3.8)$

Then, I added all the $L$'s together and simplified the equation until I got this formula

I cannot find where I did a mistake and every online calculator gives me the same equation! Yet, if I substitute the value 4 into the formula, for example, I do not get 1.24.

Please help!!

Edit: The formula: $-(1.7625\times10^2)x^8 + (6.4585\times10^3)x^7 - (1.0337\times10^5)x^6 + (9.4389\times10^5)x^5 - (5.3777\times10^6)x^4 + (1.9577\times10^7)x^3 - (4.4468\times10^7)x^2 + (5.7621\times10^7)x - (3.2612\times10^7)$

Edit: Thank you to everyone who tried to help me!! Just an update - I gave up, nothing seems to work. I am going to model the function in a different way.

3

There are 3 best solutions below

1
On

For reference, here's the Maple session I used:

enter image description here

and here's a Maxima session for the same task:

enter image description here

0
On

The answer to the question is already given. I would like add that the problem of accuracy of numerical calculus is more general. For example we have the same difficulty with the direct method of linear solving: $$y(x_k)=a_0+a_1x_k+a_2(x_k)^2+...+a_i(x_k)^i+...a_8(x_k)^8 \qquad\text{for }\quad k=1\text{ to }k=9.$$ The matrix linear calculus gives the values of the coefficients $a_i$ : $$\big[a_i\big]=\big[(x_k)^{i}\big]^{-1}\big[y_k\big]\qquad\text{with }\quad i=0\text{ to }8\quad\text{and }k=1\text{ to }9.$$ The result is :

enter image description here

RMSE : Root Mean Square Error.

If we keep less digits of the coefficients $a_i$ the LRMSE increases.

This is quite not visible on the graph if the number of digits is higher than 12. With less digits the error becomes more and more evident.

enter image description here

0
On

This a not an answer.

The exact values of the coefficients of the interpolating polynomial are $$\left\{-\frac{32611801819}{1000},\frac{4840183012739}{84000},-\frac{24901762709}{ 560},\frac{112762077761}{5760},-\frac{2065046621}{384},\frac{1087353055}{1152} ,-\frac{39694625}{384},\frac{6510125}{1008},-\frac{236875}{1344}\right\}$$