Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Roots-of-unity/MiniScript/roots-of-unity.mini
Normal file
15
Task/Roots-of-unity/MiniScript/roots-of-unity.mini
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
complexRoots = function(n)
|
||||
result = []
|
||||
for i in range(0, n-1)
|
||||
real = cos(2*pi * i/n)
|
||||
if abs(real) < 1e-6 then real = 0
|
||||
imag = sin(2*pi * i/n)
|
||||
if abs(imag) < 1e-6 then imag = 0
|
||||
result.push real + " " + "+" * (imag>=0) + imag + "i"
|
||||
end for
|
||||
return result
|
||||
end function
|
||||
|
||||
for i in range(2,5)
|
||||
print i + ": " + complexRoots(i).join(", ")
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue