# Lagrange Polynomial Interpolation

1. Oct 2, 2011

### xkellyy

1. The problem statement, all variables and given/known data
Find the polynomial p(x) of degree 20 satisfying:
p(-10) =p(-9) = p(-8) = .......=p(-1) = 0
p(0) = 1
p(1) = p(2) = p(3) = .....p(10) = 0

2. Relevant equations

L(x) := \sum_{j=0}^{k} y_j \ell_j(x)

3. The attempt at a solution

i tried using the formula above:

a = p(-10) / (-1)(-2)(-3)....(-20) = 0

and got zero for all the coefficients excluding the 20th coefficient, which i got 1/0

then i thought about it graphically - it looks like a cos graph so i tried using the maclaurin series expansion but realised that it only works from n to infinity.

any tips?

2. Oct 2, 2011

### Kreizhn

A few suggestions. Throw some itex and tex tags around your latex to make them render. Next, could you define some of things you're using? What are $y_j, \ell_j,a$? It is impossible for us to guess what these are supposed to be.

Now assuming I've guess your notation correctly, the Lagrange polynomial is given by

$$L(x) = \sum_{j=0}^{20} p(x_j) \ell_j(x)$$
where
$$\ell_j(x) = \prod_{i\neq j, i=0}^{20} \frac{ (x -x_j) }{(x_j-x_i)}$$

in which case you are correct, all terms except the j=0 term disappear. So what is $\ell_0$?

3. Oct 2, 2011

### xkellyy

so to find the nth coefficient for the x^n-1 term

a(n) = p(n)/(x-x1)(x-x2)(x-x3).....

x1, x2 terms are the x values of the data points provided from ascending order excluding the x(n) point if that makes sense

but what i'm saying is, i get zero or 1/0 (for P(0) = 1) point for all the coefficients i calculate which is where i'm stuck :/

4. Oct 2, 2011

### Kreizhn

Okay, I understand the x(n) notation but you still haven't defined what $y_j$ is, what $\ell_j$ is, or how a(n) fits into the definition of the Lagrange polynomial. It's impossible to help you unless you make these things clear.

5. Oct 2, 2011

### xkellyy

yj is the y co-ordinate of the data point...lj is the coefficient of x^n, where n is the varying degrees of the polynomial (in this example, 0-20 because there are 21 data points)

a(n) was just my way of explaining lj.

6. Oct 2, 2011

### Kreizhn

Ah, okay.

Well, the $\ell_j$ are never zero. Take a look at how I defined $\ell_j$ in one of my previous posts and you'll see that this is true. What is the formula you are using to calculate them?