Re: Problem with RSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg62716] Re: [mg62670] Problem with RSolve
- From: Devendra Kapadia <dkapadia at wolfram.com>
- Date: Fri, 2 Dec 2005 05:53:18 -0500 (EST)
- References: <200511301040.FAA07294@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Wed, 30 Nov 2005, Jean Guillaume Pyraksos wrote: > 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 > Hello Jean, Thank you for reporting this problem with RSolve involving the inhomogeneous term n^2*Log[n], in Mathematica 4.1. As noted by others, the answer given by Mathematica 5.2 is also incorrect. There appears to be no general workaround for the problem, but the following informal method seems to produce a symbolic solution for the problem considered by you. We begin by using the recursion relation to define a function c[n]. ========================================= In[1]:= $Version Out[1]= 5.2 for Linux (June 27, 2005) In[2]:= c[0] = 0 Out[2]= 0 In[3]:= c[n_] := c[n - 1] + n^2*Log[n] ========================================= Here is a list of the numerical values of c[n] for n = 0 to 8. ======================================= In[4]:= c[0] Out[4]= 0 In[5]:= c[1] Out[5]= 0 In[6]:= t1 = Table[c[n], {n, 2, 8}]; In[7]:= N[t1] Out[7]= {2.77259, 12.6601, 34.8408, 75.0768, 139.58, 234.93, 368.014} ====================================== Since the problematic answer appears to be caused by the Log term, we note the following property of n^(2+k) (its derivative with respect to k at k = 0 is n^2*Log[n]). ===================================== In[8]:= D[n^(2+k), k] 2 + k Out[8]= n Log[n] In[9]:= %/.{k-> 0} 2 Out[9]= n Log[n] ==================================== Hence, we solve a difference equation with unknown function d[n] and inhomogenous term n^(2+k). ===================================== In[10]:= RSolve[d[n] == d[n - 1] + n^(2 + k) , d, n] Out[10]= {{d -> Function[{n}, C[1] + Zeta[-2 - k] - Zeta[-2 - k, 1 + n]] ==================================== This allows us to define the function c1[n] given below as a solution for the original difference equation. =================================== In[11]:= c1[n_] = (D[d[n] /. %[[1]], k]) /. {k -> 0} Zeta[3] (1,0) Out[11]= ------- + Zeta [-2, 1 + n] 2 4 Pi ================================== The numerical values of c1[n] seem to agree quite well with those obtained for c[n]. =================================== In[12]:= c1[0]//FullSimplify Out[12]= 0 In[13]:= c1[1]//FullSimplify Out[13]= 0 In[14]:= t2 = Table[c1[n], {n, 2, 8}]; In[15]:= N[t2] Out[15]= {2.77259, 12.6601, 34.8408, 75.0768, 139.58, 234.93, 368.014} In[16]:= Max[Abs[N[t1-t2]]] -10 Out[16]= 3.53827 10 ================================================ Hope this helps. Sorry for the inconvenience caused by the problem with RSolve. Sincerely, Devendra Kapadia, Wolfram Research, Inc.