A numerical function is always
represented by pairs with
.
If it is necessary to evaluate the function outside the points we
assume that is linear between two sucessive . Before it is
constant and its value is and after it is constant and its
value is .
Functions can be defined in simple or double precision (but simple precision may be abandoned in future versions of funct).
To define a function the x-range must be defined first. For example the command xrange used to create a double precision x-range needs 3 parameters :
- funct -> xrange xr n1 n2
creates a x-range in double precision with n2 points. The first parameter n1 indicates the type of the x-range. It must be 0 or 1. The two types differ by the way the variable of the functions having this x-range is represented. For type 0, there are no conditions on the , except that . For type 1, it is assumed that the are equally spaced, so it is sufficient to know the initial value and the step between two successive .
Once the x-range has been created it must be defined. For type 1 x-ranges it is only necessary to indicate the initial value of the x's and the increment, with the command
- funct -> fix_xrange xr orig incr
Here xr is the name of the x-range, orig is the first value of x, and incr the distance between sucessive x's. The two last parameters can be numerical expressions that will be translated by the expression evaluator of interpcom.
If the x-range is of type 0, the command must be
- funct -> fix_xrange xr m x
where m will be evaluated as an integer, and x will be the value of the m-th x.
Now we can create functions having this x-range :
- funct -> function f xr - funct -> function_C fC xr
will create a real double precision function f and a complex double precision function fC with x-range xr. There are similar commands for simple precision x-ranges and functions.
Functions can be destroyed with the command destroy of interpcom, and x-ranges too. Note that when a x-range is destroyed, all the functions that use it are also destroyed.