Anonymous user
Roots of unity: Difference between revisions
m
→{{header|Lua}}: whitespace
(→Icon and Unicon: condense) |
m (→{{header|Lua}}: whitespace) |
||
Line 452:
Complex numbers from the Lua implementation on the complex numbers page.
<lang lua>--defines addition, subtraction, negation, multiplication, division, conjugation, norms, and a conversion to strgs.▼
▲--defines addition, subtraction, negation, multiplication, division, conjugation, norms, and a conversion to strgs.
complex = setmetatable({
__add = function(u, v) return complex(u.real + v.real, u.imag + v.imag) end,
Line 481 ⟶ 480:
root = root * val
print(root .. "")
end</lang>
=={{header|Mathematica}}==
|