File tree Expand file tree Collapse file tree 2 files changed +43
-6
lines changed
Sources/ComplexModule/Documentation.docc Expand file tree Collapse file tree 2 files changed +43
-6
lines changed Original file line number Diff line number Diff line change 1
1
# `` Complex ``
2
2
3
- ## Real and imaginary parts
3
+ A Complex number type that conforms to `` AlgebraicField `` (so all the normal
4
+ arithmetic operations are available) and `` ElementaryFunctions `` (so all
5
+ the usual math functions are available).
4
6
5
7
A ` Complex ` value is represented with two ` RealType ` values, corresponding to
6
- the real and imaginary parts of the number:
8
+ the real and imaginary parts of the number.
9
+
10
+ You can access these Cartesian components using the real and imaginary
11
+ properties.
7
12
8
13
``` swift
9
14
let z = Complex (1 ,-1 ) // 1 - i
@@ -24,9 +29,41 @@ let im = w.imag // .nan
24
29
25
30
See < doc:Infinity > for more details.
26
31
27
- ### Length and magnitude
28
-
29
32
The `` magnitude `` property of a complex number is the infinity norm of the
30
33
value (a.k.a. “maximum norm” or “Чебышёв norm”). To get the two norm (a.k.a
31
34
"Euclidean norm"), use the `` length `` property. See < doc:Magnitude > for more
32
35
details.
36
+
37
+ ## Topics
38
+
39
+ ### Real and imaginary parts
40
+
41
+ - `` real ``
42
+ - `` imaginary ``
43
+ - `` rawStorage ``
44
+ - `` init(_:_:) ``
45
+ - `` init(_:)-(RealType) ``
46
+ - `` init(imaginary:) ``
47
+
48
+ ### Phase, length and magnitude
49
+
50
+ - `` magnitude ``
51
+ - `` length ``
52
+ - `` lengthSquared ``
53
+ - `` normalized ``
54
+ - `` phase ``
55
+ - `` polar ``
56
+ - `` init(length:phase:) ``
57
+
58
+ ### Scaling by real numbers
59
+ - `` multiplied(by:) ``
60
+ - `` divided(by:) ``
61
+
62
+ ### Complex-specific operations
63
+ - `` conjugate ``
64
+
65
+ ### Classification
66
+ - `` isZero ``
67
+ - `` isSubnormal ``
68
+ - `` isNormal ``
69
+ - `` isFinite ``
Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ that the maximum norm lacks:
83
83
‖zw‖₂ = ‖z‖₂‖w‖₂ for any two complex numbers z and w.
84
84
85
85
> Exercises:
86
- > 1 . Why isn't the maximum norm multiplicative?
87
- (Hint: Let ` z = Complex(1,1) ` , and consider ` z*z ` .)
86
+ > 1 . Find z and w that show that the maximum norm is not multiplicative.
87
+ (i.e. exhibit z and w such that ‖zw‖ ≠ ‖z‖‖w‖ .)
88
88
> 2 . Is the 1-norm multiplicative?
89
89
90
90
### Implementation notes:
You can’t perform that action at this time.
0 commit comments