Re: sum of binomials .. bug ?
- To: mathgroup at smc.vnet.net
- Subject: [mg70561] Re: sum of binomials .. bug ?
- From: Peter Pein <petsie at dordos.net>
- Date: Thu, 19 Oct 2006 03:23:30 -0400 (EDT)
- References: <eh20si$2ms$1@smc.vnet.net> <eh4oes$885$1@smc.vnet.net>
dimmechan at yahoo.com schrieb:
> There is not a bug at all.
> Be more careful before accused Mathematica of bugging.
> I do not say that it is panacea but Most of the cases when
> someone thinks he encountered a bug the fault is due to him.
>
> Any way for your case the following will demonstrate that indded
> there is no bug. (Everything is in InputForm).
>
> Quit
>
> f[k_] := Sum[Binomial[21 - k, i], {i, 0, 10 - k}]
>
> Trace[f[3], Binomial]
> {{HoldForm[Binomial[18, 0]], HoldForm[1]}, {HoldForm[Binomial[18, 1]],
> HoldForm[18]}, {HoldForm[Binomial[18, 2]], HoldForm[153]},
> {HoldForm[Binomial[18, 3]], HoldForm[816]}, {HoldForm[Binomial[18, 4]],
>
> HoldForm[3060]}, {HoldForm[Binomial[18, 5]], HoldForm[8568]},
> {HoldForm[Binomial[18, 6]], HoldForm[18564]},
> {HoldForm[Binomial[18, 7]], HoldForm[31824]}}
>
> Trace[f[x] /. x -> 3]
>
> {{HoldForm[f[x]], HoldForm[Sum[Binomial[21 - x, i], {i, 0, 10 - x}]],
> HoldForm[2^(21 - x)]}, HoldForm[2^(21 - x) /. x -> 3], HoldForm[2^(21
> - 3)],
> {{HoldForm[-3], HoldForm[-3]}, HoldForm[21 - 3], HoldForm[18]},
> HoldForm[2^18],
> HoldForm[262144]}
>
> g[k_] = Sum[Binomial[21 - k, i], {i, 0, 10 - k}]
> 2^(21 - k)
>
> g[3]
> 262144
>
> g[x] /. x -> 3
> 262144
>
This does not explain, why g reduces to the wrong 2^18:
In:= Table[Binomial[18,i],{i,0,7}]//Tr
Out=63004