Shadow Posted May 24, 2009 Posted May 24, 2009 Hey all, say we have N points in Cartesian space, and we are to find a nth degree polynomial that goes through all those points. How would you symbolically describe the solutions for the coefficients? Just to make my question clear, here's an example: N=2: we have two points, W and Z. So in this case we're looking for a linear equation in the form [math]y=ax+b[/math]. We get two equations, and solve for a and b. If we had three points, we would be looking for a quadratic function in the form [math]y=ax^2+bx+c[/math]. We get three equations, solve for a, b and c. Now what I'm looking for is a way to tell a computer how to get the coefficients given N points. Cheers, Gabe
timo Posted May 24, 2009 Posted May 24, 2009 Assuming "cartesian space" means (x,y) where y=f(x) then the n-th degree polynomial [math]P^n[/math] running to the points [math](x_i, y_i), \ i=0 \dots n[/math] (with [math]i \neq j \Rightarrow x_i \neq x_j[/math] is [math] P^n(x) = \sum_{i=0}^n y_i \prod_{j\neq i} \frac{x-x_j}{x_i-x_j} [/math]
Shadow Posted May 25, 2009 Author Posted May 25, 2009 Thanks Atheist. Just for clarification, [math]\prod_{j\neq i} \frac{x-x_j}{x_i-x_j} [/math] means that it runs while j is smaller than i, from j=0?
D H Posted May 25, 2009 Posted May 25, 2009 No. It means it runs through all j (i.e., from 0 to n) but skips over the j=i term.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now