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 write the following code of a recursion equation, but it can not work correctly.

RSolve[{
   a[0]==(1-p)a[n],
   For[i=1,i<=n-1,i++,a[i]==p a[n-i+1]+(1-p)a[n-i]],
   a[n]==a[0]+p a[1],
   Sum[a[k],{k,0,n}]==1},
a[n],n]
share|improve this question
add comment

1 Answer 1

First of all, your problem is not a recursion equation.

It is more reasonable to consider it as a system of simultaneous equations.

The main point is that your problem has the fixed number of a[n].

Try to manipulate n number of equations you described.

You can get

a[0]== a[0]

a[1]== a[2]== ... == a[n-1] == a[n] == a[0]/(1-p)

Thus, Sum[a[k],{k,0,n}]==(n-p)a[0]/(1-p) == 1 Finally, a[0]== (1-p)/(n-p).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.