You will make the th roots of unity as complex numbers and test two facts about them.
The idea. The roots are for to ; in Python, cmath.exp(2j * cmath.pi * k / n). The sum of their th powers is when divides , and otherwise. The distances from to the other roots multiply to .
Your tasks.
unity(n). Return the list of the roots, starting with .power_sum(n, m). Return the sum of the th powers of the roots.chord_product(n). Return the product of abs(1 - z) over the roots other than .Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…
With Standard, you also open 11 more problems, 2 Python labs and 1 extra course. Everything you have used here stays free, always.