MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with RSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62722] Re: Problem with RSolve
  • From: Maxim <m.r at inbox.ru>
  • Date: Fri, 2 Dec 2005 05:53:30 -0500 (EST)
  • References: <dmlvb5$m5j$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I believe this is related to the bug in Sum:

In[1]:=
Sum[k^2*Log[k], {k, n}]

Out[1]=
-(13/18) - (23*n)/12 - (19*n^2)/12 - (7*n^3)/18 + Log[Gamma[1 + n]]  
+ 2*n*Log[Gamma[1 + n]] + n^2*Log[Gamma[1 + n]] - Log[Gamma[2 + n]] -  
2*n*Log[Gamma[2 + n]] - n^2*Log[Gamma[2 + n]] + Zeta[3]/(4*Pi^2)  
+ Derivative[1, 0][Zeta][-2, 2 + n]

Evidently RSolve takes this incorrect result and adds 13/18 to satisfy the  
initial condition. Summation or integration often works better for the  
general case:

In[2]:=
Sum[k^p*Log[k], {k, n}] /. p -> 2

Out[2]=
Zeta[3]/(4*Pi^2) + Derivative[1, 0][Zeta][-2, 1 + n]

This is also the correct value for c[n]. It is easy to see where the  
derivative comes from if we consider that k^p*Log[k] == D[k^p, p] and  
Sum[k^p, {k, n}] == HarmonicNumber[n, -p]. Incidentally, Mathematica gets  
the sign of the derivative of HarmonicNumber wrong:

In[3]:=
D[HarmonicNumber[n, -p], p] /. p -> 2

Out[3]=
-(Zeta[3]/(4*Pi^2)) - Derivative[1, 0][Zeta][-2, 1 + n]

The leading term in the asymptotic expansion of Zeta[p, n] is n^(1 - p)/(p  
- 1) and Derivative[1, 0][Zeta][p, n] is asymptotic to -n^(1 -  
p)*Log[n]/(p - 1). Hence c[n] is asymptotic to n^3*Log[n]/3, which I  
suppose also can be seen by applying the Euler-Maclaurin formula to  
Sum[k^2*Log[k], {k, n}] directly.

This can also be checked numerically, but here we have another  
illustration of the fact that we cannot trust Mathematica's significance  
arithmetic when evaluating special functions for very large values of the  
arguments, very close to singularities, etc. and especially when  
evaluating derivatives:

In[4]:=
N[Derivative[1, 0][Zeta][-2, 10^100], 100]

Out[4]=
5.1756291918918863991247522345022089269714293900735639116077545366824429242649554860756394743197164109477252732114`100.*^305

All the digits here are incorrect.

Maxim Rytin
m.r at inbox.ru


On Thu, 1 Dec 2005 04:48:37 +0000 (UTC), Bob Hanlon <hanlonr at cox.net>  
wrote:

> $Version
>
> 5.2 for Mac OS X (June 20, 2005)
>
> Clear[a,c,n];
>
> a[0]=0;
> a[n_Integer?Positive]:=
>     a[n]=a[n-1]+(n^2) Log[n];
>
> Table[a[n],{n,0,5}]//Simplify
>
> {0, 0, Log[16], Log[314928], 9*Log[3] + 16*Log[4] + Log[16],
>   9*Log[3] + 16*Log[4] + 25*Log[5] + Log[16]}
>
> RSolve gives a wrong result
>
> soln=c[n]/.
>     (RSolve[{c[n]==c[n-1]+(n^2) Log[n],
>               c[0]==0},c[n],n]//
>           Flatten//FullSimplify)
>
> Log[Gamma[n + 1]]*(n + 1)^2 - Log[Gamma[n + 2]]*(n + 1)^2 -
>   (1/36)*n*(n*(14*n + 57) + 69) + Derivative[1, 0][Zeta][-2,
>    n + 2] + Zeta[3]/(4*Pi^2)
>
> Table[soln,{n,0,5}]//FullSimplify
>
> {0, -(35/9), -(239/18) + Log[16], -(61/2) + Log[314928],
>   -(521/9) + 36*Log[2] + 9*Log[3], -(880/9) + 36*Log[2] +
>    9*Log[3] + 25*Log[5]}
>
>
> Bob Hanlon
>
>>
>> From: Jean Guillaume Pyraksos <wissme at hotmail.com>
To: mathgroup at smc.vnet.net
>> Date: 2005/11/30 Wed AM 05:40:43 EST
>> Subject: [mg62722]  Problem with RSolve
>>
>> I can't get this one solved, can you help ?
>>
>> RSolve[{c[n] == c[n - 1] + (n^2) Log[n], c[0] == 0}, c[n], n]
>>
>> I am interested in the principal part of c[n], which should be 1/2 n^2
>> Log[n]^2 ?...
>>
>> Thanks, using Mathematica 4.1.0.0
>>
>>    JG
>>
>>
>


  • Prev by Date: Re: Problem with RSolve
  • Next by Date: Re: 3D Plot of frequency data
  • Previous by thread: Re: Problem with RSolve
  • Next by thread: Visualization site updates