Roots of unity: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor update following changes to complex number formatting.) |
||
Line 2,138: | Line 2,138: | ||
for (n in 2..5) { |
for (n in 2..5) { |
||
Fmt.print("$d roots of 1:", n) |
Fmt.print("$d roots of 1:", n) |
||
for (r in roots.call(n)) Fmt.print(" $ |
for (r in roots.call(n)) Fmt.print(" $0.14z", r) |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Line 2,144: | Line 2,144: | ||
<pre> |
<pre> |
||
2 roots of 1: |
2 roots of 1: |
||
1.00000000000000 + |
1.00000000000000 + 0.00000000000000i |
||
-1.00000000000000 + |
-1.00000000000000 + 0.00000000000000i |
||
3 roots of 1: |
3 roots of 1: |
||
1.00000000000000 + |
1.00000000000000 + 0.00000000000000i |
||
-0.50000000000000 + |
-0.50000000000000 + 0.86602540378444i |
||
-0.50000000000000 - |
-0.50000000000000 - 0.86602540378444i |
||
4 roots of 1: |
4 roots of 1: |
||
1.00000000000000 + |
1.00000000000000 + 0.00000000000000i |
||
0.00000000000000 + |
0.00000000000000 + 1.00000000000000i |
||
-1.00000000000000 + |
-1.00000000000000 + 0.00000000000000i |
||
-0.00000000000000 - |
-0.00000000000000 - 1.00000000000000i |
||
5 roots of 1: |
5 roots of 1: |
||
1.00000000000000 + |
1.00000000000000 + 0.00000000000000i |
||
0.30901699437495 + |
0.30901699437495 + 0.95105651629515i |
||
-0.80901699437495 + |
-0.80901699437495 + 0.58778525229247i |
||
-0.80901699437495 - |
-0.80901699437495 - 0.58778525229247i |
||
0.30901699437495 - |
0.30901699437495 - 0.95105651629515i |
||
</pre> |
</pre> |
||