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