Computational Thinking
Joel Gethin Lewis
Lecture 1: Counting
What I'm going to talk about now:
- Introduce myself.
- The aim of this course.
- Counting in decimal, unary and binary.
- Memory in computers, storing numbers and words.
- How big things are.
- Bonus: really, really, really big numbers.
1. The aim of this course.
- Brain exploding and some coding.
- I'm going to reference Wikipedia a lot in this course, because I think it's one of the best things that humanity has ever made, and I wish I'd had it when I was young. Also it's free - I hated it when teachers would reference books that I couldn't afford when I was at university.
- Please seek your own links and references. This is the third time I've attempted to teach this course, and I've changed it a lot since 2017, and a little more since since 2018. I'd love your feedback, and there will be time allotted for that at the end of the week.
1. The aim of this course (continued)
- There is no homework for this course. I only ask that you pay attention and ask questions if you have them. I'd really encourage you to take the time to watch the films and read the references I put up. Think of them as cheat codes to get you to the next level quicker than I did.
- To introduce lots of interesting concepts from many areas so that you know the magic word to search for if you want to know more. Obfuscation is a BIG problem.
- Not to teach you how to code, but to start you on that path and point you in the right direction.
- Not to teach the history of art, computing or graphic design.
1. The aim of this course (continued).
- To teach you see problems at many levels (abstraction), break down problems (decomposition), find the order in them (pattern recognition), make solutions using a series of steps (algorithms) and realise that you might be able to use that solution in lots of areas (generalisation).
- Most of all, to teach you to be autodidacts, and, as previously mentioned, to blow your mind at least once per lecture.
- First task: what is an autodidact?
2. Counting in decimal, unary and binary.
- Counting is using groups of symbols to represent quantities or amounts.
- Let's count to 100 in Decimal. When do we need a extra digits?
- Let's count to 10 in Unary.
- Let's count to 20 in Binary. When do we need an extra digit?
- What's the biggest number you can count to on your fingers? On your fingers and toes?
3. Memory in computers, storing numbers and words.
- Computers use binary to represent everything in memory.
- A bit is a Binary digIT.
- A byte is eight bits. (BEight).
- A kilobyte is 1,024 (2^10) bytes, mostly.
- A megabyte is 1,048,576 (2^20) bytes, mostly.
3. Memory in computers, storing numbers and words (continued).
- One megabyte is approximately one minute of 128 kbit/s MP3 compressed music.
- One megabyte is six seconds of uncompressed CD audio.
- One megabyte is a typical English book volume in plain text format (500 pages × 2000 characters per page).
- The human genome consists of DNA representing 800 MB of data. The parts that differentiate one person from another can be compressed to 4 MB!
3. Memory in computers, storing numbers and words (continued).
- There are different ways of storing numbers and words in computers, as whole these values are known as Data types.
- Whole numbers or Integers are stored as ints. E.g. 0, 5, -567.
- Numbers which are in between whole numbers are stored as Floating Points or floats. E.g. 3.142 or -5.66343.
- As these numbers are stored in certain amounts of memory, if they get too big (or negative, or precise) the computer can run out of memory to store them, or overflow. This is bad. See the Y2K bug.
3. Memory in computers, storing numbers and words (continued).
- You can also store individual characters of the alphabet as chars.
- However, there are different encodings of characters - ASCII and Unicode for example - which allow different character sets to be displayed.
- You can store words (multiple characters) in strings - which are actually just lists of chars.
- Another name for lists are arrays.
- Strings are one dimensional arrays. We'll be discussing two dimensional arrays next time.
- Data can be stored as fixed values (constants) or values that can change (variables).
4. How big things are.
- Thanks to Terrence J. Sejnowski and his article on Edge.org for the following examples.
- How many seconds are there in a lifetime? 10^9 seconds.
A second is an arbitrary time unit, but one that is based on our experience. Our visual system is bombarded by snapshots at a rate of around 3 per second caused by rapid eye movements called saccades. Athletes often win or lose a race by a fraction of a second. If you earned a dollar for every second in your life you would be a billionaire. However, a second can feel like a minute in front of an audience and a quiet weekend can disappear in a flash. As a child, a summer seemed to last forever, but as an adult, summer is over almost before it begins. William James speculated that subjective time was measured in novel experiences, which become rarer as you get older. Perhaps life is lived on a logarithmic time scale, compressed toward the end.
4. How big things are (continued).
- What is the GDP of the world? $10^14.
A billion dollars was once worth a lot, but there is now a long list of multibillionaires. The US government recently stimulated the world economy by loaning several trillion dollars to banks. It is difficult to grasp how much a trillion dollars ($10^12) represents, but several clever videos on YouTube (key words: trillion dollars) illustrate this with physical comparisons (a giant pile of $100 bills) and what you can buy with it (10 years of US response to 9/11). When you start thinking about the world economy, the trillions of dollars add up. A trillion here, a trillion there, pretty soon your talking about real money. But so far there aren't any trillionaires.
4. How big things are (continued).
- How many synapses are there in the brain? 10^15.
Two neurons can communicate with each other at a synapse, which is the computational unit in the brain. The typical cortical synapse is less than a micron in diameter (10^-6 metres), near the resolution limit of the light microscope. If the economy of the world is a stretch for us to contemplate, thinking about all the synapses in your head is mind boggling. If I had a dollar for every synapse in your brain I could support the current economy of the world for 10 years. Cortical neurons on average fire once a second, which implies a bandwidth of around 10^15 bits per second, greater than the total bandwidth of the internet backbone.
4. How big things are (continued).
- How many seconds will the sun shine? 10^17 seconds
Our sun has shined for billions of years and will continue to shine for billions more. The universe seems to be standing still during our lifetime, but on longer time scales the universe is filled with events of enormous violence. The spatial scales are also immense. Our space-time trajectory is a very tiny part of the universe, but we can at least attach powers of 10 to it and put it into perspective.
4. How big things are (continued).
- Artwork: Powers of Ten by the Eames Office
5. Bonus: Really really really big numbers