Roots of unity: Difference between revisions

m
m (→‎{{header|REXX}}: changed whitespace, aligned an IF/THEN/ELSE statement, changed wording in the REXX section header.)
Line 1,839:
=={{header|Rust}}==
Here we demonstrate initialization from polar complex coordinate, radius 1, e^πi/n, and raising the resulting complex number to the power 2k for k in 0..n-1, which generates approximate roots (see the Mathematica answer for a nice display of exact vs approximate). This code will require adding the num crate to one's rust project, typically in Cargo.toml <i>[dependencies] \n num="0.2.0";</i>
<lang Crust>use num::Complex;
fn main() {
let n = 8;
Anonymous user