Rewrite Rulesbase/choose-to-binom

base/choose-to-binom

Rewrite infix choose to an explicit binom command.

Rewrite patterns#

  1. #1 \choose #2\binom{#1}{#2}

Examples#

Each example shows this rule applied in isolation. A complete normalization profile may make additional changes.

Offset binomial#

Before

n+r-1 \choose 2k+1

After this rule

\binom{n+r-1}{2k+1}

Rendering verified with the declared packages.

Binomial coefficient in product#

Before

P(X=k)={n \choose k}p^k(1-p)^{n-k}

After this rule

P(X=k)=\binom{n}{k}p^k(1-p)^{n-k}

Rendering verified with the declared packages.

Same family#

Disable this rule#

TransformEngine(profile="corpus", disable_rules=["base/choose-to-binom"])
new TransformEngine({ profile: 'corpus', disableRules: ['base/choose-to-binom'] })

Open in Playground