-
The generic library package
Numerics.Generic_Complex_Elementary_Functions has the following
declaration:
-
with Ada.Numerics.Generic_Complex_Types;
generic
with package Complex_Types is new
Ada.Numerics.Generic_Complex_Types (<>);
use Complex_Types;
package Ada.Numerics.Generic_Complex_Elementary_Functions is
pragma Pure(Generic_Complex_Elementary_Functions);
-
function Sqrt (X : Complex) return Complex;
function Log (X : Complex) return Complex;
function Exp (X : Complex) return Complex;
function Exp (X : Imaginary) return Complex;
function "**" (Left : Complex;
Right : Complex) return Complex;
function "**" (Left : Complex;
Right : Real'Base) return Complex;
function "**" (Left : Real'Base;
Right : Complex) return Complex;
-
function Sin (X : Complex) return Complex;
function Cos (X : Complex) return Complex;
function Tan (X : Complex) return Complex;
function Cot (X : Complex) return Complex;
-
function Arcsin (X : Complex) return Complex;
function Arccos (X : Complex) return Complex;
function Arctan (X : Complex) return Complex;
function Arccot (X : Complex) return Complex;
-
function Sinh (X : Complex) return Complex;
function Cosh (X : Complex) return Complex;
function Tanh (X : Complex) return Complex;
function Coth (X : Complex) return Complex;
-
function Arcsinh (X : Complex) return Complex;
function Arccosh (X : Complex) return Complex;
function Arctanh (X : Complex) return Complex;
function Arccoth (X : Complex) return Complex;
-
end Ada.Numerics.Generic_Complex_Elementary_Functions;
-
The library package Numerics.Complex_Elementary_Functions defines the
same subprograms as Numerics.Generic_Complex_Elementary_Functions,
except that the predefined type Float is systematically substituted for
Real'Base, and the Complex and Imaginary types exported by
Numerics.Complex_Types are systematically substituted for Complex and
Imaginary, throughout. Nongeneric equivalents of
Numerics.Generic_Complex_Elementary_Functions corresponding to each of
the other predefined floating point types are defined similarly, with
the names Numerics.Short_Complex_Elementary_Functions,
Numerics.Long_Complex_Elementary_Functions, etc.
-
The overloading of the Exp function for the pure-imaginary type is
provided to give the user an alternate way to compose a complex value
from a given modulus and argument. In addition to
Compose_From_Polar(Rho, Theta), See section G.1.1 Complex Types, the programmer may write
Rho * Exp(i * Theta).
-
The imaginary (resp., real) component of the parameter X of the forward
hyperbolic (resp., trigonometric) functions and of the Exp function (and
the parameter X, itself, in the case of the overloading of the Exp
function for the pure-imaginary type) represents an angle measured in
radians, as does the imaginary (resp., real) component of the result of
the Log and inverse hyperbolic (resp., trigonometric) functions.
-
The functions have their usual mathematical meanings. However, the
arbitrariness inherent in the placement of branch cuts, across which
some of the complex elementary functions exhibit discontinuities, is
eliminated by the following conventions:
-
The imaginary component of the result of the Sqrt and Log functions is
discontinuous as the parameter X crosses the negative real axis.
-
The result of the exponentiation operator when the left operand is of
complex type is discontinuous as that operand crosses the negative real
axis.
-
The real (resp., imaginary) component of the result of the Arcsin and
Arccos (resp., Arctanh) functions is discontinuous as the parameter X
crosses the real axis to the left of -1.0 or the right of 1.0.
-
The real (resp., imaginary) component of the result of the Arctan
(resp., Arcsinh) function is discontinuous as the parameter X crosses
the imaginary axis below -i or above i.
-
The real component of the result of the Arccot function is discontinuous
as the parameter X crosses the imaginary axis between -i and i.
-
The imaginary component of the Arccosh function is discontinuous as the
parameter X crosses the real axis to the left of 1.0.
-
The imaginary component of the result of the Arccoth function is
discontinuous as the parameter X crosses the real axis between -1.0 and
1.0.