# Tag Info

4

xint should have a binomial function but I forgot to include it in the last release. Here is one way in the meantime: The update has permuted the order of presentation, as testing proved that the simpler approach using the built-in factorial was significantly faster except for cases with a small #2. \documentclass{article} \usepackage{xintexpr}% at least ...

3

You can use the powerful apnum macros. \documentclass{article} \input apnum \def\binom#1#2{{\evaldef\n {#1} \evaldef\k {#2}% \evaldef\X {\FAC{\n}/(\FAC{\k}*\FAC{\n-\k})}\X}} \begin{document} \binom{2^4-3}{2^3} \end{document} Note that apnum can also be used in plain TeX, because it does use only TeX primitives. (And also note the joke message ...

3

The problem is that \gla splits its input at spaces before doing expansions. However, no number of \expandafter's can solve the problem, because TeX can't know where \exnull will appear. You can fully expand the line before the scanning for spaces happens, but this can have adverse effects: beware and remember to add \protect when necessary. ...

1

You could use bigintcalc: \documentclass{article} \usepackage{bigintcalc} \newcommand{\bigintcalcBinomial}[2]{% \bigintcalcDiv {\bigintcalcFac{#1}} {% \bigintcalcMul {\bigintcalcFac{#2}} {\bigintcalcFac{\bigintcalcSub{#1}{#2}}}% }% } \begin{document} ...

Only top voted, non community-wiki answers of a minimum length are eligible