I must find the interpolating polinomial and find the value 0.32
Using the Lagrange formula, I did:
P(x)=a(x−0,3)(x−0,4)(a−0,3)(a−0,4)+b(x−0,3)(x−0,4)(b−0,3)(b−0,4)
*where a and b are the respective values of y for x=0,3 and x=0,4
Since he asks for a 2 degree polynomial, then I think he's asking me to pick the 2 closest points to x=0,32 and interpolate it. I did it and arrived at a 2nd degree polynomial. But when I try online interpolation generators I always end up with a line equation. So, here's what I did:
P(x)=0,067x2−0,7x+0,12(0,067−0,3)(0,067−0,4)−0,376x2−0,7x+0,12(−0,376−0,3)(−0,376−0,4)
P(x)=0.067x2−0,7x+0.12(−0.233)(−0.333)−0.376x2−0,7x+0.12(−0.676)(−0.776)
P(x)=0.86352(x2−0,7x+0.12)−0.71676(x2−0,7x+0.12)=
0.14676(x2−0,7x+0.12)
Is my idea right? I didn't check the numbers, but am I doing it right?
In the other exercise, he asks me to find P3(0,32) (which I think is the third degree polynomial evaluated at 0,32). So I shluld pick another close point, in this case x=0,1 and to the process?
UPDATE: Just figured out I did the ring thing: this polynomial is 0 for 0.3 and 0.4, I'm dumb. How do I make it to be 1 for these values?
Answer
The nth degree Lagrange interpolating polynomial Pn(x) for the points x0,x1,…,xn is given by Pn(x)=n∑i=0f(xi)n∏k=0k≠i(x−xk)(xi−xk)
Notice thus, that in order to get an nth degree Lagrange interpolating polynomial, we need (n+1) distinct points.
Thus, for the second degree polynomial to we require three points (the ones closest to 0.32). Thus we choose the points 0.1 0.3 0.4
So we get
P2(x)=f(0.1)(x−0.3)(x−0.4)(0.1−0.3)(0.1−0.4)+f(0.3)(x−0.1)(x−0.4)(0.3−0.1)(0.3−0.4)+f(0.4)(x−0.1)(x−0.3)(0.4−0.1)(0.4−0.3)
Now, to answer your last question for P3(x) we need four points. We will must thus use all of them and get
P3(x)=f(x0)(x−x1)(x−x2)(x−x3)(x0−x1)(x0−x2)(x0−x3)+f(x1)(x−x0)(x−x2)(x−x3)(x1−x0)(x1−x2)(x1−x3)+f(x2)(x−x0)(x−x1)(x−x3)(x2−x0)(x2−x1)(x2−x3)+f(x3)(x−x0)(x−x1)(x−x2)(x3−x0)(x3−x1)(x3−x2)
I will leave it to you to substitute in the appropriate values.
No comments:
Post a Comment