1 (***********************************************************************)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
7 (* Copyright 2002 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the GNU Library General Public License, with *)
10 (* the special exception on linking described in file ../LICENSE. *)
12 (***********************************************************************)
18 This module provides arithmetic operations on complex numbers.
19 Complex numbers are represented by their real and imaginary parts
20 (cartesian representation). Each part is represented by a
21 double-precision floating-point number (type [float]). *)
23 type t
= { re
: float; im
: float }
24 (** The type of complex numbers. [re] is the real part and [im] the
28 (** The complex number [0]. *)
31 (** The complex number [1]. *)
34 (** The complex number [i]. *)
37 (** Unary negation. *)
40 (** Conjugate: given the complex [x + i.y], returns [x - i.y]. *)
52 (** Multiplicative inverse ([1/z]). *)
58 (** Square root. The result [x + i.y] is such that [x > 0] or
60 This function has a discontinuity along the negative real axis. *)
63 (** Norm squared: given [x + i.y], returns [x^2 + y^2]. *)
66 (** Norm: given [x + i.y], returns [sqrt(x^2 + y^2)]. *)
69 (** Argument. The argument of a complex number is the angle
70 in the complex plane between the positive real axis and a line
71 passing through zero and the number. This angle ranges from
72 [-pi] to [pi]. This function has a discontinuity along the
73 negative real axis. *)
75 val polar
: float -> float -> t
76 (** [polar norm arg] returns the complex having norm [norm]
77 and argument [arg]. *)
80 (** Exponentiation. [exp z] returns [e] to the [z] power. *)
83 (** Natural logarithm (in base [e]). *)
86 (** Power function. [pow z1 z2] returns [z1] to the [z2] power. *)