A.5.1 Built-in Functions

The standard mathematical functions are defined for complex numbers in general. Many-valued mathematical functions (for instance asin()) return their principal value.

All available functions are listed in Table A.9. The types of the arguments are written within the parentheses.

A simple example which calculates the sine of a Complex:

a = sin(4.42 + 5.9 j);          // -> -174.9 - 52.6 j

The functions sin(), cos(), tan(), and cot() expect their argument in radians. The functions asin(), acos(), atan(), and acot() deliver a result in radians. The functions abs(), arg(), sign(), sigma(), squ(), sqrt(), cub(), and cbrt() may be called with a Real, Complex, or Quantity respectively. sqrt() and cbrt() calculate the square and the cubic root respectively, and, therefore, expect an argument with a square or cubic unit respectively:

i1 = sqrt(4 "A*A");             // -> 2 A
i2 = cbrt(8 "A*A*A");           // -> 2 A

Another, rather simple example calculates the length of the hypotenuse of a right-angled triangle with its short sides given.

a = 3 A;
b = 4 A;
c = sqrt(squ(a) + squ(b));      // -> 5 A

It is to note that the square root of -1 delivers 1.0 j:

d = sqrt (-4);                  // -> 0.0 + 2.0 j


Table A.9: Built-in functions.
Function Description
abs(Complex Quantity) absolute value
arg(Complex Quantity) argument value
sign(Real Quantity) sign
sigma(Real Quantity) step function
sin(Complex) sine
cos(Complex) cosine
tan(Complex) tangent
cot(Complex) cotangent
asin(Complex) inverse sine
acos(Complex) inverse cosine
atan(Complex) inverse tangent
acot(Complex) inverse cotangent
sinh(Complex) hyperbolic sine
cosh(Complex) hyperbolic cosine
tanh(Complex) hyperbolic tangent
coth(Complex) hyperbolic cotangent
asinh(Complex) inverse hyperbolic sine
acosh(Complex) inverse hyperbolic cosine
atanh(Complex) inverse hyperbolic tangent
acoth(Complex) inverse hyperbolic cotangent
exp(Complex) exponential function
pow(Complex, Complex) argument 1 to the power of argument 2
pow2(Complex) 2 to the power of the given argument
pow10(Complex) 10 to the power of the given argument
log(Complex) natural logarithm
log2(Complex) logarithm to the base 2
log10(Complex) common logarithm (to the base 10)
squ(Complex Quantity) square
sqrt(Complex Quantity) square root
cub(Complex Quantity) power of three
cbrt(Complex Quantity) cubic root

Robert Klima 2003-02-06