3.1. Analog and Digital¶
The computers we are most familiar with are electrical devices. Normally, an electrical signal is an analog phenomenon - meaning it can change continuously change in value. The voltage flowing through a circuit can take on an infinite number of possible values. In the figure below, imagine the wave as representing the voltage on a wire over time - the voltage changes smoothly over time.
Now imagine we cared about the exact voltage at any point in time - that 3.00000 volts means one thing and 3.00001 volts means something else. Not only is that difference so small we could not even see it in the figure, it would also be very difficult to build a machine that could reliably produce or exactly the right signal or measure that signal with perfect accuracy. Even the slightest bit of noise would make it impossible to tell whether we were looking at 3.00000 volts or 3.00001 volts.
That is one of the reasons computers are built as digital devices. A digital signal is only allowed to take on a limited number of possible values. Often, the only two states allowed are “on” and “off”. A digital signal with only two states plotted over time thus looks like this:
We could have more than two possible states - we refer to “digits” in numbers as digits because they are only allowed to be 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. A single digit can’t represent a value halfway between 1 and 2. The English alphabet is a digital system with 26 possible values (A-Z).
Introduction to Computer Science using Java by Bradley Kjell (CC BY-NC 3.0)