6 kyu

nova polynomial 5. from roots

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:

CreatedApr 25, 2016
PublishedApr 25, 2016
Warriors Trained282
Total Skips26
Total Code Submissions243
Total Times Completed99
Python Completions99
Total Stars7
% of votes with a positive feedback rating95% of 41
Total "Very Satisfied" Votes37
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes0
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • hgamboa Avatar
  • Voile Avatar
Ad