# Solve a recurrence relation with four coefficients via Do loop?

I have the following recurrence relation: $B_j=-\frac{1}{4 j (j+n)} ((4(j+λ1-1) (j+λ1-2)+A_1) B_{j-1}+A_2 B_{j-2}+A_3 B_{j-3}+A_4 B_{j-4}),\, n>0$

with initial condition $B_0=1$. (This has arisen form the solution of an ODE with Frobenius method and $λ1$ is the first root of the indicial equation). What i want to do is to create a vector with i.e.$j=20$ elements and somehow within a Do loop compute analytically the first 20 coefficients $B_j$. I am a rookie in Mathematica and have some problems in understanding how to do it. Can anyone help?

I have already used the RSolve command but this premises to know three more initial conditions $B_1,B_2$ and $B_3$. To find these initial conditions we first have to employ the recurrence relation three times by hand. What i am aware of is to build a routine (loop) that will repeatedly calculate the coefficients for $(j,1,j_{max})$ with the only known initial condition: $B_0=1$.

• Consider looking at RSolve[]. – J. M. will be back soon Jan 24 '17 at 10:51
• Solving Recurrence Equations tutorial in the documentation. – Edmund Jan 24 '17 at 11:37
• Are you not missing some conditions? – zhk Jan 24 '17 at 12:19

As suggested by J. M., RSolve is the appropriate built-in function to use for such problems.
Deq = B[j] == -1/(j*(j + n))*((4*(j + lambda1 - 1)*(j + lambda1 - 2) +