next up previous
Next: External vs. Lambda Up: Standard Libraries Previous: Standard Functions (standard.ccl)

Math (math.ccl)

This library defines, as external functions, all the trigonometric functions, logarithms, square root, floor, and ceiling. It also defines the symbol pi to be an approximation of $\pi$.

The math libary also defines a few lambda functions, as follows.


abs x
Evaluates to the absolute value of (the integer or real value) of x.


max x y
Returns the maximum of x and y.


min x y
Returns the minimum of x and y.


sign x
Returns 1 if x is positive, -1 if it is negative and 0 if it is zero.


dot x y
Returns the dot product of the lists x and y, which should be integer or real lists of equal length.


mmult A B
Returns the matrix product of A and B, which should each be lists of lists of integers of reals.


To use dot or mmult, you would write, for example,

include math.ccl
include list.ccl

x := { 1, 2, 3 };
dot x x;

A := {
  { 1, 2, 3 },
  { 3, 4, 5 },
  { 5, 6, 7 }
};

y := mmult A (tocol x);
The function tocol converts the row vector x into a column vector and is defined list.ccl (discussed later).



Subsections
next up previous
Next: External vs. Lambda Up: Standard Libraries Previous: Standard Functions (standard.ccl)
Eric Klavins 2003-12-03