Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
Long Complex MathDEFINITION MODULE LongComplexMath; IMPORT LONGCOMPLEX; (* Mathematical Constants and Functions for Type LONGCOMPLEX *) CONST i = { 0.0, 1.0 }; one = { 1.0, 0.0 }; zero = { 0.0, 0.0 }; PROCEDURE arg ( z : LONGCOMPLEX ) : LONGREAL; (* Returns the argument of z. *) PROCEDURE conj ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the complex conjugate of z. *) PROCEDURE power ( base : LONGCOMPLEX; exponent : LONGREAL ) : LONGCOMPLEX; (* Returns the value of base raised to the power exponent. *) PROCEDURE sqrt ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the square root of z. *) PROCEDURE ln ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the natural logarithm of z. *) PROCEDURE log ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the decimal logarithm of z. *) PROCEDURE sin ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the sine of z. *) PROCEDURE cos ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the cosine of z. *) PROCEDURE tan ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the tangent of z. *) PROCEDURE arcsin ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the arcsine of z. *) PROCEDURE arccos ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the arccosine of z. *) PROCEDURE arctan ( z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the arctangent of z. *) PROCEDURE polarToComplex ( abs, arg : LONGREAL ) : LONGCOMPLEX; (* Returns the complex value with the specified polar coordinates. *) PROCEDURE scalarMult ( scalar : LONGREAL; z : LONGCOMPLEX ) : LONGCOMPLEX; (* Returns the scalar product of scalar and z. *) END LongComplexMath. |