Question: triple some symbolically

With f := i->`if`(i = 0, 1, alpha), I'd like to evaluate expression A below entirely symbolically, i.e. with l=1..3 being replaced with l=1..h in

sum('sum(sum(f(i)*f(i+j), i = 0 .. l-1), j = 1 .. h-l)', l = 1 .. 3); subs(alpha = .3, h = 3, %);#A

but using  A with l= 1 .. h provides a different number, the one one obtains with

sum(sum(sum(f(i)*f(i+j), i = 0 .. l-1), j = 1 .. h-l), l = 1 .. h); subs(alpha = .3, h = 3, %); #B

Expressions A provides the required value, but how do I evaluate this triple some in general:

Sum(Sum(Sum(w(i)*w(i+j), i = 0 .. l-1), j = 1 .. h-l), l = 1 .. h),
where w(0)=1 and w(j)=alpha, j=1,2,... Thanks.

Please Wait...