1Stdlib.Complex(3) OCaml library Stdlib.Complex(3)
2
3
4
6 Stdlib.Complex - no description
7
9 Module Stdlib.Complex
10
12 Module Complex
13 : (module Stdlib__Complex)
14
15
16
17
18
19
20
21 type t = {
22 re : float ;
23 im : float ;
24 }
25
26
27 The type of complex numbers. re is the real part and im the imaginary
28 part.
29
30
31
32 val zero : t
33
34 The complex number 0 .
35
36
37
38 val one : t
39
40 The complex number 1 .
41
42
43
44 val i : t
45
46 The complex number i .
47
48
49
50 val neg : t -> t
51
52 Unary negation.
53
54
55
56 val conj : t -> t
57
58 Conjugate: given the complex x + i.y , returns x - i.y .
59
60
61
62 val add : t -> t -> t
63
64 Addition
65
66
67
68 val sub : t -> t -> t
69
70 Subtraction
71
72
73
74 val mul : t -> t -> t
75
76 Multiplication
77
78
79
80 val inv : t -> t
81
82 Multiplicative inverse ( 1/z ).
83
84
85
86 val div : t -> t -> t
87
88 Division
89
90
91
92 val sqrt : t -> t
93
94 Square root. The result x + i.y is such that x > 0 or x = 0 and y >= 0
95 . This function has a discontinuity along the negative real axis.
96
97
98
99 val norm2 : t -> float
100
101 Norm squared: given x + i.y , returns x^2 + y^2 .
102
103
104
105 val norm : t -> float
106
107 Norm: given x + i.y , returns sqrt(x^2 + y^2) .
108
109
110
111 val arg : t -> float
112
113 Argument. The argument of a complex number is the angle in the complex
114 plane between the positive real axis and a line passing through zero
115 and the number. This angle ranges from -pi to pi . This function has
116 a discontinuity along the negative real axis.
117
118
119
120 val polar : float -> float -> t
121
122
123 polar norm arg returns the complex having norm norm and argument arg .
124
125
126
127 val exp : t -> t
128
129 Exponentiation. exp z returns e to the z power.
130
131
132
133 val log : t -> t
134
135 Natural logarithm (in base e ).
136
137
138
139 val pow : t -> t -> t
140
141 Power function. pow z1 z2 returns z1 to the z2 power.
142
143
144
145
146
147OCamldoc 2023-01-23 Stdlib.Complex(3)