6 kyu
nova polynomial 5. from roots
99hgamboa
Description:
*** Nova polynomial from roots***
This kata is from a series on polynomial handling. ( #1 #2 #3 #4)
Consider a polynomial in a list where each element in the list element corresponds to the factors. The factor order is the position in the list. The first element is the zero order factor (the constant).
p = [a0, a1, a2, a3] signifies the polynomial a0 + a1x + a2x^2 + a3*x^3
In this kata create the polynomial from a list of roots:
[r0, r1 ,r2, r3 ]
p = (x-r0)(x-r1)(x-r2)(x-r3)
note: no roots should return the identity polynomial.
poly_from_roots([4]) = [-4, 1]
poly_from_roots([0, 0, 0, 0] ) = [0, 0, 0, 0, 1]
poly_from_roots([]) = [1]
The first katas of this series is preloaded in the code and can be used: poly_add poly_multiply
Algorithms
Similar Kata:
Stats:
Created | Apr 25, 2016 |
Published | Apr 25, 2016 |
Warriors Trained | 282 |
Total Skips | 26 |
Total Code Submissions | 243 |
Total Times Completed | 99 |
Python Completions | 99 |
Total Stars | 7 |
% of votes with a positive feedback rating | 95% of 41 |
Total "Very Satisfied" Votes | 37 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |