how can I make a variable local inside "product"?



Am 11 May 2006 um 16:51 hat Albert Reiner geschrieben:

> ,----
> | (%i1) t1(n) := product(n+i,i,1,3) $
> | 
> | (%i2) t1(j);
> | 
> | (%o2)                       (j + 1) (j + 2) (j + 3)
> | (%i3) t1(i);
> | 
> | (%o3)                       (i + 1) (i + 2) (i + 3)
> | (%i4) t1(n-2*i);
> | 
> | (%o4)              (n - 2 i + 1) (n - 2 i + 2) (n - 2 i + 3)
> `----
> 
> This is on:
> 
> ,----
> | Maxima version: 5.9.2
> | Maxima build date: 14:19 12/26/2005
> | host type: i686-redhat-linux-gnu
> | lisp-implementation-type: CMU Common Lisp
> | lisp-implementation-version: Snapshot 2005-11 (19C)
> `----

Interesting! 

Maxima 5.9.3 http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (aka GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1) t1(n) := product(n+i,i,1,3) $
(%i2) t1(j);
(%o2) 			    (j + 1) (j + 2) (j + 3)
(%i3) t1(i);
(%o3) 				      48
(%i4) t1(n-2*i);
(%o4) 			    (n - 3) (n - 2) (n - 1)

 
> As a workaround you might try something like ... := block([m],
> subst(n, m, product(m+1, ...))) or maybe use a gensym instead of i.
> 
> Albert.

Hi Albert,
subst and gensym do not help here on 5.9.3 GCL/Windows.

Volker