Re: Problem with the Sum Function -- Using a Benford Distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg66872] Re: [mg66838] Problem with the Sum Function -- Using a Benford Distribution
- From: Devendra Kapadia <dkapadia at wolfram.com>
- Date: Fri, 2 Jun 2006 04:08:52 -0400 (EDT)
- References: <200606011054.GAA20562@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Thu, 1 Jun 2006, Richard Palmer wrote:
>
>
> (* define a PDF*)
> f = Log[10, 1 + 1/d]
>
>
> (* compute for various values of the parameter *)
> Table[Apply[Plus, Table[f, {d, 10 ^ h, 10 ^ (h + 1) - 1}]], {h, 0, 4}]// N
>
>
> (* the mean is well defined *)
> Table[ Apply[Plus, Table[d Log[10, 1 + 1/d], {d, 10^h, 10^(h + 1) - 1}]] //N,
> {h, 0, 4}]
>
> (* here is a parametric formula for the mean *)
> mean =Assuming[k \[Element] Integers && k ? 0, Sum[d Log[10, 1 + 1/d], {d,
> 10^k, 10^(k + 1) - 1}]] // FullSimplify
>
> (* the formula appears to be wrong *)
> Table[N[mean], {k, 0, 4}]
>
>
Hello Richard,
Thank you for reporting the problem with computing the logarithmic
sum above.
For examples of this type, the Sum function works by replacing
Log[expr] with expr^m, followed by differentiation, since:
===========================
In[1]:= $Version
Out[1]= 5.2 for Linux (June 27, 2005)
In[2]:= D[expr^m, m]
m
Out[2]= expr Log[expr]
==========================
The final answer is obtained using a limiting process to set 'm'
equal to 0. The incorrect answer in your example occurs at this
stage.
One possible workaround is to use the procedure outlined above
to compute the expression Mean1 given in Out[4] below.
=================================
In[3]:= s1 = Sum[d*((d + 1)^m/Log[10]), {d, 10^k, 10^(k + 1) - 1}] -
Sum[d*(d^m/Log[10]), {d, 10^k, 10^(k + 1) - 1}];
In[4]:= (Mean1 = D[s1, m] /. {m -> 0}) // InputForm
Out[4]//InputForm=
-((-Derivative[1, 0][Zeta][-1, 10^k] + Derivative[1, 0][Zeta][-1,
10^(1 + k)])/Log[10]) + (-Derivative[1, 0][Zeta][-1, 1 + 10^k] +
Derivative[1, 0][Zeta][-1, 1 + 10^(1 + k)] + Derivative[1, 0][Zeta][0,
1 + 10^k] - Derivative[1, 0][Zeta][0, 1 + 10^(1 + k)])/Log[10]
In[5]:= Table[Mean1, {k, 0, 4}] // N // Chop
Out[5]= {3.44024, 38.5898, 390.365, 3908.15, 39086.}
In[6]:= Table[N[Plus @@ Table[d*Log[10, 1 + 1/d], {d, 10^h, 10^(h + 1) -
1}]], {h, 0, 4}]
Out[6]= {3.44024, 38.5898, 390.365, 3908.15, 39086.}
=================================
I apologize for the inconvenience caused by this problem.
Sincerely,
Devendra Kapadia,
Wolfram Research, Inc.
- References:
- Problem with the Sum Function -- Using a Benford Distribution
- From: Richard Palmer <mapsinc@bellatlantic.net>
- Problem with the Sum Function -- Using a Benford Distribution