laziness, impatience, and hubris  
PerlMonks 
Re: Boolean math: Fill in the blanks.by repellent (Priest) 
on Oct 12, 2008 at 01:55 UTC ( #716647=note: print w/ replies, xml )  Need Help?? 
Very interesting topic!
Hypothesis:Each AND/OR operation is evaluated in the following way:
Cases:For <op> = AND, we would take right_mod_factor and multiply it with left_avg_bits_set to get <resulting_avg_bits_set>. Examples:
(R  R) & (R & R & R) => 24 * (4 / 32) = 3 bits set on average That is, if there are more bits set on average on the AND rightside, there will be less chance of swallowing, so more bits are set on average in the result. Conversely, for <op> = OR, we would take right_mod_factor and multiply it with left_avg_unset_bits. Then, take that result and add it to left_avg_set_bits to get <resulting_avg_bits_set>. Examples:
(R  R)  (R & R & R) => 24 + 8 * (4 / 32) = 25 bits set on average R & R & R  R  R = (R & R & R)  (R  R) => 4 + 28 * (24 / 32) = 25 bits set on average or R & R & R  R  R = (R & R & R)  R  R => 4 + 28 * (16 / 32) + 14 * (16 / 32) = 25 bits set on average [got 14 from 32  ( 4 + 28 * (16 / 32) )] That is, if there are more bits set on average on the OR rightside, there will be more chance of overriding, so more bits are set on average in the result. Conclusion:So, following my pattern hypothesis, I see some inconsistent results in your "full set".There may be some fallacy in my hypothesis, so feedback is welcomed :) So, given the following legend:
we can derive a set of equations to calculate the resulting average bits set for each AND/OR operation:
In Section
Seekers of Perl Wisdom

