Template:choose

From LifeWiki
Jump to navigation Jump to search

{{choose}} is a template for expressing binomial choose functions with vertically-displaced numerators and denominators. Parameters:

  • n (first): the numerator
  • k (second): the denominator
  • l (third): the left bracket
  • r (fourth): the right bracket

For instance, <tt>{{sum|k{{=}}0|n|{{choose|n|k}}*x<sup>k</sup>*y<sup>n-k</sup>}}=(x+y)<sup>n</sup></tt> becomes ∑nk=0((nk)*xk*yn-k)=(x+y)n.

The ability to change brackets is intended to enable other choose-like functions such as Knuth's notation for the Stirling numbers , so one could write n!k!*(nk) = ∑ni=k({ik}*[n+1i+1]) or (nk) = ∑ni=k((-1)i-k*[ni]*{n+1i+1})

(nk)2 = ∑ni=0((-1)i * (2*n+1i) * (n+k-ik-i)2)