Download presentation
Presentation is loading. Please wait.
Published byMargaretMargaret Barton Modified over 9 years ago
1
PHY 107 – Programming For Science
2
Positional Notation Used in nearly all modern numerical systems Right-to-left ordering of digits within larger number Expresses value using value of each digit (0, 1, 2, … 9) Value of position in which the digit is places e.g., 3, 13, 913, 0913, 10913, 810913 Numbers & arithmetic easy to understand Subtracting roman numerals is not for faint-of-heart
3
Positional Notation for 5862 2= 2 ones= 2 * 1 =2
4
Positional Notation for 5862 2= 2 ones= 2 * 1 =2 6= 6 tens= 6 * 10 =60
5
Positional Notation for 5862 2= 2 ones= 2 * 1 =2 6= 6 tens= 6 * 10 =60 8= 8 hundreds= 8 * 100 =800
6
Positional Notation for 5862 2= 2 ones= 2 * 1 =2 6= 6 tens= 6 * 10 =60 8= 8 hundreds= 8 * 100 =800 5= 5 thousands= 5 * 1000 =5000
7
Positional Notation for 5862 2= 2 ones= 2 * 1 =2 6= 6 tens= 6 * 10 =60 8= 8 hundreds= 8 * 100 =800 5= 5 thousands= 5 * 1000 =+ 5000 5862
8
Decimal Positional Notation Formal equation for a number d n...d 3 d 2 d 1 d 0 d 0 is digit in ones place, d 1 is in tens place, … d 0 * 10 0 d 1 * 10 1 d 2 * 10 2 d 3 * 10 3 … + d n * 10 n
9
Base-10 Positional Notation d0d0 2= 2 ones= 2 * 1 =2 d1d1 6= 6 tens= 6 * 10 =60 d2d2 8= 8 hundreds= 8 * 100 =800 d3d3 5= 5 thousands= 5 * 1000 =+ 5000 5862
10
Base-10 Positional Notation d0d0 2= 2 ones= 2 * 10 0 =2 d1d1 6= 6 tens= 6 * 10 1 =60 d2d2 8= 8 hundreds= 8 * 10 2 =800 d3d3 5= 5 thousands= 5 * 10 3 =+ 5000 5862
11
Base-10 Positional Notation 0d00d0 2= 2 ones 0 = 2 * 10 0 =2 1d11d1 6= 6 tens 1 = 6 * 10 1 =60 2d22d2 8= 8 hundreds 2 = 8 * 10 2 =800 3d33d3 5= 5 thousands 3 = 5 * 10 3 =+ 5000 5862
12
Base-10 Positional Notation d0d0 2= 2 ones= 2 * 10 0 =2 d1d1 6= 6 tens= 6 * 10 1 =60 d2d2 8= 8 hundreds= 8 * 10 2 =800 d3d3 5= 5 thousands= 5 * 10 3 =+ 5000 5862
13
Computer Number Systems Previous equation worked in decimal (base-10) Usual number system used in day-to-day life System requires representing 10 different digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Computers always in one of two states Turned on, your PS4 can play Bloodborne Cell phones great paperweights when turned off Binary digits ( 0,1 ) only used by computers To use them, helps to know powers-of-two bases
14
Digits In Other Bases Binary (base-2) uses 2 digits: 0, 1 Octal (base-8) uses 8 digits: 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal (base-16) has 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F A 16 = 10 10 D 16 = 13 10 B 16 = 11 10 E 16 = 14 10 C 16 = 12 10 F 16 = 15 10
15
Positional Notation To convert d n... d 3 d 2 d 1 d 0 into decimal: From base-10 d 0 * 10 0 d 1 * 10 1 d 2 * 10 2 d 3 * 10 3 … + d n * 10 n
16
Positional Notation To convert d n... d 3 d 2 d 1 d 0 into decimal: From base-b d 0 * b 0 d 1 * b 1 d 2 * b 2 d 3 * b 3 … + d n * b n
17
Converting Binary to Decimal 101011 2 = d0d0 d1d1 d2d2 d3d3 d4d4 d5d5
18
Converting Binary to Decimal 101011 2 = d0d0 1* d1d1 1* d2d2 0* d3d3 1* d4d4 0* d5d5 1*
19
Converting Binary to Decimal 101011 2 = d0d0 1* 2 0 = d1d1 1* 2 1 = d2d2 0* 2 2 = d3d3 1* 2 3 = d4d4 0* 2 4 = d5d5 1* 2 5 =
20
Converting Hex to Decimal 27 16 = d0d0 d1d1 3F 16 = d0d0 d1d1
21
Converting Hex to Decimal 27 16 = d0d0 7 16 = 7 10 d1d1 2 16 = 2 10 3F 16 = d0d0 F 16 =15 10 d1d1 3 16 = 3 10
22
Converting Hex to Decimal 27 16 = d0d0 7 16 = 7 10 * 16 0 = d1d1 2 16 = 2 10 * 16 1 = 3F 16 = d0d0 F 16 =15 10 * 16 0 = d1d1 3 16 = 3 10 * 16 1 =
23
Positional Notation Review To convert d n... d 3 d 2 d 1 d 0 into decimal: From base-b d 0 * b 0 d 1 * b 1 d 2 * b 2 d 3 * b 3 … + d n * b n
24
Converting Decimal To Binary Converting from decimal to binary (base-2): While decimal number ≠ 0 Divide decimal number by 2 Move remainder to left end of answer Replace decimal number with quotient 34 10 =
25
Converting Decimal To Base-b More generally, convert from decimal to base-b: While decimal number ≠ 0 Divide decimal number by b Move remainder to left end of answer Replace decimal number with quotient 335 10 = 16
26
Your Turn Get in groups & work on following activity
27
For Next Lecture Read pages 91 – 98 for Monday What is the boolean data type? How do the boolean operations work? What happens when we execute an if statement Week #3 weekly assignment due Tuesday Problems available via D2L If problem takes more than 10 minutes, TALK TO ME!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.