1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use Complex64;
/// Wrapper around a complex number that represents
/// the multiplicative period of a root
///
/// For a root `R_n` The multiplicative period `P` satisfies the equation:
/// `R_n+1 = R_n * P`
///
/// The multiplicative period can be calculated with the following formula:
///
/// # Calculation
///
/// `e^(2iπz* / |z|²)`
///
/// where `z*` is the complex conjugate and `|z|` is the magnitude.
///
/// # Examples
/// ```rust
/// # use croot::prelude::*;
/// # use core::f64::consts::PI;
/// # use num_complex::Complex64;
/// # const I: Complex64 = Complex64::new(0.0, 1.0);
/// let (root, period) = complex_root(10.0, Complex64::new(3.0, 4.0));
///
/// let root_1 = root.powc(Complex64::new(3.0, 4.0)).approx(5);
/// let root_2 = (root * period.into_inner()).powc(Complex64::new(3.0, 4.0)).approx(5);
///
/// assert_eq!(root_1, root_2);
/// ```
Complex64);