Anonymous user
Roots of unity: Difference between revisions
→{{header|Crystal}}
m (→{{header|REXX}}: added whitespace, simplified code, optimized two functions.) |
|||
Line 339:
=={{header|Crystal}}==
{{trans|Ruby}}
<lang
def roots_of_unity(n)
Line 348:
</lang>
Or alternative
<lang
def roots_of_unity(n)
(0...n).map { |k| Complex.new(Math.cos(2 * Math::PI * k / n), Math.sin(2 * Math::PI * k / n)) }
|