Appendix 1: Formula Input#
When formula input is specified, enter functions as formulas. The final function definition in an input must define the function used by that input. The input format resembles C/C++. The rules are described below.
- Comment Lines
A comment line begins with
*.
- Formula Separators
Use
;(a semicolon) to separate formulas. Multiple formulas may appear on one line, and a formula may span multiple lines.
- End of Formula Input
End formula input with
;;(two semicolons).
- Constants
Constants are signed or unsigned integer constants and floating-point constants. Do not include spaces within a constant.
Examples:
123,-123,123.,0.123,1.23e4,-1.23e-4,1.23E04,-1.23E+004Not supported:
1.23+5,1.23d5,1.23D-5,1.23 e-4
- Variables
A variable is a contiguous string beginning with an alphabetic character (uppercase or lowercase). Variable names are case-sensitive and may contain digits. No special characters other than
_(underscore) are allowed. Use no more than 19 characters.PIis reserved for the circular constant.Examples:
ABC,abc,Abc,A123,a123,a_123Not supported:
1abc,a-123,abc#123
- Expressions
The following standard expressions are available. Operator precedence follows the usual rules. Operands are constants, variables, and functions.
+: addition-: subtraction*: multiplication/: division (performed using real-number values)**: exponentiation(): grouping with parentheses
Examples:
a+b-c*d/e,-a*(b + c)**d,2**-5Not supported:
(-2.)**5.
- Library Functions
The following library functions are available. Their definitions and domains are the same as in the C/C++ language standard. When using these functions, ensure that their arguments are within the applicable domains.
Available functions:
sin,cos,tan,asin,acos,atan,atan2,sinh,cosh,tanh,asinh,acosh,atanh,sqrt,exp,log,log10
- Assignment Statements
The left-hand side is a variable, and the right-hand side is a constant or an expression. Except for variables designated as input variables, all variables must have been assigned a value before this assignment statement.
Examples#a=1.23; b=sin(a*PI/180);
Function Definition Domain
You can define the variable range of a function as follows. Use
<(less than) and<=(less than or equal to) in range definitions.>and>=are not supported. The value is zero outside the defined range. You can add together piecewise-defined functions.Example 1#[x<-10] f1(x)=5*x; [-10<=x<=10] f2(x)=10*x**2; [10<x] f3(x)=x**3; f(x)=f1(x)+f2(x)+f3(x);;
Example 2#a=5; b=10; [a<=x][b<y] f(x,y)=x*y;;