Mathematical Functions

Various trigonometric, Bessel and miscellaneous functions are built into Feko to help construct geometry, expressions and calculate parameters.

Trigonometric Functions

The following trigonometric functions are supported:

Table 1. Trigonometric functions
SIN sine (argument in radians)
COS cosine (argument in radians)
TAN tangent (argument in radians)
COT cotangent (argument in radians)
ARCSIN arcsine (argument in radians)
ARCCOS arccosine (argument in radians)
ARCTAN arctangent (in radians)
ATAN2 This function has two arguments atan2(#y,#x) - it yields arctan(#y/#x) in the range π...π
ARCCOT arccotangent
SINH hyperbolic sine
COSH hyperbolic cosine
TANH hyperbolic tangent

Bessel Functions

The following Bessel functions are supported:

BESJ(n,x) Bessel function Jn(x) of integer order n0 and real argument x.
BESY(n,x) Neumann function Yn(x) of integer order n0 and real argument x
BESI(n,x) Modified Bessel function of the first kind In(x) of integer order n0 and real argument x
BESK(n,x) Modified Bessel function of the second kind Kn(x) of integer order n0 and real argument x

Miscellaneous Functions

The following miscellaneous functions are supported:
Table 2. Miscellaneous functions
SQRT Square root
LOG Logarithm to base 10.
LN Natural logarithm
EXP Exponential function
ABS Absolute value
DEG Convert radians into degrees.
RAD Convert degrees into radians.
STEP Step function, STEP(x) = 0 for x0 and STEP(x) = 1 for x > 0.
CEIL Smallest integer value that is equal to or greater than the argument.
FLOOR Largest integer value that is equal to or smaller than the argument.
MAX Returns the largest of the two arguments — called as max(#a,#b).
MIN Returns the smallest of the two arguments — called as min(#a,#b).
FMOD This function has two arguments fmod(#a,#b) and returns the remainder of the division #a/#b.
RANDOM This function returns a random value in the range 0 . . . 1. If the argument X of RANDOM() is -1, then a random number is returned.

For any other argument X in the range 0 . . . 1 this value is used to set the seed, and then a random number is created using this seed. (Using the same seed allows one to create a deterministic and reproducible random number series). If RANDOM(-1) is called before any seed is set in the .pre file, then the returned values are random and not reproducible. (The internal seed is used based on the time when PREFEKO is executed).

Coordinate functions provide access to the individual X coordinate, Y coordinate and Z coordinate of a Cartesian coordinate in 3D space.

Coordinate Functions

The following coordinate functions are supported:
Table 3. Coordinate functions
X_COORD This function returns the X coordinate of a point previously defined by a DP card.
Y_COORD This function returns the Y coordinate of a point previously defined by a DP card.
Z_COORD This function returns the Z coordinate of a point previously defined by a DP card.
The X_COORD, Y_COORD and Z_COORD functions are used by passing the name of the point, in quotation marks, as an argument to the function. For example, the following code sets the parameter #x equal to 1.234.
DP   PNT01                    1.234     0.4567    #z
#x = x_coord("PNT01")