Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to compute Lagrange coefficients in Maple. Having found the $n$ roots of a Lagrange polynomial, I want to calculate the $j$-th coefficient:

$$L_j(x) = \prod_{{i=0}\atop{j \neq i}}^{n}\frac{x-x_i}{x_j-x_i}$$

Is it possible to do elegantly with the Maple product() function?

share|cite|improve this question
up vote 1 down vote accepted

The s indeed, but why not use the built in procedures:

withApplyFunction(CurveFitting):
PolynomialInterpolationApplyFunction([[0,0],[1,3],[2,1],[3,3]],z)

where the points are listed as ordered pairs in square brackets, add "form=Lagrange" if you want the products to not be multiplied out.

PolynomialInterpolationApplyFunction([0,2,4,7],[2,a,1,3],z,form=Lagrange)

share|cite|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.