indicator function
A condition as a number: 1 when it is true and 0 when it is false.
How to write it
indicator(condition)
- condition
- A condition that is true or false, such as x > 0. Takes a condition, true or false.
Examples
indicator(1 < 2)In the solver,
Open in the solverindicator(1 < 2)gives1.
Related functions
- piecewise
Cases written value if condition, with an optional otherwise case.
- increment
Add 1 to a variable in place and return its old value.
- pre_decrement
Subtract 1 from a variable in place and return the new value.
- ifelse
A value chosen by a test.
- pre_increment
Add 1 to a variable in place and return the new value.
- function
A function with no name; also written x => body.