Roots of unity: Difference between revisions

Content added Content deleted
(cleanup, get rid of my latex attempt at math)
Line 1,631: Line 1,631:


=={{header|Rust}}==
=={{header|Rust}}==
Here we demonstrate initialization from polar complex coordinate, e^1, and raising it to the power 2k for k in 0..n-1, to generate the roots. This will require adding the num crate to one's rust project, typically in Cargo.toml <i>[dependencies] \n num="0.2.0";</i>

<lang C>use num::Complex;
This will require adding the num crate to the rust project, in Cargo.toml <i>[dependencies]\nnum="0.2.0";</i>

<lang C>
use num::Complex;
fn main() {
fn main() {
let n = 8;
let n = 8;
Line 1,643: Line 1,640:
}
}
}</lang>
}</lang>

<pre>
<pre>
e^ 0πi/8 ≈ 1.000+0.000i
e^ 0πi/8 ≈ 1.000+0.000i