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 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.

Thanks, Radz.

share|improve this question

2 Answers 2

up vote 2 down vote accepted
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]

enter image description here

share|improve this answer
    
Hi, Thanks. How do I then "call" these $b[n]$ values? I need to use these for another sum? –  Radz Jul 28 at 14:18
1  
soln = Solve[eqns, Array[b, 6, 0]] and then Evaluate[Array[b, 6, 0]] = Flatten[Array[b, 6, 0] /. soln] –  Wouter Jul 28 at 16:09
    
Dear @Chenminqi, Thanks. –  Radz Jul 29 at 1:09
    
Dear @Wouter, Thank you for your help. –  Radz Aug 11 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}}
share|improve this answer
    
Hi, How do I then "call" these $b[n]$ values? I need to use these for another sum? –  Radz Jul 28 at 14:18

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.