Question: Error code - what does it mean?

Can someone help me with figuring out what the following error means:

"Error, (in F) final value in for loop must be numeric or character"
 

I've obviously done something wrong but have no clue where to start!!

This comes up when i'm trying to plot a graph using the following code:

> restart:
> F:=proc(n)
> local x,k,B,p,q;
> uses Statistics, plots:
> x[0]:=0: x[1]:= 1:
>   for k from 2 to n do
>   B:=2*(Sample(Bernoulli(0.5),2)-<0.5,0.5>):        #create list [p,q] where p &q are +1 or -1 with probability 1/2
>   p:=B[1]: q:=B[2];                                                        #assign p & q
>   x[k]:=p*x[k-1]+q*x[k-2];
> od;
> end:
>
> S:= n-> abs(F(n))^(1/n);

                                                    (1/n)
                       S := n -> | F(n) |

> S(10);

                             1.292392221

> plot(S(n),n=1..10);
Error, (in F) final value in for loop must be numeric or character

Thanks

 

Please Wait...