跳转到内容

This page is also in English.

Read it in English

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

indicator 函数

把条件表示为数:为真时为 1,为假时为 0。

怎么写

indicator(condition)

condition
一个真或假的条件,例如 x > 0。接受一个条件,真或假。

示例

  • indicator⁡(1<2)=1\displaystyle \operatorname{indicator}(1 < 2) = 1
    indicator(1 < 2)

    在求解器中,indicator(1 < 2) 的结果是 1。

    在求解器中打开
  • piecewise

    按条件写出的分段取值,写作 value if condition,并可带一个 otherwise 分支。

  • increment

    将变量原地加 1,并返回它的旧值。

  • pre_decrement

    将变量就地减 1,并返回新值。

  • ifelse

    由测试条件选出的值。

  • pre_increment

    把变量原地加 1 并返回新值。

  • function

    没有名字的函数;也可写作 x => body。