Last Sync: 2022-07-09 16:00:04

This commit is contained in:
tactonbishop 2022-07-09 16:00:04 +01:00
parent d44e599b1c
commit acba51e5cb
4 changed files with 20 additions and 13 deletions

View file

@ -1,10 +1,11 @@
---
tags:
- Theory_of_Computation
- Mathematics
- binary
---
# Binary arithmetic
## Binary addition
When we add two binary numbers we use place value and carrying as we do in the denary number system. The only difference is that when we reach two in one column (`10`) we put a zero and carry the `1` to the next column.
@ -32,8 +33,8 @@ Let's break down each column from the right:
### More examples to practise with
![Pasted image 20220319174839.png](../img/Pasted%20image%2020220319174839.png)
![]()
![](../img/../../img/Pasted_image_20220319174839.png)
## Binary multiplication
Let's remind ourselves of how we do long multiplication within the denary number system:
@ -62,10 +63,11 @@ It is the same in binary multiplication but is actually easier because we are on
When we multiply binary numbers in columns we multiply each of the top numbers by the bottom in sequence and then sum the results as in denary.
An important difference is that when we move along the bottom row from the $2^0$, to $2^2$, to $2^4$ etc we must put a zero in the preceding column as a place holder. The sequence is shown below:
![multiplication_01.gif](../img/multiplication_01.gif)
![multiplication_02.gif](../img/multiplication_02.gif)
![](/img/multiplication_01.gif)
![multiplication_03.gif](../img/multiplication_03.gif)
![](/img/multiplication_02.gif)
![multiplication_04.gif](../img/multiplication_04.gif)
![](/img/multiplication_03.gif)
![](/img/multiplication_04.gif)

View file

@ -1,10 +1,12 @@
---
tags:
- Theory_of_Computation
- electronics
- binary
---
# Binary arithmetic with circuits
Now that we know how to add and multiply using binary numbers we can apply this knowledge to our previous understanding of circuits.
Our aim will to be have our inputs as the numbers that we will add or multiply on and our outputs as the product or sum.
@ -14,7 +16,8 @@ Our aim will to be have our inputs as the numbers that we will add or multiply o
Let's start with the most basic example:
*Half adder circuit*
![maths_with_logic_gates_1.png](../img/maths_with_logic_gates_1.png)
![maths_with_logic_gates_1.png](/img/maths_with_logic_gates_1.png)
This circuit has the following possible range of outputs, where A and B are the input switches and X and Y are the output signals. The logic gates (an `XOR` and an `AND` ) are equivalent to the add function.
@ -46,11 +49,12 @@ This is called a half adder because it cannot go higher than $2^1$.
There are special output components that can represent the combination of binary inputs and logic gates as denary values. Here is an example using a **seven-segment display** :
[maths_with_logic_gates_5.gif.crdownload](../img/maths_with_logic_gates_5.gif.crdownload)
[](/img/recalc_img.gif)
## Full adder
To represent numbers higher than the denary 2, we would need a carrying function so that we could represent numbers up to denary 3 and 4. The limit of a half adder is $2^1$.
We do this by adding another switch input:
![maths_with_logic_gates_7.gif](../img/maths_with_logic_gates_7.gif)
![maths_with_logic_gates_7.gif](/img/maths_with_logic_gates_7.gif)

View file

@ -1,9 +1,9 @@
---
tags:
- Theory_of_Computation
- Mathematics
- binary
---
# The binary number system
## Decimal (denary) number system

View file

@ -4,6 +4,7 @@ tags:
- binary
---
# Why computers use binary
## Now we know how binary works, how does it relate to computing?
The reason is straight forward: it is the simplest way on the level of pure engineering of representing numerical and logical values; both of which are the basic foundations of programming. An electronic circuit or transistor only needs to represent two states: on (1) and off (0) which corresponds to the switch on an electrical circuit.
@ -26,7 +27,7 @@ On the level of electrical engineering and in the subsequent examples using a li
## From circuits to programs
The following (from my earlier notes) breaks down how we get from the binary number system → electrical circuits → to computer programs:
The following breaks down how we get from the binary number system → electrical circuits → to computer programs:
1. ”Data”= a piece or pieces of **information**