Re: a simple product, but with "i = 1...n AND i != x"

*To*: mathgroup at smc.vnet.net*Subject*: [mg70257] Re: a simple product, but with "i = 1...n AND i != x"*From*: "Ray Koopman" <koopman at sfu.ca>*Date*: Tue, 10 Oct 2006 06:12:08 -0400 (EDT)*References*: <egcok5$je2$1@smc.vnet.net>

xarnaudx at gmail.com wrote: > hi, > i would like to make a function like > f[x_] := Product[x - i, {i, 1, n} AND i != x} > > obviously, the end of the expression is syntactically incorrect. But > how to rewrite this product correctly? > thanks There are several possibilities. Here are three: Times@@(x - Range@n /. 0 -> 1) Times@@(x - DeleteCases[Range@n, x]) Product[x - i + Boole[x == i], {i, n}]