# What are analog and digital in computer science?

I once thought that any analog computer is any computer which "doesn't need electrical current to work".
I once thought that any digital computer is any computer which "does indeed need (a correctly distributed) electrical current to work".

I found out both assertions as wrong.

What are analog and digital in computer science?

• And you checked what Wikipedia has to say about analog computers and digital computers? What, if anything, there would you like clarified? – Andrej Bauer Sep 2 at 11:42
• Hmm, do you understand the words "continuous" and "discrete"? – Andrej Bauer Sep 2 at 12:50
• Question broadly edited. – George Sep 2 at 13:01
• Your description of "continuous" and "discrete" is quite incorrect. This may be the source of confusion. It looks like you should first learn the general meaning of the words "analog" and "discrete", and once you understand those, it should be much easier. – Andrej Bauer Sep 2 at 13:02
• @AndrejBauer I tried to study the meaning of "analog" and failed; about discrete, I don't know in what science context (math, CS, physics, something else?). – George Sep 2 at 13:05

I'll try to answer your remaining question: what are analog and digital in computer science?

The trouble is that these terms aren't from computer science. They are from the field called "signal processing". When someone says "analog computer", they simply mean that the computer is designed on principles of analog signal processing and built from analog components. The same goes for digital computers: they are designed with digital signal processing in mind and built from digital components.

So what does "analog" means? The word is taken from Greek word "proportional". To clarify what it means, let's look at the sum operation implemented with graduated cylinders:

Say you want to compute $$13 + 38$$. First, you take an empty cylinder and fill it up to $$13$$ ml mark. Then you take another empty one and fill it up to $$38$$ ml mark. Then you pour one into the other and look how much ml of liquid is there, which you announce as the result of the sum operation.

This is "proportional", because if you want to use $$26$$ instead of $$13$$ as an input, you use double amount of liquid. Double amount of liquid means twice as large number. An electrical analog computer could use the voltage of electric current is a similar way.

Now let's take a look on a digital computation implemented with Soldier Crabs. Here's how you make logical OR:

And here's logical AND:

You put a swarm of crabs where you want logical $$1$$ as an input and you leave empty places where you want logical $$0$$. Then you look where the swarm ball ends up and interpret it as $$0$$ or $$1$$. This is built on principles of (binary) digital processing:

1. No crabs (no electric current, no water flow) means $$0$$.
2. A swarm of crabs (5V, steady water flow) means $$1$$.
3. What if you can't decide which is the case? You just say that your digital component is broken.

Before we had electric or electronic calculators, there were mechanical calculators. These worked with whole numbers, so they were digital, but they were powered by hand (typically by turning a crank) not by electricity.

On the other hand, in the period 1900 to 1960 there were a variety of analogue computers that were powered by electricity. Even though electronic digital computers were available from the 1950s onwards, an analogue computer was sometimes quicker, cheaper or easier to operate than an early digital computer. This wikipedia article contains pictures and descriptions of several electrical analogue computers.

There is a distinction between continuous phenomena and discrete. It's the former than is called analog in computer science and the latter, digital.

After all, the digits 0 and 1 are discrete.

Whilst [0,1], the interval between 0 and 1 is continuous and so analog. (I don't know if you are familiar with the notation [a,b]. It simply means all numbers between a and b).

• I don't know if you are familiar with the notation [a,b]. It simply means all numbers between a and b I assume it's like regex [A-Z], right? – George Sep 2 at 14:52
• @George, well, not exactly -- it is what Mozibur Ullah wrote. – D.W. Sep 2 at 16:27
• @D.W. I guess not exactly because A-Z is much less philosophical or "open" then 0-1. – George Sep 2 at 22:02