Difference between revisions of "CSC103: DT's Notes 1"
Line 627: | Line 627: | ||
<br /> | <br /> | ||
+ | The black lines represent electrical wires carrying an electrical current. The two circles with an oblique bar represent an electrical switch, that can be ON or OFF. In the figure it is represented in the OFF position. In this position, no current can flow. When the | ||
+ | oblique bar, which is a metalic object is brought down to touch the second white circle, it makes contact with the wire on the right, and the current can flow through the switch. In this case we can say that the OFF position of the switch represents the value False, and the ON position of the switch represents the value True, and the switch represents a boolean variable. If it is True, it lets current go through the circuit, and the presence of current will indicate a True condition. If the switch's status is False, no current can go through it, and the absence of current will mean False. | ||
+ | |||
+ | If we put two switches one after the other, as in Panel (2) of the same figure, we see that the current can flow through only if '''both switches''' are True. So putting switches in series corresponds to creating an '''and''' circuit. The current will flow through the '''and''' circuit is Switch '''a''' is True, '''and''' if Switch '''b''' is True. If either one of them is False, no current flows through. You can verify with the truth table for the Boolean And function above that this is indeed the behavior of a boolean '''and''' operator. Verify for yourself that the third circuit in the figure implements a boolean '''or''' operator. The circuit lets current go through if Switch '''a''' is True '''or''' if Switch '''b''' is True. | ||
Revision as of 12:31, 5 February 2012
--© D. Thiebaut 08:10, 30 January 2012 (EST)