# Logical and Mathematical Operators

Logical operations are supported and a specific order of precedence is followed.

PREFEKO allows the use of logical operations. It supports the function NOT() that returns TRUE if the argument is FALSE and FALSE when the argument is TRUE. PREFEKO also supports the delimiters >, <, >=, <=, =, <>, AND and OR. When boolean operations are applied to variables, a value of 0 is taken as FALSE and everything else is interpreted as TRUE. Similarly, in the result of a logical operation, FALSE is mapped to 0 and TRUE to 1.

- single number, expressions in brackets
- function calls
- + and - (when used as a sign)
- ^
- * and /
- + and -
- >, <, >= and <=
- = and <>
- AND
- OR

`#!x`,

`#!y`and

`#!z`that are useful for the connection of complex wire structures. The three variables specify the Cartesian coordinates of the end point of the wire segment most recently defined. This enables the correct and easy connection of a straight wire to a curved length of wire, as the next extract from an input file demonstrates:

```
CL .....
DP A #!x #!y #!z
#z = #!z + 0.5
DP B #!x #!y #z
BL A B
```

```
** A dielectric sphere in the field of an incident wave
** Define the variables
#r = 1 ** Radius of the sphere
#betrad = 1 ** Electrical size of the sphere
#epsr = 15 ** The relative dielectric constant
#maxlen = 0.7 ** The maximum edge length
** Define segmentation parameters
IP #maxlen
** The corner points
DP A 0 0 0
DP B 0 0 #r
DP C #r 0 0
** Select the medium
ME 1 0
** Generate an eighth of the sphere
KU A B C 0 0 90 90 #maxlen
** Use symmetry in all three coordinate planes
** yz-plane: ideal electrically conducting plane
** xz-plane: ideal magnetically conducting plane
** xy-plane: only geometrically symmetric
SY 1 2 3 1
** End of the geometry
EG 1 0 0 0 0
** Assigning the dielectric's properties
DI #epsr 1.0
** Incident plane wave excitation
#freq = #betrad * #c0/(2*#pi*#r)
FR 1 0 #freq
A0 0 1 1 1.0 0.0 -180.0
** Near fields along the Z axis
FE 1 1 1 25 0 0.0 0.0 -1.98 0.0 0.0 0.04
FE 4 1 1 50 0 0.0 0.0 -0.98 0.0 0.0 0.04
FE 1 1 1 25 0 0.0 0.0 1.02 0.0 0.0 0.04
** End
EN
```

The use of variables makes the investigation of structures with varying geometry (such as the variable distance of the antenna in front of a reflector) an easy process, because only one variable (the distance parameter) needs to be changed. It also allows FOR loops and IF conditions.