Bernoulli variables again

*To*: mathgroup at smc.vnet.net*Subject*: [mg46538] Bernoulli variables again*From*: jmyers6761 at aol.com (JMyers6761)*Date*: Sun, 22 Feb 2004 11:27:40 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Consider the following expresion where each of the xn are Bernoulli variables: 1 - (1 - (1 - (1 - x1) (1 - x2)) x4) (1 - (1 - (1 - x2) (1 - x3)) x5) when this expression is Expanded we get: x1 x4+x2 x4 - x1 x2 x4 + x2 x5 + x3 x5 - x2 x3 x5 - x1 x2 x4 x5 - x2^2 x4 x5 + x1 x2^2 x4 x5 - x1 x3 x4 x5 - x2 x3 x4 x5 + 2 x1 x2 x3 x4 x5 + x2^2 x3 x4 x5 - x1 x2^2 x3 x4 x5 but since a Bernoulli variable, x, can take on only values of 0 or 1 and x^n = x this expression is subject to the transformation x^n-> x with the following result: x1 x4 + x2 x4 - x1 x2 x4 + x2 x5 + x3 x5 - x2 x3 x5 - x2 x4 x5 - x1 x3 x4 x5 + x1 x2 x3 x4 x5 My question is does anyone know how to transform such an unexpanded expression without having to first do an Expand? The actual expressions I am dealing with have a very large number of fully expanded terms ( > 10^6) and as a result Mathematica runs out of memory attemting to Expand the expressions. I know that the resulting expressions, after the Bernoulli transformation, if they could be expanded, would still be large but the number of terms would be much smaller, on the order of 10^3 terms. Does anyone know of a technique that could used to transform the unexpanded expression? Thank you for your thoughts. Al Myers