1Complex(3)                       OCaml library                      Complex(3)
2
3
4

NAME

6       Complex - Complex numbers.
7

Module

9       Module   Complex
10

Documentation

12       Module Complex
13        : sig end
14
15
16       Complex numbers.
17
18       This module provides arithmetic operations on complex numbers.  Complex
19       numbers are represented by their real and  imaginary  parts  (cartesian
20       representation).  Each part is represented by a double-precision floatā€
21       ing-point number (type float ).
22
23
24
25
26
27
28       type t = {
29        re : float ;
30        im : float ;
31        }
32
33
34       The type of complex numbers.  re is the real part and im the  imaginary
35       part.
36
37
38
39
40       val zero : t
41
42       The complex number 0 .
43
44
45
46
47       val one : t
48
49       The complex number 1 .
50
51
52
53
54       val i : t
55
56       The complex number i .
57
58
59
60
61       val neg : t -> t
62
63       Unary negation.
64
65
66
67
68       val conj : t -> t
69
70       Conjugate: given the complex x + i.y , returns x - i.y .
71
72
73
74
75       val add : t -> t -> t
76
77       Addition
78
79
80
81
82       val sub : t -> t -> t
83
84       Subtraction
85
86
87
88
89       val mul : t -> t -> t
90
91       Multiplication
92
93
94
95
96       val inv : t -> t
97
98       Multiplicative inverse ( 1/z ).
99
100
101
102
103       val div : t -> t -> t
104
105       Division
106
107
108
109
110       val sqrt : t -> t
111
112       Square root.  The result x + i.y is such that x > 0 or x = 0 and y >= 0
113       .  This function has a discontinuity along the negative real axis.
114
115
116
117
118       val norm2 : t -> float
119
120       Norm squared: given x + i.y , returns x^2 + y^2 .
121
122
123
124
125       val norm : t -> float
126
127       Norm: given x + i.y , returns sqrt(x^2 + y^2) .
128
129
130
131
132       val arg : t -> float
133
134       Argument.  The argument of a complex number is the angle in the complex
135       plane  between  the  positive real axis and a line passing through zero
136       and the number.  This angle ranges from -pi to pi .  This function  has
137       a discontinuity along the negative real axis.
138
139
140
141
142       val polar : float -> float -> t
143
144
145       polar norm arg returns the complex having norm norm and argument arg .
146
147
148
149
150       val exp : t -> t
151
152       Exponentiation.  exp z returns e to the z power.
153
154
155
156
157       val log : t -> t
158
159       Natural logarithm (in base e ).
160
161
162
163
164       val pow : t -> t -> t
165
166       Power function.  pow z1 z2 returns z1 to the z2 power.
167
168
169
170
171
172
173OCamldoc                          2017-03-22                        Complex(3)
Impressum