- There it goes. - Yay!
I made a 2D version of a greedy cup siphon recently,
and Matt Parker suggested that I might
be able to build a water computer
by chaining together a number of these siphons.
For example, maybe I could use these siphons
to add numbers together.
Computers add numbers by chaining together
a series of logic gates.
For example, these logic gates
add two digit binary numbers together.
I'll get into the details of that diagram later,
but what are the logic gates made out of?
Well, in a computer, they're made out of transistors,
but they don't have to be.
If you're familiar with Matt Parker's channel,
you'll know that logic gates
can be made out of dominoes, for example.
But what about using the flow of water instead?
This was my first attempt.
If both inputs are turned on,
they collide in the middle, filling up this central bucket,
and water flows out of the middle hole there.
If only one input is turned on, there's no collision,
and water flows into one of the two side buckets.
In other words, water only pours out of this output
if both inputs are turned on.
In a computer, you call that an AND gate,
a logic gate where the output only turns on
when both inputs are on.
If I combine these two outer holes
into a single tube like this,
then water only flows out of this tube
if one or the other of the inputs are turned on
but not both.
In a computer, that's called an exclusive or gate.
So this should work as an AND gate or an OR gate
or both at the same time.
Actually, this arrangement fails immediately
because water is too sticky.
It sticks to these outer faces,
and you can't get a jet strong enough
to pass across the gap.
But if you can separate the water from the glass,
you can get it to work.
- What I did like about that one
is you can very easily see why it works.
- [Steve] Yeah.
- And that's why I love these ridiculous physical computers,
because there's no magic to computing.
- One slight issue is flow rates.
So for example, you know,
if the flow in is slower than the flow out,
this is gonna build up and then it's gonna spill over.
In the end, this mechanism had too many issues.
Also, I really wanted to use
the greedy cup siphon mechanism,
which this doesn't have.
Actually, the reason Matt Parker thought
of water computers while watching my video
was because of a mistake that I made.
I put the siphon in the middle of the container.
That actually split the container
into two independent areas.
- I did enjoy your video, watching you having
to pour both very carefully to synchronize.
It had that sense of an AND.
- There really is an AND-ness to it, isn't there?
The problem is you have to really worry about timing.
Both those bits from each side
have to come in at the same time,
they have to meet at the same time at the top there.
Actually, you can get much more reliable AND gate
from this thing.
What you do is you define a one as a certain volume of water
that gets just above halfway on here.
So if you put two ones in,
the volume of water gets all the way to the top,
the greedy cup siphon is activated,
and your AND response comes out there.
An exclusive or is a little bit trickier.
- I sent you a sketch where I had
a dual-height greedy cup siphon,
with one on each side but different heights,
which I thought would work,
but I wasn't sure if it would be reliable.
- So in the end, the solution was
to drill a small hole here.
It's a slow leak, and what that means
is if you put a one in there and only a one,
you're not gonna get a greedy cup siphon,
but you are eventually gonna get it
to all come out of that slow leak.
If you put two ones in for your input,
then the siphon is activated and the chamber empties.
It doesn't empty instantaneously,
so there will be a small amount of leak
through the exclusive or channel.
So when you look at the chamber
that's catching the exclusive or output,
if there's just a little bit of the bottom,
you read that as a zero,
but if the chamber is full up to here,
then you read it as a one.
One thing that's nice is
that this single device houses two gates.
You've got two inputs and two outputs.
One output gives you the exclusive or,
the other output gives you the AND.
- Conceptually, we had to switch
from thinking about something you would turn on
and it would just keep flowing
and settle into some kind of state
to now you've got packets of water representing bits.
- Why don't I show you?
I can't change cameras,
so why don't I do a WhatsApp video call with you?
I know, I know.
Oh, you've just, why did you reject my call?
That's very rude.
Are you screening my calls?
- Hey, all right.
- Hey.
- So I'm gonna mute you. - So I'm gonna mute you here.
- [Steve] There it is.
- [Matt] Oh my goodness.
I have no sense of the scale of what I,
well, I know the scale of the achievement.
- It's pretty cool, isn't it?
But what on earth is it doing?
Well, it's implementing this logic gate diagram
that I showed you before.
Actually, if I turn it on its side,
you can start to see they have a similar shape.
But what exactly is this logic gate diagram doing?
Well, at this point, it's helpful
to switch up the language that we use.
Instead of talking about inputs and outputs
being turned on or turned off,
let's talk about ones and zeros.
So for example, in the case of an AND gate,
you would say if both the inputs are a one,
then the output is a one.
Thinking about the logic gates in that way,
we'll be able to show that this particular arrangement
is actually going through a process
of long addition of binary numbers.
You'll know from doing long addition at school
that if you add two digits together and it goes above 10,
then you carry the one.
So for example, here, nine plus four is 13,
you put the three down there,
and you put the one up there into the next column.
The same thing happens with long addition of binary numbers.
If there's a one and a zero in this column,
then you put a one down here.
But if there's a one and a one, well,
one plus one is two, and two in binary is written 10.
So you put the zero down here, and you carry the one.
You might already be noticing some logic gates
hidden in these operations.
For example, the number that you put down here,
if you think about that as the output,
what we have is an exclusive or operation.
You only put a one here in the output
if one or the other of the inputs is a one.
If they're both one, then you actually put a zero.
What about the carry?
Well, the carry is related
to those two inputs like an AND gate.
In other words, you only carry a one
if both of the inputs are a one.
So let's put that together in a diagram.
This is called a half adder.
Moving to the next column in this long addition,
there are actually three inputs.
So the logic diagram is a little more complicated.
Here it is.
I'm not gonna explain it all,
but feel free to pause the video
if you want to ponder it for yourself.
But this is called a full adder.
And if you want to add, say,
two four-digit binary numbers together,
you just chain three full adders together like this
with a half adder at the start
because the first column doesn't have a carry coming in.
Because now our devices are an AND gate
and an OR gate in one, we can simplify
this logic diagram to look like this.
Some aspects of this water computer
aren't completely obvious.
Like this bit here, for example, it's a splitter.
The reason you need a splitter is because,
well, if this siphon activates,
it's because you've put two ones in.
You've got a volume of water that represents actually a two.
So you have a two coming out of here.
But I only want a one to go in here.
So I need to split it in half.
A one goes this way and another one goes this way.
This is just a drain.
I originally had one continuous tube for the drain,
but that was acting like a siphon
and preventing any water going into this one.
That's why you've got this funnel here.
It just breaks that siphon effect.
This bundling is also a bit confusing.
Honestly, that's just for tube management.
If you look closely, it is just two separate inputs,
this one and this one.
Really, I should have an XOR tube coming out of here
into a readout bucket like this one,
but it's a lot easier just
to not bother drilling a hole in here,
and then this doubles up as the readout bucket.
You might be thinking, "Well, hold on,
"this has got three inputs.
"How can that work?"
And actually, these two inputs should really go
through an exclusive or before going into here.
But it doesn't really matter,
because you would never actually
get both of those on at the same time
if you consider the logic prior to these two tubes.
So it's fine to just have them both go straight in.
Do you want to give me two numbers to add?
- I kind of want to see 11 plus five.
The reason I think that'd be interesting
is you're gonna have different types of cascading rollovers.
- [Steve] So let's put a one in there.
A one is 10 milliliters, by the way,
in case you were wondering. - Oh, that's good to know.
I've always wondered what the volume of a one is.
- So these are the two numbers we're adding,
11 and five, written in binary.
You take the two digits from the ones column,
put them in these syringes;
the two digits from the twos column,
put them in these syringes;
the two digits from the fours column,
put them in these syringes;
and the two digits from the eights column,
and put them in these syringes.
We're then gonna watch these five readout buckets.
You've got the ones bucket, the twos bucket,
the fours bucket, the eights bucket,
and the sixteens bucket.
11 plus five is 16, so we want a one
in that final bucket and nowhere else.
- There it goes! - Hey, there you go.
It worked.
So now, and then that one should rollover.
- [Matt] And then the next one?
- [Steve] Oh, come on.
Ah, balls.
Part of it is getting the right amount in the syringe.
You don't want too much
so that there's too much dribble left over, and so on.
- [Matt] Maybe a one is 11 milliliters.
- [Steve] I also think we've got a bit of an issue here
where some of the water's dribbling down the backboard
- You've got a memory leak, Steve.
I've never been so proud of such an easy joke.
Could be a security issue, if I'm honest.
- [Steve] Yeah, I think someone is using this
to mine Bitcoin, and it's slowing everything down.
- What if we generate two random numbers,
and we'll give the computer a good clean-out,
and we'll add the two random numbers
so we have no way to influence this,
and if that works, we declare it a raging success?
- [Steve] Yeah, sounds good.
- Got it, so four plus nine.
And that's pretty close to the nine plus five
that we were thinking would be a good idea.
That's gonna be pretty boring,
'cause it's all just gonna plonk through.
Tell you what- - Or do you want to?
- Oh, I just had a closer look, Steve.
It was a five.
Huh.
- Oh, right.
- I'm sorry.
- The reset is like, I lift this up,
I go like that, and then I go like that.
- Oh, yeah, the Etch A Sketch approach to researching.
Underused in modern computing.
Although the undo on the iPhone is a shake, so.
So the dominoes reset was a day
if you have a team of like tens of people.
I got two three digit numbers working
on the domino computer.
If you get this to work, this would be
a substantial increase in computing power.
- [Steve] All right, here we go.
- [Matt] Okay, bam, we've had our AND,
'cause that still could have gone wrong.
Like, I know we're saying it's a trivial calculation,
but that split had to work.
And now we just need two slow leaks.
- [Steve] Which is what we've got.
It's 01110, which is eight plus four plus two, which is 14.
What were we adding together again?
- [Matt] Nine plus five.
- [Steve] Is 14, yay!
- In my experience, the more facetious
of the commenters on this video
will point out that you just went to a lot of effort
to show that nine plus five equals eight plus four plus two.
- Of course, that's really a fair comment
because you only do the eight plus four plus two bit
at the end when you're converting
back to decimal in your head.
If you stay in binary like a computer,
then we've actually done something really useful.
We've shown that 0101 plus 1001 equals 01110.
You know, maybe I could build something
that converts it to a decimal readout.
- Your water computer, my domino computer,
there's discrete states that it ends up in.
So it probably can't say it analog.
But there are actual analog computers.
So famously, there was a guy called Bill Phillips
who was an economist and worked on dams,
and realized the equations for water flow
matched the equations that are used to model the economy,
and they built a actual analog water computer
to model the economy, like with taps
for like government spending and interest rates.
This is kind of before you could
just numerical solution your way out of the problem.
In other news, Steve, I've just looked up.
You are on 877,000 subscribers.
I am on also 800 and something.
We're gonna keep collabing until we get to a million.
- [Steve] You challenged me to the water computer.
I want to see a video on the game Dobble.
- That is one of the most requested video topics.
- [Steve] Is it?
- And there's no accessible videos on it.
- That's gonna be a really interesting video,
so make sure you subscribe to Matt in advance.
Link in the card and the description.
He's approaching a million subscribers,
so let's get him there as quick as we can.
I'm also approaching a million subscribers.
So if you're not subscribed
and you've watched a few of my videos,
I'd love you to consider
whether I've earned your subscription.
Should we do one more calculation,
maybe slightly higher numbers or something
so we get down to that final bucket?
- Yeah, what about like seven plus 15?
- Yeah, here we go.
- [Matt] Okay, units are in, units are overflowing.
We've got an AND.
- [Steve] Yep.
- [Matt] Oh, yep, twos have overflowed.
We've got an AND.
- [Steve] There it goes.
- [Matt] Okay, the waste seems to be working.
Just dump that one.
- [Steve] There it goes.
- [Matt] Now we just need one more AND.
- Come on. - Come on.
- [Matt] There's enough, surely there's enough coming in.
There it goes!
- [Steve] Yay!
- [Matt] You've done it.
Seven plus 15 equals 22.
- For completeness, here's that original calculation,
11 plus five, actually working instead of failing.
And just for fun, here's 15 plus 15,
in other words, all the ones.
I didn't go into detail about
how binary numbers work in this video.
If you want to brush up on that,
I can heartily recommend
the sponsor of this video, Brilliant.
The best way to learn something
is by doing it for yourself.
Like, if you want a really long-lasting intuition
about something, that's the way to go about it.
Brilliant took that principle
and turned it into a website and an app.
It's a fine-tuned learning experience.
They throw you in with these problems
that you have to solve, and it's all interactive stuff.
When I say it's fine-tuned, I mean they've given
a lot of thought to things like the difficulty progression
so you never feel like you're getting stuck.
If you ever do get stuck, they have these clever mechanisms
for getting you unstuck without feeling disheartened.
The result is something that's incredibly satisfying.
They've got courses on broad topics
like science, maths, engineering,
or you can take a deep dive into very specific things
like cryptocurrency or quantum computing,
and, of course, they have courses on binary numbers.
Actually, I used Brilliant to get unstuck
in my orbital resonance video.
It really helped me to understand the papers I was reading.
But to be honest, I mostly use it for fun.
You know, a lot of people might read a book at bedtime.
Not me.
You can try out Brilliant.org for free,
no commitment, using my special URL.
It's brilliant.org/stevemould.
The link is also in the description.
So why not join me and 8 million other lifetime learners
by going to brilliant.org today?
I hope you enjoyed this video.
If you did, don't forget to hit subscribe.
And I'll see you next time.
(upbeat music)