Hi All folks who are NOT attending HHC 2010,
Since you are not busy at the HHC, I thought you can handle the following worthwhile challenge.
The Viete's formulas allow you to calculate the coefficients of a polynomial given it's roots. For example for quadratic polynomials:
x1 + x2 = - b / a
x1 * x2 = c / a
Giving the polynomial a x^2 + b X + c. Choosing a = 1 simplifies things.
In the case of a cubic polynomial you have:
x1 + x2 + x3 = - b / a
x1* x2 + x1 * x3 + x2 * x3 = c /a
x1 * x2 * x3 = -d / a
Giving the polynomial a x^3 + b x^2 + c x + d. Choosing a = 1 simplifies things.
Wikipedia shows the general equations for the Viete's formulas here.
All polynomials (order 2 ad higher) have the following in common:
1) The coefficient of the n-1 term (n being the polynomial order) is calculated as:
sum(x(i)) = - b / a, for i = 1 to n
2) The constant term is calculated as:
product(x(i) = (-1)^n * constant_term / a for i = 1 to n
Your challenge is to write a program in RPN, RPL, BASIC or any other popular language (for calculator or for PC) that can calculate the coefficients of any polynomial given the array of roots. Using coefficient a as 1 simplifies things a bit.
The solution requires that you handle a number of n equations to calculate the coefficients of a polynomial of order n.
Namir
AWOL from HHC 2010 and hiding in the south of France!! Merci Sarkozi!!!
Edited: 25 Sept 2010, 12:31 p.m.