spif


Purpose
To obtain a certain value depending on the condition.
Synopsis
spif(cn: sprandexp, r1: real, r2: real): sprandexp
spif(cn: sprandexp, r: real, rn: sprand): sprandexp
spif(cn: sprandexp, r: real, re: sprandexp): sprandexp
spif(cn: sprandexp, rn: sprand, r: real): sprandexp
spif(cn: sprandexp, rn1: sprand, rn2: sprand): sprandexp
spif(cn: sprandexp, rn: sprand, re: sprandexp): sprandexp
spif(cn: sprandexp, re: sprandexp, r: real): sprandexp
spif(cn: sprandexp, re: sprandexp, rn: sprand): sprandexp
spif(cn: sprandexp, re1: sprandexp, re2: sprandexp): sprandexp
Arguments
1st argument 
stochastic boolean condition
2nd argument 
if cn is evaluated to true, this value is returned as a random expression
3rd argument 
otherwise this value is returned as a random expression
Example
assuming sr1, sr2, and sr3 are of type sprand, and sre is of type sprandexp, following is a valid call
sre:=spif(sr1<=3 and sr1>=sr2^sr3, 1, maximum(sr2,ceil(sr1)))
   
Further information
1. Relational operators: {Maths/leq.png, Maths/geq.png, =}, or logical operators: {and, or}, may be combined with types: {integers, reals, sprands, sprandexps} to create boolean stochastic random expressions.
2. spif() may also be used for modeling conditional stochastic functions.
Related topics
maximum, minimum, abs, ceil, exp, floor, ln, round


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.