userspark

5 Reputation

0 Badges

8 years, 161 days

MaplePrimes Activity


These are questions asked by userspark

The following procedure is intended to recursively generate all vectors in the set of n dimension vectors with elements 0 to p-1. If I use a fixed value for p it works fine, but as soon as I introduced p as an argument it gives the error "Error, (in F) invalid input: F uses a 2nd argument, n, which is missing".

F:=proc(p,n)
  if n=1 then:
    return [seq(Vector([x]),x=0..(p-1))];
  else:
    return [ seq(seq(Vector([v[],xn]),v in F(n-1)),xn=0..(p-1)) ];
  end if:
end proc:

F(3,2);

I cannot for the life of me figure out what is wrong with the above code? Can anyone enlighten me?

Thanks in advance for your help.

Page 1 of 1