Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I write the following code of a recursion equation, but it can not work correctly.

   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],
share|improve this question

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

Your Answer


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.