re: About RSolve
- To: mathgroup at yoda.physics.unc.edu
- Subject: re: About RSolve
- From: Paul=Rubin%Management%Business at banyan.cl.msu.edu
- Date: Thu, 26 May 94 13:10:05 EDT
Keehong Song wrote: >I need help!!! >I tried to find the general formula for p[n] using Mathematica. >I used "RSolve" package as well as eigenvalue method. >The answer is supposed to be n!/n^n. > >======== Problem is following ======== >p[n_] := ((n-1)/n)^(n-1) p[n-1] >p[1] = 1 >====================================== It seems to take more cleverness than one would like (i.e., Mma is not doing enough of the intellectual work IMHO). Try working with lp[n] = Log[ p[n] ]. In[]:= sol = RSolve[ {lp[n] == (n-1) Log[(n-1)/n] + lp[n-1] /; n>=2, lp[1] == 0}, lp[n], n ] Out[]= {{lp[n] -> 1 + K[1] Sum[Log[--------], 2 + K[1] {K[1], -If[DiscreteMath`RSolve`Private`pom == 0, 0, 0], -2 + n}] + 1 + K[2] Sum[K[2] Log[--------], {K[2], 0, -2 + n}]}} 2 + K[2] RSolve solves the equation, although there is an If in the solution that is rather pointless. The following fixes that: In[]:= sol = sol /. If[a_, 0, 0] -> 0 Out[]= {{lp[n] -> 1 + K[1] Sum[Log[--------], {K[1], 0, -2 + n}] + 2 + K[1] 1 + K[2] Sum[K[2] Log[--------], {K[2], 0, -2 + n}]}} 2 + K[2] Note that the two sums both telescope and give the right value for lp[n] (Log[ (n-1)!/n^(n-1) ]), although I don't know how to convince Mma to do that without explicitly making all the substitutions and reductions yourself. So this is not a fully satisfactory answer. ************************************************************************** * Paul A. Rubin Phone: (517) 336-3509 * * Department of Management Fax: (517) 336-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * **************************************************************************