Logical/Conditional functions

<< Click to Display Table of Contents >>

Navigation:  Using SMILE Wrappers > Equations reference >

Logical/Conditional functions

And(b1,b2,...)

Returns the logical conjunction of the arguments, which are all interpreted as Boolean expressions. If any of the expressions evaluates to a zero, And returns 0. For example, And(1=1,2,3)=1, And(1=2,2,3)=0

Choose(index,v0,v1,...,vn)

Returns vi if index is equal to i. When index evaluates to a value smaller than 0 or larger than n-1, the function returns 0. Examples:

Choose(0,1,2,3,4,5)=1
Choose(4,1,2,3,4,5)=5
Choose(7,1,2,3,4,5)=0

If(cond,tval,fval)

If cond evaluates to non-zero return tval, fval otherwise, e.g., If(1=2,3,4)=4, If(1,5,10)=5

Max(x1,x2,...)

Returns the largest of the arguments xi. Examples:

Max(1,2,3,4,5)=5
Max(-3,2,0,2,1)=2

Min(x1,x2,...)

Returns the smallest of the arguments xi. Examples:

Min(1,2,3,4,5)=1
Min(-3,2,0,2,1)=-3

Or(b1,b2,...)

Returns the logical disjunction of the arguments, which are all interpreted as Boolean expressions. If any of the expressions evaluates to a non-zero value, Or returns 1. For example, Or(1=1,0,0)=1, Or(1=0,0,0)=0

Switch(x,a1,b1,a2,b2,...,[def])

If x=a1, return b1, if x=a2, return b2, when x is not equal to any of as, return def (default value), which is an optional argument. When x is not equal to any of as and no def is defined, return 0. Examples:

Switch(3,1,111,2,222,3,333,4,444,5,555,999)=333
Switch(8,1,111,2,222,3,333,4,444,5,555,999)=999
Switch(8,1,111,2,222,3,333,4,444,5,555)=0

Xor(b1,b2,...)

Returns logical exclusive OR of all arguments, which are all interpreted as Boolean expressions. Xor returns a 1 if the number of logical expressions that evaluate to non-zero is odd and a 0 otherwise.

Examples:

Xor(0,1,2,-3,0)=1
Xor(1,1,0,2,2)=0
Xor(-5,1,1,-2,2)=1