View
239
Download
1
Category
Tags:
Preview:
Citation preview
1
Discrete / ContinuousRepresentations
Of numbers – binary & decimalBitsHexadecimal - 'Hex'Representing text
Bits and Bytes
3
By the end of this lecture you should …Have an awareness of
– What digits, bits and bytes are– What 'digitizing' is– What 'hex' is, why it is used and how to use it– What ASCII and Unicode are
Understand better how computers represent information
Discrete / ContinuousRepresentations
Of numbers – binary & decimalBitsHexadecimal - 'Hex'Representing text
Bits and Bytes
5
Discrete vs Continuous
Copyright © 2006 Pearson Addison-Wesley. All rights reserved.
6
Discrete vs Continuous
Some things have a continuous range of values. Light and color for example have varying hues or range of intensities.
Clicking and drumming are discrete. Humming and whistling are continuous.
Analogue Digital
7
FreeFoto.com
8
Analogue and digital
Digital storage is discrete Analogue storage is continuous Digital processing is carried out through
discrete specified steps Analogue processing is uses the physical
properties of objects and processes to model
Discrete / ContinuousRepresentations
Of numbers – binary & decimal
BitsHexadecimal - 'Hex'Representing text
Bits and Bytes
10
Numbers
What is a number Numbers are things that we count with Numbers have an order We add numbers together to get other numbers.
Something that we use numerals to represent numbers
(Numerals - 'arabic' 'roman' 'chinese‘)
11
Symbols represent numbers
Different shapes, different words, different symbols
one ONE one one one 1 1 Roman numerals I and iChinese characters
Zero 0
What ІІ represents depends on the context
12
Human number systems
Roman system (every so often need a new symbol)I II III IV V VI VII VIII IX XID D DI IL L LI IM M MI
Base ten (ours, Arabic, Indian, …)0 1 2 3 4 5 6 7 8 9 (don’t need new symbols)
10 100 1000 10000 100000 …decimal system (positional base 10)
13
Number systems
Base "two" – uses two symbols = BinaryThese symbols could be almost anythingCould be written with zeros and ones –
0 and 1 Base "ten" – uses ten symbols = Decimal
could be written with using our usual numerals 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
14
Between Machines & end-users
Machines use binary representations internally
(It's fast, convenient, easy direct and useful)
For end users, machines are designed to convert to the standard representation (0,1,2,3,4,5,6,7,8,9)
15
Digitising Discrete Information
Digitise – to represent information with digits
Digitise originally meant using the ten numerals ‘0’ through ‘9’
Telephone numbers, National Insurance numbers, etc. are examples of digitised information.
16
Machines and People
Computing machines {nowadays}manipulate 0s and 1s
Deep in a computer everything is
0s and 1sComputer programsComputer data
People 'manipulate'NumbersWordsImages
Words – spoken language
‘Images’ (symbols) used to represent spoken language (either to
17
For computers
Computers (internally) represent everything as binary (eg as 0 and 1)
Everything means everything – text, sound, images, computer programmes …
If a computer is used to search through a database and find all those people whose name begins with the letter "G", the most basic representation of the letter G is as some sequence of 0s and 1s
18
“bits are bits”The same 4 bytes shown can be interpreted differently depending on context.
Copyright © 2006 Pearson Addison-Wesley. All rights reserved.
19
For people
Long (or even relatively short 7±2) sequences of 0s and 1s are very hard for us to read, write, remember, check, communicate with …
We can make quick and easy use of a large number of discrete symbols (but we need to limit the number of symbol chunks that we are handling at any one time)
20
Ordering Symbols
One advantage of using digits for encoding is that they can be listed in numerical order.
Not always used, however, such as in a telephone book, where listing is by name.
If you use symbols other than digits, you would have to decide on an ordering sequence, called “collating sequence”.
Discrete / ContinuousRepresentations
Of numbers – binary & decimalBitsHexadecimal - 'Hex'Representing text
Bits and Bytes
22
Bits For Symbols
Bit stands for binary digit.– A bit is single item of binary information –
We can think of a bit as a single zero or a single one (in some forms of computer memory – it could the presence or absence of an electrical charge at a specific location – it could be the presence or absence of a magnetic charge at a location
Discrete / ContinuousRepresentations
Of numbers – binary & decimalBits
Decimal and binary againHexadecimal - 'Hex'Representing text
Bits and Bytes
24
n bits 2n Represent
1 21 2
2 22 4
3 23 8
4 24 16
5 25 32
6 26 64
7 27 128
8 28 256
9 29 512
10 210 1024
A picture will help!
25
The decimal number 1010
representing one thousand ten = 10 + 1000.
Copyright © 2006 Pearson Addison-Wesley. All rights reserved.
26
The binary number 1010
representing the decimal number ten = 2 + 8.
Copyright © 2006 Pearson Addison-Wesley. All rights reserved.
27
Binary representation of the 1010
the decimal number one thousand ten = 2 + 16 + 32 + 64 + 128 + 256 + 512 Copyright © 2006 Pearson Addison-Wesley. All rights reserved.
28
Technical
At some points, people need to deal in a convenient manner with the way machines are representing informationMachines are representing it in a binary form
Using just zeros and ones is not handy for us.
The base-10 number systems is not efficient for machines.
Discrete / ContinuousRepresentations
Of numbers – binary & decimalBitsHexadecimal - 'Hex'Representing text
Bits and BytesContents
30
Hexadecimal – 'hex'
Base 16Relatively easy for computers
Comparatively easy for us (to read, write, remember, use)
Symbols: 0 1 2 3 4 5 6 7 8 9 a b c d e f
e stands for fourteen
f stands for fifteen
10 stands for sixteen
ff stands for two hundred fifty five
You've seen this with colours
in CSS
Discrete / ContinuousRepresentations
Of numbers – binary & decimalBitsHexadecimal - 'Hex'
Representing text
Bits and Bytes
32
The minimum for representing English and numbers Lower-case letters Upper-case letters Some punctuation Blank spaces Frequent symbols
33
ASCII
American Standard Code for Information Interchange
ASCII was 7 bits –an eighth bit was used for various purposes
it became clear that was not enough bits “Extended” ASCII with 8 bits was developed Eight bits produce 256 symbols which is more
than enough for English and for many European languages
34
ASCII
Representing 128 different elements
35
Representation
36
Representation
Demo!
37
Bytes & Unicode
IBM gave the 8-bit sequences a special name, byte, and adopted it as a standard unit for computer memory.
Bytes are still the standard unit or memory
The ultimate and complete solution is the representation, called Unicode.It has 8, 16 and 32 bit versions.
It can handle all languages.
38
39
Displaying Unicode on PCs
In PowerPoint or word or …
from the menubar
Insert > Symbol > Select Arial Unicode MS
Select Unicode Hex
Demo!
40
What we need for a global internet
The symbols of all written languages The symbols of basic and useful symbol
systems – Math symbols– IPA "the international phonetic alphabet"
Enough space left over to grow€ (new symbols get added)
41
And we need these all together
Documents may need to have many languages What about for example an on-line dictionary
(Arabic – Japanese) or … In addition, a developer would want to be able to
build something that would work regardless of the combination of languages needed.
So a unified method of representing all of these together is needed and it is Unicode
42
Encoding You've seen (and written or copied to
heads of html documents):<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Another example of this would be:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Relating it back to HTML etc.
The character set for this document is the Unicode Transformation
Format – 8 bit
43
Encoding
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Relating it back to HTML etc.
charset means character set
iso-8859-1
iso = “International Standards Organisation”
44
Symbols & representations
Arabic numerals represent numbersLogos represent companiesə ð ɵ represent sounds√ ℵ ∀ ∃ ∂ ∮ ∈ are used in mathematics¥ ¢ ₨ represent currencies or …ß á â ã ä å À Á Â Ã Ä Å are used in
European languages¶
45
Some representations are better than others Easier to learn Easier to remember,
easier to store Easier to process
– Roman numerals v arabic numerals
More reliable to communicate
More secure More accurate More precise More flexible
What's easy for people
What's easy for machines
46
What is a number again?Using numbers as representations Phone numbers License plate
numbers ISBN numbers National Health
insurance numbers
We call these ‘numbers’, We use numerals as their representation, but
We don't add them (or ...)
They don't have an order (my telephone number is lower than yours)
What does ІІ represent?
It depends on the context
There are at least four reasonable numerical answers that are not just random choices of meaning for ‘I’
48
Explore on your own
In your textbook, there’s a nice explanation of why ‘bytes’.Have a look. – (Chapter 8 of Snyder Fluency
with Information Technology)
49
Explore on your own http://www.unicode.org/ http://en.wikipedia.org/wiki/Unicode http://en.wikipedia.org/wiki/Unicode_and_HTML
http://www.columbia.edu/kermit/utf8.html Code charts: http://www.unicode.org/charts/
The absolute minimum every software developer must know […] about Unicode and character setshttp://www.joelonsoftware.com/articles/Unicode.html
Unicode's site http://www.unicode.org/standard/WhatIsUnicode.html On the goodness of unicode
http://www.tbray.org/ongoing/When/200x/2003/04/06/Unicode
50
Recommended