# Is “weight of a sand bucket” analog or digital in nature?

I've got Digital Logic Design course this semester, during the introduction of this course my professor emphasized about the difference between digital and analog devices, and then gave us some examples from things around us, two of these examples confused me:

1. Grains of sand in a bucket is digital
2. weight of a sand bucket is analog.

What I was thinking is that it's pretty much the opposite!

Can I have some explanation to this? • I think you're wrong with the "opposite", but I'd still say it's a terrible example. Point is that you can count grains of sand, but you can't count weight. But countable doesn't imply digital, so I really don't agree in any way with the example (but I'm absolutely certain that you're wrong – physical weight is not a digital quantity; but neither is count of grains of sand per se.) – Marcus Müller Oct 8 '17 at 21:42
• I agree that it is a terrible example, but maybe he meant that you can't have "half" a grain of sand, while with weight you can have infinite decimal places? 10.00012312.. kg? – Wesley Lee Oct 8 '17 at 21:47
• @MarcusMüller reference book states that: Generally, anything that can be expressed as "the number of.." is digital. Does that make sense? I've included a snap of some examples. – Seraj Oct 8 '17 at 21:48
• In any case, we already have a word for what the text means and it's continuous and discrete. At least where I come from it's not common to talk of quantities as digital or analog; we can find a digital representation of a discrete quantity, giving us digital data. – Marcus Müller Oct 8 '17 at 21:52
• @WesleyLee he, nice example. So, that's physically actually proper, but it demands a high degree of insight in solid state physics, right? In what we would "classically" expect, since atoms have fixed masses, and energy states in which these can be and combine to sand crystals, we would have to assume that the mass of the sand is a rational number. We can count the rational numbers, just like we can count the natural numbers. Rational numbers are hence part of the discrete world – and so would be the weight of the sand :) If "countable" is the criterion, then "weight of … – Marcus Müller Oct 8 '17 at 22:00

## 2 Answers

The question whether something is digital or analog is actually hard. The point that the text you're citing makes is that anything that can be represented as a count of discrete entities is digital.

In that sense, since grains of salt are countable, the count is a "digital quanitity". Since you can't count "weights", the weight isn't digital.

I don't agree with that wording, personally. I've not come across the term "digital quantity", and frankly, we already have a term for that – it's called discrete, and all definitions that surround the term digital revolve around the concept of discreteness. So, calling a quantity digital feels like a circular definition:

• "Hey, what's a digital datum?"
• "It's something that represents a digital quantity."
• "So what's a digital quantity?"
• "Something representable by digital data."

As you notice, meh, that's not a definition.

Instead, we usually restrict the usage of the word "digital" to three use cases:

1. Digital signals (vs. analog signals)
2. Digital electronics
3. Digital data

# Digital signals

I'm working a lot with signals, so I have a favourite definition of this. Note that for something to be called digital signal, you need to have a mathematical signal model first. No model, no digital-ness!

A signal is digital if, and only if, it only exists for discrete loci and can only take one of a discrete set of values.

With locus, most often we mean time, but it might also be the position in an image, for example.

Discrete is the core concept here. We call sets discrete sets if they are countable, such as the Natural Numbers (1, 2, 3…), and all the sets that we can bijectively map to these (or a subset) – be it the Alphabet (a,b,c…), be it more abstract things like $\mathbb Q$ (yes, the rational numbers are countable. That's why the "weight of something" example is dangerous. The real numbers are not countable.)

# Digital Electronics

Electronics that work with discrete steps – for example, the input of a flip flop is either high or low, never "anything in between. The circuitry works in a manner where it's only relevant in which of the discrete voltages, currents, frequencies … that are provisioned by the circuit's design the input falls, not its continuous value. (E.g., your flip flop doesn't care whether your input voltage is 0.0 V or 0.00001123288… V, if the threshold between high and low is 0.5 V)

# Digital Data

This is a term that comes from information theory.

You have to ask yourself: Is something capable of transporting infinite information or not; if it's not capable, then whatever it is might be represented by digital data.

For example, dice might only show one of six sides showing up – we can very easily see that to represent the state of the die, we only need a finite amount of bits (less than three, actually).

On the other hand, when you spin a wheel and it has no "steps", and you just stop it at any angle in $(0, 2\pi($, then the info "we hit exactly this angle" is not representable by any finite amount of bits, if you can just look closely enough.

Digital Data is hence a representation of something with finite information content – or its a lossy representation of something that used to contain a higher amount of information before it underwent digitization.

# Coming back to your sand

Forget about "digital quantities". Think about quantities either being discrete (i.e. only taking values from a discrete set of values) or continuous (i.e. you can't just go ahead and count through all the values).

The set of possible numbers of grain in a bucket is discrete – it's a subset of $\mathbf N$, the natural numbers. The number of grains is a discrete quantity.

When you count the number of grains in that bucket once per week, you get a digital signal; it exists once per week, and it can only take discrete values.

When you build a digital scale to weigh the sand, what really happens is that some sensor measures the pressure on a special structure and converts it to a current, that an amplifier amplifies. If you where to understand that current as a function over time, you'd notice that it looks something like $f:\, \mathbb R \mapsto \mathbb R$, i.e. the continuous quantity (locus) time is mapped the continuous quantity current. That is an analog signal. Then, to be digital, your scale would need an analog to digital converter, that, for example, would measure whether the current is below $a$ mA, below $2a$ mA, below $3a$ mA, $4a$ … $1000a$ mA. The highest step that it is still above would be the quantized value. Since that converter is only sampling for discrete times, it converts an analog to a digital signal – it is an Analog-to-Digital Converter (ADC). From there on, digital circuitry processes the signal, converts it to other digital signals used to control the display on the scale. In contrast, the amplifier directly after the pressure sensor is not digital circuitry.

Understanding the examples given are easy. According to the book, anything that is enumerable (can be represented with integers), is digital and anything that can have fractional values is analog.
Not sure if one can classify a quantity as analog or digital. The classification actually depend on how the data is represented. Try to understand the examples:

Grains of sand in a bucket when plotted on a number scale will take only discrete values (integers). And these discrete values can be represented exactly using binary numbers. Now this is a digital representation of that quantity.

Weight of a sand bucket can take any value on the number scale. When you represent the value as such, say 19/3 kilograms, it is analog representation of that weight. If you want to represent analog values using binary numbers with complete precision, you will need infinite number of bits.

One can round-off this number to nearest discrete level and represent using binary numbers. Then the data becomes digital. For example, the number 19/3 can be represented as 110 in 3-bit binary number. The corresponding value is 6 kilograms but the original value was 6.33333... kilograms. The precision can be improved by using more number of bits.