Coding Challenge for Vieta's Formulas
|
07-12-2018, 11:15 PM
(This post was last modified: 07-13-2018 06:37 PM by Namir.)
Post: #1
|
|||
|
|||
Coding Challenge for Vieta's Formulas
I am interested in coding general cases of the Vieta's formulas (check the Wikipedia article to see these formulas in a high-level language like VBA, Python, Matlab, and C++. The target is to have a function that sums up the squares of the LHS - RHS of each Vieta formula:
F(X,a) = (LHS1 - RHS1)^2 + (LHS2 - RHS2)^2 + ... + (LHSn - RHSn)^2 Where: LHS1 = sum(X(i)) for i = 1 to n RHS1 = - a(n-1)/a(n)) LHS2 = ((X(1)*X(2) + X(1)*X(3) + ... + X(1)*X(n)) + ((X(2)*X(3) + X(2)*X(4) + ... + X(2)*X(n)) + ... + X(n-1)*X(n) RHS2 = a(n-2)/a(n)) .... LHSn = product(X(i)) for i = 1 to n RHSn = (-1)^n * a(0)/a(n) The parameters are the array X() which represents the guesses for the roots, and array a() that represents the polynomial coefficients. The Wikipedia article designates a(n) as the coefficient for x^n and a(0) as the constant term. Good luck to us all!! Namir |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Coding Challenge for Vieta's Formulas - Namir - 07-12-2018 11:15 PM
RE: Coding Challenge for Vieta's Foummulas - Valentin Albillo - 07-13-2018, 03:34 AM
RE: Coding Challenge for Vieta's Formulas - Namir - 07-13-2018, 06:19 AM
RE: Coding Challenge for Vieta's Foumulas - Namir - 07-13-2018, 11:50 AM
RE: Coding Challenge for Vieta's Foummulas - Valentin Albillo - 07-13-2018, 02:46 PM
RE: Coding Challenge for Vieta's Formulas - Namir - 07-13-2018, 06:35 PM
RE: Coding Challenge for Vieta's Formulas - Valentin Albillo - 07-14-2018, 12:50 AM
RE: Coding Challenge for Vieta's Formulas - Namir - 07-14-2018, 01:36 AM
RE: Coding Challenge for Vieta's Formulas - Namir - 07-14-2018, 03:13 PM
RE: Coding Challenge for Vieta's Formulas - Namir - 07-21-2018, 01:10 PM
|
User(s) browsing this thread: 1 Guest(s)