Coding Challenge for Vieta's Formulas
|
07-21-2018, 01:10 PM
(This post was last modified: 07-21-2018 01:47 PM by Namir.)
Post: #10
|
|||
|
|||
RE: Coding Challenge for Vieta's Formulas
I found a C++ listing that calculates the polynomial coefficnts, given the roots of that polynomial, using the Vieta's Formulas. I checked the code using Visual Studio 2017 Community Edition. The C++ code had a small error in the range of the nested loop (for j = ...). I corrected it and then translated it into Excel VBA. Here is the version that uses Option Base 1 arrays:
Code: Option Explicit The above code uses the following spreadsheet columns (the first row has headings and so value appear as of row 2): 1) Column A has the polynomial coefficients with cell A2 being the coefficient of the higher term. There are N + 1 entries in this column. 2 Column B has N roots, starting with cell B2. 3) Column C has the output array B() which should match the values in the first columns if the roots match the polynomial coefficients. The first value appears in cell C2. 4) Cell B7 displays the value of the Vieta's Formula function. The VBA code is similar to, but not an exact match, to Vallentin's HP-71B code. Note that the values in array B() are in reverse order of the values in array A(). |
|||
« 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)