Formulae and Functions
Formulae can be entered as substitutes for specific values into most fields in EMarket to control the derivation of variable values at run time. A formula can contain any combination of:
- Constants
- Variables
- Operators
- Entities and Traits
- Functions
Constants
Constants can be:
- Numbers: Integers or Reals (e.g. 1, 2.5, -3), they can also be entered in scientific notation e.g. '3E+10'.
- Strings: Written inside double quotes e.g. "A Node"
- Dates: Must be enclosed in single quotes e.g '1/3/2004' or '14 April 2005'
Warning: The format for entering dates should compatible with the computer's local date (locality) setting
Variables
Variables can be regarded as user-defined Entity.Traits which can be defined in the Volatility Matrix or the Schedule. Previously defined variables can be used in formulae.
Note: EMarket provides a 'system' variable the user need not define: 'DateTime' which is of type 'Date' and gives the current simulation date as the model runs.
Operators
Operators are all pre-defined in EMarket. Their purpose is to separate a formula into parts that are then combined to give a single value.
The following operators are shown in descending order of precedence.
Operator | Meaning | Example | Parameter Type | Return Type |
---|---|---|---|---|
\ | Integer Division | 3\2 = 1 | Real; Int | Int |