# Solving an Equation (Recursively)

I have the following Values: $a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=\frac{g_2}{20};a[5]=0$.

I need to compute the value of $b[n]$ in the following equation

$$a[n]=\sum _{m=0}^{n} (m-2) \;\;a[m] \;\;b[n-m]$$ where $n=0,1,2,3,4,5$.

For $n=0$, I get the value of $b[0]$.

For $n=1$, I get the value of $b[1]$ using the value of $b[0]$.

For $n$th iteration, I get the value of $b[n]$ using the values of $b[n-1],b[n-2],\dots,b[0]$.

The values of $b[n]$ will then be used to solve for another variable, say, $c[n]$, for $n=0,1,2,3,4,5$.

Is there any simple way of doing this in Mathematica? I am basically doing one iteration at a time (using the Solve command), which is very tedious.

-

a[0] = 1; a[1] = a[2] = a[3] = a[5] = 0; a[4] = g2/20;
funcs = Table[a[n] == Sum[(m - 1) a[m] b[n - m], {m, 0, n}], {n, 0, 5}]
var = b /@ Range[0, 5]
Solve[funcs, var]


-
Hi, Thanks. How do I then "call" these $b[n]$ values? I need to use these for another sum? –  Radz Jul 28 '14 at 14:18
soln = Solve[eqns, Array[b, 6, 0]] and then Evaluate[Array[b, 6, 0]] = Flatten[Array[b, 6, 0] /. soln] –  Wouter Jul 28 '14 at 16:09
Dear @Chenminqi, Thanks. –  Radz Jul 29 '14 at 1:09
Dear @Wouter, Thank you for your help. –  Radz Aug 11 '14 at 2:07
Evaluate[Array[a, 6, 0]]= {1, 0, 0, 0, c, 0};
eqns = Table[ a[n] == Sum[(m - 2) a[m] b[n - m], {m, 0, n}], {n, 0, 5}];
Solve[eqns, Array[b, 6, 0]]

{{b[0]->-(1/2),b[1]->0,b[2]->0,b[3]->0,b[4]->-c,b[5]->0}}
`
-
Hi, How do I then "call" these $b[n]$ values? I need to use these for another sum? –  Radz Jul 28 '14 at 14:18