DEFINITION MODULE LngCmplxMath;

  (*------------------------------------------------------------------------*)
  (* Baisisrechenoperationen für den Record-Typ Deklera.LONGCMPLX           *)
  (* und abgeleitete Funktionen                                             *)
  (* Mathematical functions for the type LONGCMPLX                          *)
  (*                                                                        *)
  (* This module should not be used in new projects !!!                     *)
  (*------------------------------------------------------------------------*)
  (* Implementation : Michael Riedl                                         *)
  (* Licence        : GNU Lesser General Public License (LGPL)              *)
  (*------------------------------------------------------------------------*)

  (* $Id: LngCmplxMath.def,v 1.2 2017/09/24 10:14:20 mriedl Exp mriedl $ *)

FROM Deklera IMPORT LONGCMPLX;

PROCEDURE CMPLX(real,imag : LONGREAL) : LONGCMPLX;

PROCEDURE CAdd(x,y : LONGCMPLX) : LONGCMPLX;   (* x + y *)
PROCEDURE CSub(x,y : LONGCMPLX) : LONGCMPLX;   (* x - y *)
PROCEDURE CMul(x,y : LONGCMPLX) : LONGCMPLX;   (* x*y   *)
PROCEDURE CDiv(x,y : LONGCMPLX) : LONGCMPLX;   (* x / y *)
PROCEDURE CRez(x   : LONGCMPLX) : LONGCMPLX;   (* 1 / x *)

(* Fehlt
 *
 * CONST
 *   i =    CMPLX (0.0, 1.0);
 *   one =  CMPLX (1.0, 0.0);
 *   zero = CMPLX (0.0, 0.0);
*)

PROCEDURE abs(z: LONGCMPLX): LONGREAL;

          (*----------------------------------------------------------------*)
          (* Returns the length of z                                        *)
          (*----------------------------------------------------------------*)

(* Fehlt
 *
 * PROCEDURE arg (z: LONGCMPLX): LONGREAL;
 * 
 *        (*----------------------------------------------------------------*)
 *        (* Returns the angle that z subtends to the positive real axis    *)
 *        (*----------------------------------------------------------------*)
 *)

PROCEDURE conj (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the complex conjugate of z                             *)
          (*----------------------------------------------------------------*)
(* Fehlt
 *
 * PROCEDURE power (base: LONGCMPLX; exponent: LONGREAL): LONGCMPLX;
 * 
 *        (*----------------------------------------------------------------*)
 *        (* value of the number base raised to the power exponent          *)
 *        (*----------------------------------------------------------------*)
 *)

PROCEDURE sqrt (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the principal square root of z                         *)
          (*----------------------------------------------------------------*)

PROCEDURE exp (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the complex exponential of z                           *)
          (*----------------------------------------------------------------*)

PROCEDURE ln (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the principal value of the natural logarithm of z      *)
          (*----------------------------------------------------------------*)

PROCEDURE sin (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the sine of z                                          *)
          (*----------------------------------------------------------------*)

PROCEDURE cos (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the cosine of z                                        *)
          (*----------------------------------------------------------------*)

PROCEDURE tan (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the tangent of z                                       *)
          (*----------------------------------------------------------------*)
(* Fehlt
 *
 * PROCEDURE arcsin (z: LONGCMPLX): LONGCMPLX;
 *
 *        (*----------------------------------------------------------------*)
 *        (* Returns the arcsine of z                                       *)
 *        (*----------------------------------------------------------------*)
 *)

(* Fehlt
 *
 * PROCEDURE arccos (z: LONGCMPLX): LONGCMPLX;
 * 
 *        (*----------------------------------------------------------------*)
 *        (* Returns the arccosine of z                                     *)
 *        (*----------------------------------------------------------------*)
*)

PROCEDURE arctan (z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the arctangent of z                                    *)
          (*----------------------------------------------------------------*)

(* Fehlt
 *
 * PROCEDURE polarToComplex (abs, arg: LONGREAL): LONGCMPLX;
 * 
 *        (*----------------------------------------------------------------*)
 *        (* Complex number with the specified polar coordinates            *)
 *        (*----------------------------------------------------------------*)
 *)

PROCEDURE scalarMult (scalar: LONGREAL; z: LONGCMPLX): LONGCMPLX;

          (*----------------------------------------------------------------*)
          (* Returns the scalar product of scalar with z                    *)
          (*----------------------------------------------------------------*)

END LngCmplxMath.
