MathGroup Archive 2009

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

Search the Archive

Re: Trying to get closed form solution to simple recurrence.

negatron wrote:
> Product[(100 - n)/100, {n, 1, x}]
> ((100!/(100 - (x + 1))!)*(1/100)^(x + 1))
> So the two above are equivalent (perhaps the second can do with less
> brackets).
> What I'm trying to figure out is how to get Mathematica to solve such
> a problem. That is, input the first expression and get the second.
> I'm aware of the RSolve function and I've used it in the past, but I
> can't seem to figure out a way how to express this properly, or more
> likely it doesn't look like such a problem can be solved by this
> particular function.
> Is such a thing solvable by any function in Mathematica?

It seems RSolve does not handle this directly. A workaround is to take 
logs, use RSolve on that, and exponentiate.

rsol = RSolve[{
   fl[n]==Log[100-n]-Log[100]+fl[n-1], fl[1]==Log[99/100]}, fl[n], n];

In[30]:= InputForm[f[n] = Exp[fl[n]/.First[rsol]]]
Out[30]//InputForm= (-1/100)^(1 + n)*Pochhammer[-100, 1 + n]

In[31]:= InputForm[fnew = FunctionExpand[f[n],
   (-1)^(2*n)*2^(95 - 2*n)*25^(11 - n))/Gamma[100 - n]

Notice that we have an factor of (-1)^(2*n) which "obviously" is one. I 
do not use simplification at this point because it is easier to see this 
is equivalent to the desired form, at least once you see that form 

In[40]:= InputForm[gg = ((100!/(100 - (n + 1))!)*(1/100)^(n + 1))]
839075329261976769165978884198811117*2^(95 - 2*n)*25^(11 - n))/(99 - n)!

In[41]:= FullSimplify[fnew-gg, Assumptions->Element[n,Integers]]
Out[41]= 0

Notice that Product already will handle the original input.

In[4]:= InputForm[Product[(100 - j)/100, {j,1,n}]]
Out[4]//InputForm= (-1/100)^n*Pochhammer[-99, n]

If you use FunctionExpand it will give the form to which gg evaluates, 
along with the (unfortunate, needless) factor of (-1)^(2*n). You can get 
rid of it by using Simplify[...,Assumptions->Element[n,Integers]].

Daniel Lichtblau
Wolfram Research

  • Prev by Date: Copy error message from messages window to clipboard?
  • Next by Date: Re: Wolfram|Alpha Lookup Tool for Mathematica
  • Previous by thread: Trying to get closed form solution to simple recurrence.
  • Next by thread: no Condition in EventHandler?