User:HaydenBobMutthew/Mathematical analog circuit

A mathematical analog circuit is a circuit which operates on signal strength, such as arithmetic and comparison.

Introduction
Since there is no redstone adder in Minecraft, we need to convert addition into subtraction.

a + b = a + b - 15 + 15 = - 15 + a + b + 15 = - (15 - a - b) + 15 = 15 - (15 - a - b)

However, as signal strength cannot be higher than 15, we need to have sum and carry out outputs on the adder. Then we have:

sum = / a + b if a + b < 16 \ a + b - 16 if a + b ≥ 16 = / 15 - (15 - a - b) if a + b < 16 (hereinafter omitted) \ a + b - 15 - 1 if a + b ≥ 16 = a - 15 + b - 1 = - (15 - a) + (b - 1) = (b - 1) - (15 - a)

In an adder, there is also a carry in input, so we have the following equations:

sum = a + b + c    = / 15 - (15 - a - b - c) if a + b + c < 16 (hereinafter omitted) \ (b + c - 1) - (15 - a) if a + b + c ≥ 16 = (b - 1 + c) - (15 - a)    = b - (1 - c) - (15 - a)

If a + b + c > 15, 15 - (15 - a - b - c) will be 15 in terms of comparators. If a + b + c < 16, b - (1 - c) - (15 - a) will be 0 in terms of comparators. This runs a problem: if a + b + c = 15 or 16, then 15 - (15 - a - b - c) will be 15 and b - (1 - c) - (15 - a) will be 0, making impossible to distinguish whether the first expression or second expression should be the final output. So this method didn't work. See the next section for the workaround.

Designs

 * ?×?×? (? block volume)
 * flat, silent
 * circuit delay: TBD


 * Earliest Known Publication: February 5, 2013

Analog subtraction
Although we have a redstone subtractor that can be achieved by a comparator in subtract mode, there are no negative signal strength in Minecraft. Our first approach is use the fact that a - b - c = a + NOT b + NOT c = a + (15 - b) + (1 - c). Then we have: diff = a - b - c     = / a - b - c if a - b - c ≥ 0 (hereinafter omitted) \ a + (15 - b) + (1 - c) if a - b - c ≤ 0 = (15 - b) - c - (15 - a)