Subject: how can I make a variable local inside "product"?
From: Robert Dodier
Date: Thu, 11 May 2006 09:02:20 -0600
Hello Fabrizio,
> test(n) := product(n+i,i,1,3);
> test(n-2*k) -> (n - 2 k + 1) (n - 2 k + 2) (n - 2 k + 3)
>
> but(!!!)
> test(n-2*i) -> (n - 3) (n - 2) (n - 1)
I don't think it's possible to automatically distinguish between
the i which you want to be a dummy variable and the i which
is something else. Yes, sum/product could always substitute
a gensym for i before evaluating the summand/productand,
but that would cause unpleasant surprises ...
my_expr : x^k / k!;
sum (my_expr, k, 0, 2);
=> 3 x^k / k! ?? I don't think we want this.
If you want to make sure that the sum/product index never
appears in the summand/productand, choose an unlikely
name for the index such as i% or something.
Hope this helps,
Robert