RE: a simple product, but with "i = 1...n AND i != x"
- To: mathgroup at smc.vnet.net
- Subject: [mg70262] RE: [mg70243] a simple product, but with "i = 1...n AND i != x"
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 10 Oct 2006 06:12:19 -0400 (EDT)
You would have to specify n as a parameter, and in order to do the test x would have to be at least numeric. f[n_Integer?Positive][x_?NumericQ] := Module[{i, work}, work = Table[x - i, {i, 1, n}]; work = Select[work, N[#] != 0 &]; Times @@ work] f[7][6] -120 f[7][6.2] -29.5207 Maybe you meant x to always be an integer? David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: xarnaudx at gmail.com [mailto:xarnaudx at gmail.com] To: mathgroup at smc.vnet.net 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