I am trying to work with nested procedures, and I am getting weird results. Maybe I am going crazy, or I am doing something wrong, or this is just a bug.
I've reduced the problem to this:
> alpha := proc (c) return product(q^z+1, z = 0 .. c) end proc; beta := proc (c, t) return sum(alpha(-t-i, c-t-1-i), i = 0 .. 1) end proc;
> test := proc (c) return sum(betaformal(i, i-1), i = 0 .. 1) end proc; test(1); beta(0, -1); beta(1, 0);
> test := proc (c) return sum(beta(i, i-1), i = 0 .. 1) end proc; test(1);
So alpha and beta are procedures, the latter using the first.
Then test is first defined using a dummy "betaformal" procedure, it should be beta(0,-1)+beta(1,0)
beta(0,-1) is 4 +2*q according to him, and beta(1,0) should be 3
However, the last line returns 6+4*q for test(1).
How can this be?!