Recurrence



Hi,
perhaps this will help you?

(%i2) x[0]: 2$
(%i3) x[1]: s$
(%i4) x[n] := expand (s*x[n-1]-p*x[n-2]);
(%o4) x[n]:=expand(s*x[n-1]-p*x[n-2])
(%i5) makelist(x[n],n,0,4);
(%o5) [2,s,s^2-2*p,s^3-3*p*s,s^4-4*p*s^2+2*p^2]

If it doesn't, I apologize in advance. Before going to your second 
example, you need to do "kill(x)" to
clean up the array you created.
Regards,
Jaime

On 05-12-2013 11:43, Ricardo JF wrote:
> hi friends,
> i would like some help.
>
> How can i make a recorrence list like this:
>
> x[n+2]-s*x[n+1]+p*x[n]=0  with x[0]=2,x[1]=s
>
> output like this:
> [x[0],x[1],x[2],...]
> [2,s,s^2-2p,...]
>
> ...
> x[n+3]-a*x[n+2]+b*x[n+1]-c*x[n]=0  with x[0]=3,x[1]=s
> [x[0],x[1],x[2],...]   ?
> ....
>
> i know that there's  .... load(solve_rec); solve_rec...
>