Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to find generation function of recurrence sequence

ClearAll[c];
c[1] := 0;
c[2] := 1;
c[n_] := (2 + 2*(n - 2)*c[n - 2] + (n - 2) (n - 1) c[n - 1])/(n (n - 1));
Table[c[i], {i, 1, 15}] 
FindGeneratingFunction[%, x]

but Mathematica just output

FindGeneratingFunction[{0, 1, 2/3, 5/6, 4/5, 37/45, 52/63, 349/420, 338/405, 
                          873/14175, 14554/17325, 157567/187110, 466498/552825, 
                          11994551/14189175, 41582906/49116375}, x]

How I can find GeneratingFunction?

share

2 Answers 2

up vote 2 down vote accepted

Let y[x]=Sum[c[n]x^n,{n,0,Infinity}] be the generation function of c[n]. Then y[x] satisfys a 2rd order ODE (1-x)y''[x]-2xy'[x]-2/(1-x)==0. Try to find solution with DSolve and the result is

y[x] -> (1 + C[1] E^(-2x))/(1 - x) + C[2] - (2 C[1] ExpIntegralEi[2 - 2 x])/E^2

We have initial conditions y'[0]=c[1]=1, y''[0]=2c[2]=2*1=2. Thus,the undetermined coefficents(upper case "C") C[1] and C[2] will be obtained immediately by adding them to the DSolve function above.

However Mathematica returns

"DSolve::bvnul:For some branches of the general solution, the given boundary
conditions lead to an empty solution." 

That error massage means C[1] or C[2] can't be determined. This may be due to the value of c[0], c[1] and c[2]. Turn to the recurrence relation, then we get c[2]=(2+0*c[0]+0*c[1])/2=1.

That is to say, c[1] and c[0] can be any value!! No wonder that we can't find a proper solution to that ODE.

By the way, you will get a result of c[n] (a long long expression involved n) by inputing following command

RSolve[{c[n] == (2 + 2*(n - 2)*c[n - 2] + (n - 2) (n - 1) c[n - 1])/(n (n - 1)), 
        c[1] == 0, c[2] == 1}, c[n], n]
share
    
Thank you! I found it already math.stackexchange.com/questions/539078/… –  Филипп Цветков Oct 25 '13 at 11:07

I realise that it is not the answer for your question about generating function but it may help a little.

I will abuse the fact that you do not ask why. I have no experience with this area in Mathematica. But using documentation I was able to find a solution.

That's what is the best in Mathematica!

For your list, I've added an iterator so it will fit FindSequenceFunction

list = Table[{i, c[i]}, {i, 1, 15}] 

f = FindSequenceFunction[list]
DifferenceRoot[
    Function[{y, n}, 
             {-2 - 2*n*y[n] - n*(1 + n)*y[1 + n] + (1 + n)*(2 + n)*y[2 + n] == 0, 
             y[1] == 0, y[2] == 1}]]
 Array[f, 15] == Array[c, 15]
True
share
    
I didn't notice you hit 10k, congrats! –  rcollyer Oct 25 '13 at 14:13
    
@rcollyer I don't know why I have not seen your comment earlier :/ Thanks! :) –  Kuba Mar 12 at 9:50

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .