Natural Foundations for Information Technology SOFE 2850U Chapter 2 PDF

Document Details

WellBacklitHolly

Uploaded by WellBacklitHolly

DDCUS

2024

Dr. Mennatullah Siam

Tags

information representation number systems binary computer science

Summary

This document provides an overview of the representation of information in computers, focusing on number systems such as decimal, octal, binary, and hexadecimal. It explains various notations for integers and fractional numbers, along with conversions between these systems, and includes examples and exercises.

Full Transcript

Natural Foundations for Information Technology (SOFE 2850U) Chapter 2: Representation of Information (Part 1) Fall 2024 Dr. Mennatullah Siam Learning Objectives By the end of this Chapter, you will be able to: ▪...

Natural Foundations for Information Technology (SOFE 2850U) Chapter 2: Representation of Information (Part 1) Fall 2024 Dr. Mennatullah Siam Learning Objectives By the end of this Chapter, you will be able to: ▪ Explain how integers are represented in computers using: ▪ Unsigned, signed magnitude, excess, and two’s complement notations ▪ Explain how fractional numbers are represented in computers ▪ Floating point notation (IEEE 754 single format) ▪ Calculate the decimal value represented by a binary sequence in: ▪ Unsigned, signed notation, excess, two’s complement, and the IEEE 754 notations. ▪ Explain how characters are represented in computers ▪ E.g. using ASCII and Unicode ▪ Explain how colours, images, sound and movies are represented. 2 Number Systems: Decimal, Octal, Binary, and Hexadecimal Systems Decimal System The number system that we use in our day-to-day life Decimal number system has base 10 as it uses 10 digits from 0 to 9. Each position represents a specific power of the base (10). For example, the decimal number 6349 consists of the digit 9 in the units position, 4 in the tens position,3 in the hundreds position, and 6 in the thousands position, and its value can be written as 4 Octal Numbers An Octal number has a base 8, and supports numbers from 0-7 Prefix “oct” (octo) stands for eight. Each digit multiplies a power of eight Example: 2458 = 2*8^2 + 4*8^1 + 5*8^0 = 2*64 + 4*8 + 5*1 = 128 + 32 + 5 = 16510 5 Hexadecimal Numbers A Hexadecimal number has a base 16, and supports numbers from 0-16. Precisely: 0 1 2 3 4 5 6 7 8 9 A B C D E F Each digit multiplies a power of sixteen Example: 2FB16 = 2*16^2 + F*16^1 + B*16^0 = 2*256 + F*16 + B*1 = 512 + 240 + 11 = 76310 6 Binary Numbers Digital computers store information as a sequence of bits (binary digits) A Binary number is simply a number comprised of only 0's and 1's. Computers use binary numbers because it's easy for them to communicate using electrical current -- 0 is off, 1 is on. You can express any base 10 (our number system -- where each digit is between 0 and 9) with binary numbers. There is a need to translate decimal number to binary and binary to decimal. There are many ways of representing decimal number in binary numbers. (later) 7 How Does the Binary System Work? In a decimal system, the base is 10 We have 10 possible values 0-9 In a binary system, the base is 2 We have only two possible values 0 or 1. The same as in any base, 0 digit has no contribution, where 1’s has contribution which depends at there position. For example: 3040510 = 30000 + 400 + 5 = 3*104+4*102+5*100 101012 = 1*24+1*22+1*20 8 Converting Decimal to Binary The Process : Successive Division a) Divide the Decimal Number by 2; the remainder is the Least Significant Bit (LSB) of Binary Number. b) If the quotient is zero, the conversion is complete; else repeat step (a) using the quotient as the decimal number. c) The new remainder is the next Most Significant Bit (MSB) of the Binary Number. 9 Decimal to Binary: Example 1 Example: Convert the decimal number 610 into its binary equivalent.  610 = 1102 10 Decimal to Binary: Example 2 Convert the decimal number 4110 into its binary equivalent. Solution: ?? 20 2 41 r = 1  LSB 10 2 20 r =0 5 2 10 r =0 2  4110 = 1010012 2 5 r =1 1 2 2 r =0 0 2 1 r = 1  MSB 11 Brainstorming Question Convert the decimal number 2610 into its binary equivalent. Solution: ?? A) 010112 B) 110102 C) 101102 D) 100102 12 Solution Convert the decimal number 2610 into its binary equivalent. Solution: 13 2 26 r = 0  LSB 6 2 13 r =1 3 2 6 r =0 1 2 3 r =1 0 2 1 r = 1  MSB  2610 = 110102 13 Exercises Convert the following decimal numbers into their binary equivalents: a) 1310 = ? b) 2410 = ? c) 4510 = ? d) 15910 = ? 14 Converting Binary to Decimal The Process: Weighted Multiplication a) Multiply each bit of the Binary Number by its corresponding bit-weighting factor (i.e. Bit-0→20=1; Bit-1→21=2; Bit- 2→22=4; etc). b) Sum up all the products in step (a) to get the Decimal Number. 15 Binary to Decimal: Example 1 Convert the decimal number 01102 into its decimal equivalent. 0 1 1 0 23 22 21 20 Bit-Weighting Factors 8 4 2 1 0 + 4 + 2 + 0 = 610  0110 2 = 6 10 16 Binary to Decimal: Example 2 Convert the binary number 100102 into its decimal equivalent. 1 0 0 1 0 24 23 22 21 20 16 8 4 2 1 16 + 0 + 0 + 2 + 0 = 1810 100102 = 1810 17 Brainstorming Question Convert the binary number 01101012 into its decimal equivalent. Solution?? A) 5110 B) 5210 C) 5310 D) 5410 18 Solution Convert the binary number 01101012 into its decimal equivalent. Solution: 0 1 1 0 1 0 1 26 25 24 23 22 21 20 64 32 16 8 4 2 1 0 + 32 + 16 + 0 + 4 + 0 + 1 = 5310 01101012 = 5310 19 Exercises Convert the following Binary numbers into their Decimal equivalents: a) 0110 2 =? b) 11010 2 = ? c) 0110101 2 = ? d) 11010011 2 = ? 20 Summary Successive Division a) Divide the Decimal Number by 2; the remainder is the LSB of Binary Number. b) If the Quotient Zero, the conversion is complete; else repeat step (a) using the Quotient as the Decimal Number. The new remainder is the next most significant bit of the Binary Number. Weighted Multiplication a) Multiply each bit of the Binary Number by it corresponding bit-weighting factor (i.e. Bit-0→20=1; Bit-1→21=2; Bit-2→22=4; etc). b) Sum up all the products in step (a) to get the Decimal Number. 21 Octal Numbers Prefix “oct” (octo) stands for eight: 0 1 2 3 4 5 6 7 Each place value in an octal number is a power of 8 Conversion From Binary Numbers to Octal: Each group of 3 binary digits can be represented by a single octal digit Start with the LEAST SIGNIFICANT digit, mark out the digits in groups of 3 Convert each group of three digits to its octal digit (or symbol) Example The last group on 1 0 1 1 1 0 1 1 1 the left can have 5 6 7 anywhere from 1 to 3 binary digit group Converting octal numbers to binary is just the reverse operation of converting binary to octal 22 22 Brainstorming Question Ex1: Convert binary number 10010110 into octal number. 1. 2268 2. 227 3. 228 4. 225 Ex2: Convert binary number 1010111100 into octal number 1. 1247 2. 1274 3. 1275 4. 1724 23 23 Binary to Octal: Examples Ex1: Convert binary number 10010110 into octal number. Answer: 010010110= 2268 Ex2: Convert binary number 1010111100 into octal number Answer: ( 001 010 111 100)2 = (1 2 7 4)8 24 24 Octal to Binary: Examples Ex1: Convert octal number 205 into binary number. Answer: (2)8= (010)2 (0)8 = (000)2 (5)8 = (101)2 ➔ 2058= 0100001012 Ex2: Convert octal number 352.563 into binary number. Answer: (011 101 010. 101 110 011)2 25 25 Decimal to Octal Conversion From Decimal Numbers to Octal: two methods: Do a decimal-to-binary conversion, and then a binary- to-octal conversion Do a direct conversion using the repeated division method Since this is a conversion to octal, 8 is the divisor each time Example: Performing the example of 485 (using 2nd method): 485 / 8 = 60 rem 5 Least Significant Digit 60 / 8 =7 rem 4 7 /8 =0 rem 7 Most Significant Digit = (7 4 5) 8 Since we are dividing by 8 in the repeated division, you may end up with remainders of anywhere from 0 to 7 26 26 Decima to Octal Octal Numbers Conversion From Decimal Numbers to Octal: two methods: Do a decimal-to-binary conversion, and then a binary- to-octal conversion Do a direct conversion using the repeated division method Since this is a conversion to octal, 8 is the divisor each time Example: Performing the same example of 485 (using the 1st method) 48510= 1111001012 (using successive division by 2) Then: 1111001012= (111 100 101 ) 2 =7458 27 27 Octal to Decimal Octal Numbers Conversion From Octal Numbers to Decimal: Multiply each digit of the octal number by its place value and add the results Example: 7501 7 x 512 = 3584 5 x 64 = 320 0 x 8 = 0 1 x 1 = + 1 3905 7 5 0 1 83 82 81 80 28 28 Hexadecimal Numbers Prefix “hexa” stands for 6 and the prefix “deci” stands for 10 Hexadecimal number system is a base 16 number system There are 16 symbols: 0 1 2 3 4 5 6 7 8 9 A B C D E F Each place value in a hexadecimal number is a power of 16 Each group of 4 binary digits can be represented by a single hexadecimal digit 29 29 Binary to Hexadecimal Conversion From Binary Numbers to Hexadecimal: Start with the LEAST SIGNIFICANT digit, mark out the digits in groups of 4 Convert each group of four digits to hexadecimal digit (or symbol) Example 1 0 1 1 1 1 0 1 1 The last group on 1 7 B the left can have anywhere from 1 to 4 binary digit group Converting hexadecimal numbers to binary is just the reverse operation of converting binary to hexadecimal 30 30 Hexadecimal to Decimal Conversion From Hexadecimal Numbers to Decimal: Multiply each digit of the hexadecimal number by its place value and add the results Example: AB87 10 x 4096 = 40960 11 x 256 = 2816 8 x 16 = 128 A B 8 7 7 x 1 = + 7 43911 163 162 161 160 31 31 Data representation and Storage Numbering Systems: Decimal numbers and their binary, octal, and hexadecimal equivalents 32 32 More Examples Example 1 What does the decimal value of 124 stand for? 102 101 100 base 124 1 2 4 rightmost place x100 + x10 + x1 answer 124 What is the decimal value of the binary number 110? 22 21 20 base 110 1 1 0 rightmost place answer x4 + x2 + x1 6 34 34 Example 2 What is the decimal value of the octal value 176? 82 81 80 base 176 1 7 6 rightmost place answer x64 + x8 + x1 126 What is the decimal value of the hexadecimal value of B29? 162 161 160 base B29 B 2 9 rightmost place answer x256 + x16 + x1 2857 35 35 Example 3 Binary-to-Decimal Conversion Table 36 36 Example 4 Convert: 1012 = ?10 Begin with rightmost bit (one’s place). The next bit is the “two’s place”, then the “four’s place”, and so on 22 21 20 1 0 1 5 x4 + x2 + x1 37 37 Example 5 Binary to Decimal (Multiply) Convert: 10102 = ?10 Begin with rightmost bit (one’s place). The next bit is the “two’s place”, then the “four’s place”, and so on 23 22 21 20 1 0 1 0 10 x8 + x4 + x2 + x1 38 38 Example 6 Octal to Decimal (Multiply) Convert: 2708 = ?10 Begin with rightmost bit (one’s place). The next bit is the “eight’s place”, then the “sixty-four’s place”, and so on 82 81 80 2 7 0 184 x64+ x8 + x1 39 39 Example 7 Hexadecimal to Decimal (Multiply) Convert: 112A16 = ?10 Begin with rightmost bit (one’s place). The next bit is the “16’s place”, then the “256’s place”, and so on 163 162 161 160 1 1 2 A 4394 x4096 + x256 + x16 + x1 40 40 Example 8 Decimal to Binary (Divide) Convert: 2410 = ?2 41 41 Example 9 Decimal to Binary (Multiply) Convert: 28.62510 = ?2 28/2 =14 0 14/2= 7 0 7/2 = 3 1 … 24 23 22 21 20 2-1 2-2 2-3 3/2 = 1 1 1/2 =0 1 16 8 4 2 1 0.5 0.25 0.125 16 8 4 0.5 0.125 1 1 1 0 0 1 0 1 28.62510 = 11100.1012 42 42 Example 10 Octal to Binary Convert: 53358 = ?2 5 3 3 5 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 0 1 1 1 0 1 43 43 Example 11 Binary to Octal Convert: 1010110111012 = ?8 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 0 1 1 1 0 1 5 3 3 5 44 44 Example 12 Hexadecimal to Binary Convert: 1A8416 = ?2 45 45 Example 13 Practice with Number Systems 1002 = ?8 37168 = ?2 1101001112 = ?10 3A1B16 = ?2 46 46 Conversion between Two Number Systems with Fractional Part Decimal Fraction To the right of the decimal point, the digit 1 has a weight 0.1 (1/10), the digit 2 has a weight of 0.01 (1/100) and the digit 5 has a weight of 0.001(1/1000) 48 Decimal Fraction: Example Consider the number 82.53 The dot is called decimal point. 49 Binary Fraction Binary numbers can also be represented as unsigned fractional numbers by placing the binary digits to the right of the decimal point or in this case, binary point. Thus, all the fractional digits to the right of the binary point have respective weightings, where the powers of 2 are negative. The weight of each digit becomes more negative giving: 2-1, 2-2, 2-3, 2-4, and so on. 50 Binary Fraction: Example Consider the binary number 11.01 The dot is called Binary point 51 Binary Fraction 52 The Process of Conversion Separate the integral and the fractional parts. For the integral part, divide by the target radix repeatedly, and collect the remainder in reverse order. For the fractional part, multiply the fractional part by the target radix repeatedly, and collect the integral part in the same order. 53 Fractional Binary to Decimal Suppose we have the binary number 1101.01112, its equivalent decimal number will be: Step1: Convert the integral part (i.e., 1101) 1101 = (1×23) + (1×22) + (0×21) + (1×20) =8+4+0 +1 =13 Step 2: Convert the fractional part (i.e.,.0111).0111= (0×2-1) + (1×2-2) + (1×2-3) + (1×2-4) = 0+1/4 + 1/8 + 1/16 = 0 + 0.25 + 0.125 + 0.0625 =.4375 ➔ Final answer: 13.437510 54 Example Convert 110.101 to its decimal equivalent 1102 = (1*22) + (1*21) + (0*20)=4+2+0= 6.1012= (1*1/2) + (0*1/22) + (1*1/23) = 1*0.5 + 0*0.25 + 1*0.125 =0.625 ➔ 110.1012 = 6.62510 55 Brainstorming Question What is the decimal equivalent of the factional binary 101.11012 A) 5.8125 B) 5.0652 C) 5.1250 D) 4.8125 56 Brainstorming Question What is the decimal equivalent of the factional binary 101.11012 A) 5.8125 B) 5.0652 C) 5.1250 D) 4.8125 57 Fractional Decimal to Binary For decimal fractions, the fractional part must be multiplied by 2 successively and collecting the carries from top to bottom. The multiplication can be repeated till the fractional part becomes zero. If the fractional part is not zero after four or five steps, the process can be stopped, and we have to be satisfied with the nearest value. 58 Fractional Decimal to Binary Suppose we have the decimal number 0.625, its equivalent binary number will be: 0.625 × 2 = 1.250; carry is 1 (MSB) 0.250 × 2 = 0.500; carry is 0 0.500 × 2 = 1.000; carry is 1 (LSB) Therefore (0.625)10 = (0.101)2 59 Example Suppose we have the decimal number 0.375., its equivalent binary number will be: 0.375 × 2 = 0.75; carry is 0 (MSB) 0.75 × 2 = 1.500; carry is 1 0.500 × 2 = 1.000; carry is 1 (LSB) Therefore (0.375)10 = (0.011)2 60 Exercises Find the binary representations of: 0.510 0.7510 = Using only 8 binary digits find the binary representations of: 0.210 0.810 Find the binary representation of (107.6875)10 and (52.4)10 61 Next: Computer Memory and Data Representation Natural Foundations for Information Technology (SOFE 2850U) Lecture 5: Mathematical Models of Computing Fall 2024 Dr. Mennatullah Siam Understand the concept of mathematical models Learning Get acquainted with different types of mathematical models Objectives Learn the basic principles for building, analyzing, testing and using mathematical models Sanaa Alwidian (c) 2 What is a model? Model: Abstraction of reality A representation of a system that allows for investigation of the properties of the system and, in some cases, prediction of future outcomes. Always requires simplification Sanaa Alwidian (c) 3 4 What is modeling? Modeling: is a cognitive activity in which we think about and make models to describe how devices or objects of interest behave. Sanaa Alwidian (c) Models provide a framework for conceptualizing our ideas about the behavior of a particular system Why do we Models allow us to find structure in complex systems and to investigate need models? how different factors interact Models can play an important role in informing policies: Sanaa Alwidian (c) 5 Models can play an important role in informing policies: By providing understanding of underlying Why do we causes for a complex phenomenon need models? (cont.) By predicting the future By predicting the impact of interventions Sanaa Alwidian (c) 6 What is a mathematical model? Mathematical model: Uses mathematical terms or equations to describe the behavior of real systems and objects. Sanaa Alwidian (c) 7 Mathematical Modeling Mathematical modeling seeks to gain an understanding of science through the use of mathematical models on computers Sanaa Alwidian (c) 8 Why Mathematical Modeling? Is often used in place of experiments when experiments are too large, too expensive, too dangerous, or too time consuming. Can be useful in “what if” studies; e.g. to investigate the use of pathogens (viruses, bacteria) to control an insect population. Experiment Theory Computation 9 Mathematics can be used to "model", or represent, how the real world works. Example So, we have a (very simple) mathematical Sanaa Alwidian model (c) of the space in that box. Accurate? The model is not the same as the real thing. In our example we did not think about the thickness of the cardboard, or many other "real world" things. But hopefully it is good enough to be useful. Sanaa Alwidian (c) 11 Mathematics is a precise Forces us to formulate concrete ideas and assumptions in an language unambiguous way Mathematics is a concise One equation says more than language 1000 words Why Mathematics is a universal Same mathematical techniques can be applied over a range of language mathematics? scales Mathematics is an old but The rich toolbox created by mathematicians over centuries is still trendy language available at our disposal Mathematics is the language that computers understand best Sanaa Alwidian (c) 12 Mathematical models synthesize results from many experiments Experimental studies concentrate on specific aspects of a system Fragmented understanding of the system Often hard to infer how the system functions as a whole Sanaa Alwidian (c) 13 Mathematical models can unravel the unobservable Often the traits that we can measure are not the most informative traits Sanaa Alwidian (c) 14 Mathematical models can unravel the unobservable Often the traits that we can measure are not the most informative traits Sanaa Alwidian (c) 15 Mathematical models are not bound by physical constraints Powerful tool to explore ‘what if scenarios’ Extremely useful in the context of infectious disease where experimental constraints are strong Sanaa Alwidian (c) 16 Combine fragmented information into a comprehensive understanding Determine the relationship between underlying biological traits and observable traits What do we use Test hypotheses that are difficult to test in empirical studies mathematical models for? Make predictions & generate new hypotheses for future testing Assist with decision making by exploring ‘what if’ scenarios Sanaa Alwidian (c) 17 Models that encompass mechanisms Lack of (e.g. infection process) require quantifiable quantitative understanding of these knowledge mechanisms in order to make reliable predictions Limitations of Lack of available data / methods E.g. how to estimate individual susceptibility & infectivity? mathematical for estimating model Much improvement to be expected over the next years due to recent advances in models parameters statistical inference and data explosion Infection is a stochastic process Inherent It is impossible to make accurate stochasticity of predictions for infection spread on the some systems individual level Sanaa Alwidian (c) 19 Classifying them into broad categories can tell you much about their purpose & scope and often require different mathematical techniques Classification of mathematical models Typical distinctions: Empirical Systems Discrete Determini vs vs Static vs Linear vs vs. stic vs. mechanist molecular dynamic non-linear continuou stochastic ic model s Sanaa Alwidian (c) 20 Empirical Models (also called Statistical Models): Data driven modelling approach Starting point: data obtained from empirical studies Aim: to determine patterns & relationships between Empirical vs data (model variables) Require no prior knowledge of the underlying system mechanistic Mechanistic Models (also called Process Based Models): models Hypothesis driven modelling approach Starting point: specific phenomena of interest – observed from data Aim: to provide understanding for underlying mechanisms of this phenomenon Require prior understanding of system Data are used to parameterize / validate the model Sanaa Alwidian (c) 21 Deterministic models Assume that the outcome is precisely determined by the model inputs and relationships Ignore all random variation Deterministic A given input always produces the same output vs. Stochastic Stochastic models models Incorporate inherent randomness Use a range of values for the model variables in form of probability distributions The same input produces an ensemble of outputs Sanaa Alwidian (c) 22 The 4 stages of modelling 2. Generate predictions & Analyse 3. Validate 4. Apply 1. Build Similar process as for conducting a biological experiment: 1. Design the experiment 2. Generate data 3. Analyse experimental data 4. Validate experimental findings 5. Apply results in practice Sanaa Alwidian (c) 23 But modelling can be much more elaborative The 4 stages of modelling 2. Generate predictions & Analyse 3. Validate 4. Apply 1. Build Sanaa Alwidian (c) 24 Stage 1: Building models 1. Define the model objectives Be clear about what you want your model to do 2. Determine the appropriate level & key model components What level of simplification is required? Apply the principle of Ockham’s razor (also known as the law of parsimony): Sanaa Alwidian (c) 25 Stage 1: Building models (cont.) 3. Define your assumptions Assumptions reflect our beliefs how the system operates Remember: the model results are only as valid as the assumptions! Different assumptions can lead to fundamental differences: Mass is Mass is variable constant Isaac Newton: founder of classical mechanics Sanaa Alwidian (c) Albert Einstein: Founder of relativity theory 26 Example: A common assumption in population studies “ A population grows at a rate that is proportional to its size” Given that p(t) is the population size at time t and a is a constant. The solution of this model is 𝑝 𝑡 = 𝑝(0)𝑒𝑎𝑡, i.e. population grows exponentially Sanaa Alwidian (c) 27 3. Produce a flow diagram Visual tool for formulating our beliefs and assumptions Describe the model components (variables) and their relationship Extremely important for complex models with many components and relationships S I R Sanaa Alwidian (c) 28 5. Write model equations How to find the appropriate mathematical equations? Depends on the modelling approach: Statistical models are often represented by a single linear or non-linear function Deterministic mechanistic models of dynamical systems are usually represented by systems of differential equations Stochastic models require expressions for the probability of events Start with equations from the literature You are likely not the first one to model a specific system. Start by exploring and modifying existing models Explore your own data Sanaa Alwidian (c) 29 The 4 stages of modelling 2. Generate predictions & Analyse 3. Validate 4. Apply 1. Build Sanaa Alwidian (c) 30 Stage 2: Generate model predictions & analyse There are 2 ways of solving the model equations for given parameter values 1. Analytically (using mathematical principles) Ideal, provides exact solutions and hence a full insight of the model behaviour But usually only possible for very simple systems (e.g. one equation or system of linear equations) 2. Numerically (using computers) Applies to most mathematical models Requires the use of numerical algorithms implemented in computational routines (e.g. Euler method, Runge-Kutta, Monte-Carlo) Provides approximate solutions Use established code, avoid writing yourSanaa own Alwidian numerical (c) solver!!! 31 Specifying appropriate model inputs & outputs Modeller’s dilemma: lack of physical constraints in the modelling world implies that one can generate A LOT of data. How to go about it in a systematic way? 1. Specify realistic value ranges for the model input parameters 2. Focus on relevant scenarios if the model involves simulations 3. Generate relevant outputs & summary statistics Sanaa Alwidian (c) 32 Estimating model input parameter values Good estimates of the model input parameters are essential for models with predictive power Apply principle of Ockham’s razor: favour the model with fewer parameters 2 sources for determining appropriate parameter values: 1. Use values reported in the literature 2. Fit your model to existing data (statistical inference) Note that it is often not possible to infer a unique value (with confidence interval) for each model parameter from given data There are many different approaches of statistical inference; the right approach depends on both the type of model & the data Sanaa Alwidian (c) 33 Choosing relevant model scenarios & outputs Criteria for choosing model scenarios: Realistic scenarios, to achieve your research objective Extreme scenarios, to determine the limitations of the model Sanaa Alwidian (c) 34 Produce meaningful model outputs Models produce predictions for every variable over time Model variables are not always measurable → comparison to data difficult Produce also model outputs that can be directly compared to data essential for model validation Apply similar statistical analysis as for experimental data (frequency distributions, means, variance etc.) Assess relationships between observable and underlying traits useful for gaining new insights Sanaa Alwidian (c) 35 Analysing the model The aim is to obtain a thorough understanding about what your model can / cannot do Comprises both qualitative & quantitative analysis: What types of response patterns does the model generate? How realistic are these? What mechanisms / parameter values produce the diverse patterns? Which inputs correspond to which outputs? How sensitive are the model output to changes in the input parameter values? How stable are the model predictions to small changes in starting values / assumptions? Very elaborative step and often results in rebuilding the model Sanaa Alwidian (c) 36 Analysis techniques: Distinguish between short- and long-term behaviour 1. Asymptotic behaviour Does the system eventually settle to a steady state? E.g. will the infection eventually clear or persist? How many steady states (long-term outcomes) are there? Under what conditions will a particular steady state be reached 2. Initial phase behaviour E.g. will the infection kick off after introduction of 1 infectious agent? How does the initial behaviour depend on the starting point? Sanaa Alwidian (c) 37 Analysis techniques: Sensitivity analysis & Uncertainty analysis Uncertainty analysis: assess variability in model outputs that arise from uncertainty in model inputs How confident are we about the model predictions? Sensitivity analysis: quantifies the influence of each parameter or modelled process on the model outputs How sensitive are the model predictions to changes in the input parameter values or modelled processes? Sanaa Alwidian (c) 38 The 4 stages of modelling 2. Generate predictions & Analyse 3. Validate 4. Apply 1. Build Sanaa Alwidian (c) 39 Stage 3: Validating the model Ideally (but not necessarily!) involves comparison of model predictions to experimental data Important to use independent data to those used for parameter estimation If independent data don’t exist, split your data into training and validation set Useful summary statistics for comparing model predictions (Pi) to observations (Oi): 1 Bias (B) = ∑𝑖𝑛= (𝑃𝑖 − 𝑂𝑖) 𝑛 1 1 Standard deviation (SD) = ∑𝑖𝑛= (𝑃𝑖 − 𝑂𝑖 − 𝐵)2 𝑛 1 1 Prediction mean square error (MSE) = ∑𝑖𝑛= (𝑃𝑖 − 𝑂𝑖)2 𝑛 1 Sanaa Alwidian (c) 40 What if model predictions are different from the observations? Identify potential reasons for imperfect predictions: 1. Natural variability in the real system and environment Equates to experimental measurement errors Obtain confidence intervals directly from the data; if model predictions fall within these limits, don’t worry 2. Mis-specifications in the model Wrong parameter values → extend parameter range, use fitting algorithms Errors in the choice of model equations Restrict the scope of the model or look for better equations and start again 3. Effects of factors ignored in the model Increase model complexity and start again Sanaa Alwidian (c) 41 The 4 stages of modelling 2. Generate predictions & Analyse 3. Validate 4. Apply 1. Build Sanaa Alwidian (c) 42 Stage 4: Applying the model Mathematical models can be a valuable decision support tool For risk assessment – particularly important in infectious disease context To predict consequences of various (disease) control strategies It requires trust that the model predictions are valid It is crucial to keep the purpose of the model and the end user of the model in mind at all modelling stages The user should have a thorough understanding of the model assumptions, model predictions (with uncertainty estimates) and limitations Sanaa Alwidian (c) 43 What is a good model? Key attributes of a good model: 1. Fit for purpose As simple as possible, but sufficiently complex to adequately represent the real system without obstructing understanding Appropriate balance between accuracy, transparency and flexibility 2. For predictive models: Parameterizable from available data Keep in mind that no model is perfect! Sanaa Alwidian (c) 44 Further reading Introduction to mathematical modeling https://people.maths.bris.ac.uk/~madjl/course_text.pdf https://www.carroll.edu/sites/default/files/content/academics/mathematics/matht exts/IntroModeling_Notes.pdf Introduction to Mathematical Modeling and Computer Simulations https://library.oapen.org/bitstream/id/2be78417-de74-468d-b2c8- 1cee946c4881/9781315277240_oachapter1.pdf Mathematical Models https://www.mathsisfun.com/algebra/mathematical-models.html Sanaa Alwidian (c) 45 SOFE 2850: Natural Foundations for Information Technology Fall 2022 Dr. Sanaa Alwidian © Chapter 4: Waves – Part II Fall 2024: Dr. Mennatullah Siam Transverse vs. Longitudinal Waves A wave is characterized by Wavelength (λ , pronounced lambda) : The distance between two neighboring crests (measured in meters) Amplitude: The maximum displacement (measured in meters) Waves Properties A wave is characterized by: Frequency (f): The number of oscillations per second (measured in hertz – Hz). Wave speed (v): is the speed (velocity) at which a wave is travelling through the medium. (measured in meters per second – m/s) Period : The time required to complete one oscillation (i.e., covering two neighboring crests or troughs). The formula for calculating wave speed (v) is: Wave Speed (v)= Wavelength (λ) ×Frequency (f) Transverse vs. Longitudinal Waves A wave is characterized by Wavelength (λ , pronounced lambda) : The distance between two neighboring crests (measured in meters) Amplitude: The maximum displacement (measured in meters) Sinusoidal Waves ▪ The distance spanned by one cycle of the motion is called the wavelength λ ▪ During a time interval of exactly one period T, each crest of a sinusoidal wave travels forward a distance of exactly one wavelength λ. ▪ Because speed is distance divided by time, the wave speed must be v = λ×f Sinusoidal Waves Sinusoidal Waves Sinusoidal Waves Sinusoidal Waves Waves and Energy Waves are said to be an energy transport phenomenon. As a disturbance moves through a medium from one particle to its adjacent particle, energy is being transported from one end of the medium to the other. In a slinky wave, a person imparts energy to the first coil by doing work upon it. The first coil receives a large amount of energy that it subsequently transfers to the second coil. When the first coil returns to its original position, it possesses the same amount of energy as it had before it was displaced...and the process is repeated with the third coil, and so on Waves and Energy The rate at which a wave delivers energy to a surface is called: the intensity of the wave. For sound waves, a logarithmic decibel scale is used to characterize the intensity (or loudness) of a sound Brainstorming Question A wave on a string is traveling to the right. At this instant, the motion of the piece of string marked with a dot is ________. A. Up. B. Down. C. Right. D. Left. E. Zero. Instantaneously at rest. Brainstorming Question A wave on a string is traveling to the right. At this instant, the motion of the piece of string marked with a dot is ________. A. Up. B. Down. C. Right. D. Left. E. Zero. Instantaneously at rest. Sound and Light Sound vs. Light Sound Waves ▪ A sound wave in a fluid is a sequence of compressions and rarefactions. ▪ The variation in density and the amount of motion have been greatly exaggerated in this figure. ▪ The periodic compressions and rarefactions travel outward from the loudspeaker of a sound wave. ▪ This oscillating pressure cause the eardrum to vibrate which will be transferred to the inner ear to be perceived as sound. ▪ The speed of sound in the air depends on the temperature: 𝑇 𝐶 +273 𝑣𝑠𝑜𝑢𝑛𝑑 𝑖𝑛 𝑎𝑖𝑟 =331 m/s 273 Sound Waves ▪ Ultrasound produces pictures of the inside of the body using sound waves. ▪ Ultrasound uses a small probe called a transducer and gel placed directly on the skin. ▪ High-frequency sound waves travel from the probe through the gel into the body. ▪ The probe collects the sounds that bounce back. ▪ A computer uses those sound waves to create an image. ▪ Ultrasound images are captured in real- time, they can show the structure and movement of the body's internal organs. They can also show blood flowing through blood vessels. Applications of Electromagnetic Waves Microwave Oven Microwave oven is most familiar as the energy source for cooking food Principle: Generate microwave radiation of appropriate frequency in the working space of the oven where food is kept. The energy is directly delivered to water molecules which are shared by the entire food.. Magnetron tube converts high voltage into microwave frequency Wave guide disperses the waves into oven through stirrer. Then microwaves reflect back and forth with metal walls of oven through food. When microwave passes through water content of food, they cause water molecule to rotate at the same frequency of microwave (millions of time in one second). This rotation creates a friction, which heats up the food. RADAR RADAR is acronym for Radio Detection And Ranging RADAR is an electromagnetic system, used for sensing, detecting, and locating the object present in the ambience. Used to detect direction, speed, velocity, range, altitude of an object with the help of radio waves Radar find applications in various systems such as Air Traffic Control to track planes both on and off the grounds Used to track satellites RADAR Principle A short pulse (less than 1 sec) of electromagnetic radiation (radio wave f>109 Hz) is transmitted from a highly, directional antenna. The pulse is repeated 350-10000 cycles/s When this transmitted radiation hits a distant target, a part is reflected back and echo pulse is picked by receiver The time interval between transmitted and echo pulse provides an accurate measure of the distant target. Transmitted Power Output: For maximum distance communication, it is more than 1 MW Maximum Range: Depends upon energy of the transmitted pulse and sensitivity of receiving system Magnetic Resonance Imaging MRI It was developed in the 1980s to use radio waves to diagnose illnesses with a strong magnet and a radio wave emitter and a receiver. Protons in H atoms of the body act like magnets lining up with the field. This releases energy which the receiver detects and creates a map of the body’s tissues. Ultraviolet Waves EM waves with wavelengths from about 400 billionths to 10 billionths of a meter. Have enough energy to enter skin cells Longer wavelengths – UVA Shorter wavelengths – UVB rays Both can cause skin cancer Can UV radiation be useful? Helps body make vitamin D for healthy bones and teeth Used to sterilize medical supplies & equip Detectives use fluorescent powder (absorbs UV & glows) to find fingerprints X Rays and Gamma Rays EM waves with shortest wavelength & highest frequency High Energy- go through skin & muscle High level exposure causes cancer Both can be used in radiation therapy to kill diseased cells. Radio Transmission Radio stations change sound to EM waves & then your radio receiver changes the EM waves back to sound waves again. Global Positioning System (GPS) Satellites and Receivers Each satellite sends signals indicating its position relative to the receiver. This is an animation of 24 GPS satellites with 4 satellites in each of 6 orbits. It shows how many satellites are visible at any given time. This ensures redundancy to ensure accuracy. Global Positioning System (GPS) The mathematics of GPS The intersection of two spheres is either empty or a circle. The circle will intersect a third sphere in at most two points. This geometric fact is the basis of GPS since other factors can be used to eliminate one of the two points as being an irrelevant solution to the problem. Global Positioning System (GPS) Satellites and signals Each satellite of the network sends a signal indicating its position and the time of the transmission of the signal. Since signals travel at the speed of light, the receiver can determine the radial distance of the satellite from the receiver. Many think that the receivers transmit information to the satellites, whereas in reality, it is the other way around. The receiver then uses basic math to determine its position. Summary Summary ▪ A transverse wave is a wave in which the displacement is perpendicular to the direction in which the wave travels. ▪ For example, a wave travels along a string in a horizontal direction while the particles that make up the string oscillate vertically. ▪ Electromagnetic waves are transverse waves: the electromagnetic field oscillates in perpendicular to the direction in which the wave travels. Summary Natural Foundations for Information Technology (SOFE 2850U) Lecture 4 – Part 1: Waves Fall 2024 Dr. Mennatullah Siam Learning Objectives By the End of this chapter, you will learn: The basic concept of waves Types of waves The basic properties of travelling waves. Why waves are important 2 Overview Waves are everywhere. A few examples of our daily encounters with waves: Sound waves, visible light waves, radio waves, microwaves, water waves, stadium waves, earthquake waves, waves on a string, and slinky waves. We study the physics of waves because it provides a rich indication into the physical world that we seek to understand and describe. 3 Why Waves are Important? Waves are literally everywhere. Waves are present in the oceans, the atmosphere, and the earth. Communications systems from radios to cell phones to fiber optics use waves. Sonar and radar and medical ultrasound use waves. Music and musical instruments are all about waves. 4 What is a Wave A wave is a disturbance travelling through a medium ( and transferring energy) from one location to another. 5 What is a Wave (cont.) A wave is a disturbance travelling through a medium Disturbance: The act of creating the wave  E.g.,moving the first coil of the slinky in a given direction and then returning it to its rest position creates a disturbance in the slinky. 6 What is a Wave (cont.) A wave is a disturbance travelling through a medium Disturbance: The act of creating the wave  E.g., the act of throwing a stone in a water creates a disturbance in the water pond. 7 What is a Wave (cont.) A wave is a disturbance travelling through a medium Medium Analogy: The news (or social) media is merely the thing that carries the news from its source to various locations. Similarly, a wave medium is the substance that carries a wave (or disturbance) from one location to another. The wave medium is not the wave itself, and it doesn't make the wave. It merely carries or transports the wave from its source to other locations. 8 Types of Waves Based on medium Mechanical Electromagnetic 9 Types of Waves Mechanical waves are waves that require a medium. Should have some sort of matter to travel through. These waves travel when molecules in the medium collide with each other passing on energy. One example of a mechanical wave is sound. It needs the medium to help it travel Sound can travel through air, water, or solids, but it can't travel through a vacuum. Other examples include water waves, seismic waves, and waves traveling through a spring. 10 Types of Waves (cont.) Electromagnetic waves: waves that can travel through a vacuum (empty space). They don't need a medium or matter. They travel through electrical and magnetic fields that are generated by charged particles. Examples of electromagnetic waves include light, microwaves, radio waves, and X-rays. 11 The Electromagnetic Spectrum 12 Types of Waves Based on Direction Transversal Longitudinal 13 The Displacement ▪ In “the wave” at a sporting event, the wave moves around the stadium, but the particles (people) undergo small displacements from their equilibrium positions. ▪ When describing a wave mathematically, we’ll use the generic symbol D to stand for the displacement of a wave of any type. ▪ D(x, t) = the displacement at time t of a particle at position x. 14 Types of Waves A Transverse wave : the displacement is perpendicular to the direction of the travel (and energy) 15 Types of Waves A Transverse wave : the displacement is perpendicular to the direction of the travel Crest Trough The highest point is called “Crest,” and the lowest point is called “Trough.” 16 Examples of Transverse Waves 17 Types of Waves A Longitudinal wave: the displacement is parallel to the direction of travel 18 Brainstorming Question A transverse wave is transporting energy from east to west. The particles of the medium will move: A. East to west only B. Both eastward and westward C. North to south only D. Both northward and southward 19 Brainstorming Question A transverse wave is transporting energy from east to west. The particles of the medium will move: A. East to west only B. Both eastward and westward C. North to south only D. Both northward and southward 20 Properties of Waves A wave is characterized by Wavelength (λ , pronounced lambda) : The distance between two neighboring crests (measured in meters) Amplitude: The maximum displacement (measured in meters) 21 Properties of Waves (cont.) A wave is characterized by: Frequency (f): The number of oscillations per second (measured in hertz – Hz). Wave speed (v): is the speed (velocity) at which a wave is travelling through the medium. (measured in meters per second – m/s) Period : The time required to complete one oscillation (i.e., covering two neighboring crests or troughs). The formula for calculating wave speed (v) is: Wave Speed (v)= Wavelength (λ) ×Frequency (f) 22 Sinusoidal Waves ▪ The distance spanned by one cycle of the motion is called the wavelength λ ▪ During a time interval of exactly one period T, each crest of a sinusoidal wave travels forward a distance of exactly one wavelength λ. ▪ Because speed is distance divided by time, the wave speed must be v = λ×f 23 Brainstorming Question The period of this wave is A. 1s B. 2s C. 4s D. Not enough information to tell. 24 Brainstorming Question The period of this wave is A. 1s B. 2s C. 4s D. Not enough information to tell. 25 Brainstorming Question A wave at sea travels with a velocity of 25m/s. If it has a wavelength of 10m, what is its frequency? A. 2.3 Hz B. 2.4 Hz C. 2.5 Hz D. 2.5 Hz 26 Brainstorming Question A wave at sea travels with a velocity of 25m/s. If it has a wavelength of 10m, what is its frequency? Solution: Wave Speed (v)= Wavelength (λ) ×Frequency (f) ➔ f=v/ λ f = 25/10 F =2.5 Hz 27 Brainstorming Question Lizzy reads the back label of her microwave oven. It says frequency = 2,450MHz. If the speed of microwaves is 3.00 x 108 m/s, what wavelength are they? A. 1000 m B. 12200 m C. 0.122m D. 12.2 m 28 Brainstorming Question Lizzy reads the back label of her microwave oven. It says frequency = 2,450MHz. If the speed of microwaves is 3.00 x 108 m/s, what wavelength are they? Solution: The first thing you must do to answer this question is convert the frequency to the standard units, which means converting from MHz to Hz (1 MHz = 106 Hz). So 2,450 MHz = 2,450 x 106 Hz. Wave Speed (v)= Wavelength (λ) ×Frequency (f) ➔ Wavelength= v/f = 3.00 x 108/ 2,450 x 106 = 0.122m 29 Exercise 1 An electromagnetic wave travels at a speed of 300,000,000 m/s and has a wavelength of 15cm. Calculate the frequency of the electromagnetic wave. 30 Exercise 1 An electromagnetic wave travels at a speed of 300,000,000 m/s and has a wavelength of 15cm. Calculate the frequency of the electromagnetic wave. 31 Exercise 2 A TV station broadcasts at 500,000 kHz. The waves travel through the air at 300,000,000 m/s. Calculate the wavelength of the waves broadcast by this station. 32 Exercise 2 A TV station broadcasts at 500,000 kHz. The waves travel through the air at 300,000,000 m/s. Calculate the wavelength of the waves broadcast by this station. 33 Natural Foundations for Information Technology (SOFE 2850U) Lecture 3: Device Theory and Memory System Fall 2024 Dr. Mennatullah Siam 2 Learning Objectives By the end of this chapter, you will learn: The basic Components of the Computer/memory How bits are stored in the memory. The main types of the memory. Basics of Digital Logic Design 2 3 Put Things Together We studied numbering systems (Decimal and Binary) Converting between numbering systems We studied Data and their representation Numbers (whole and fractional), Text, colors, images, etc. Now, it is time to learn how data is actually stored in the computers. Have a close look at the inside of the computer (Electronics and their relation to IT) Types of Memory Digital Logic Design 3 What is inside the Computer? 5 Computer Components Let’s take a closer look: https://edu.gcfglobal.org/en/computerbasics/inside-a-computer/1/ 5 6 Computer Components Motherboard: Computer’s main circuit board. Holds the CPU, memory, connectors for the hard drive and optical drives, expansion cards to control the video and audio, and connectors (such as USB ports). Allows communication to and between the CPU, RAM, and all other computer hardware components. 6 7 Computers Components (Cont.) Motherboard Jargon (Electrical Components) Inductor Capacitor CPU socket BIOS Diode Resistor LED Cash Memory Bus Semiconductor More Components: https://www.computerhope.com/jargon/m/mothboar.htm 7 SOFE 2850U- Chapter 3 8 Computers Components (Cont.) Motherboard Jargon (Electrical Components) Inductor: aka coil, choke, or reactor, is a passive two-terminal electrical component that stores energy in a magnetic field when electric current flows through it. Capacitor: aka condenser, is a passive electronic component with two terminals that stores electrical energy in an electric field. CPU Socket: connection that allows a computer processor to Socket connect to a motherboard. 8 9 Computers Components (Cont.) Motherboard Jargon (Electrical Components) Diode BIOS: (Basic Input/Output System), allows to access and set up computer system at the most basic level & includes instructions on how to load basic computer hardware Diode: a semiconductor device that allows electrical current to flow in only one direction. Diodes uses include signal limiters, voltage regulators, rectifiers, switches, modulators, LED: LED is a semiconductor that illuminates when an electrical charge passes through it. Resistor: One of the most commonly found components in an electronic circuit. Resistors help restrict and impede a current flow. 9 10 Conductor Computers Components (Cont.) Other Important Jargon Conductor: is a material that transmits electrical currents, heat, or sound. Insulator  Examples: aluminum, brass, bronze, copper, graphite, gold, iron, mercury, silver, steel Insulator: is a material that resists or prevents the carrying of electricity, heat, or sound. Some examples of electricity insulators are glass and most rubbers. Semiconductor: Materials that have the resistance levels between those of a conductor and an insulator  Good examples of semiconductor materials are germanium, selenium, and silicon. Transistor Transistor: is a semiconductor device used to amplify or switch electronic signals and electrical power. 10 11 Remember! Natural Foundation for Information Technology! When we talk about conductors, insulators and semiconductors, there is Chemistry & Physics behind! Theories From Quantum Mechanics Fundamental theory in physics that provides a description of the physical properties of nature at the scale of atoms and subatomic particles. It is the foundation of all quantum physics including quantum chemistry, quantum field theory, quantum technology, and quantum information science. “I think it is safe to say that no one understands quantum mechanics.” —Physicist Richard P. Feynman 11 12 Remember! Quantum Chemistry: The maximum number of electrons that any shell may hold is described by the equation 2n2, where “n” is the principal quantum number. Thus, the first shell (n=1) can hold 2 electrons; the second shell (n=2) 8 electrons, and the third shell (n=3) 18 electrons. Orbitals not to scale. 12 13 Remember! Periodic Table and Theory of Reactions between elements Material properties depend on outer electron shell. Format of periodic table associates population of outer shell with columns (groups). 13 14 Chemical Properties of Conductors Have one electron in the outer shell. These atoms readily give away one electron to react with other elements. The ability to easily give away an electron makes these elements excellent conductors. Lithium Sodium Potassium Copper Silver Gold 14 15 Chemical Properties of Insulators Have seven electron in the outer shell. These elements readily accept an electron to fill up the outer shell with a full 8 electrons. If these elements do accept an electron, a negative ion is formed from the neutral atom. These elements which do not give up electrons are insulators. Fluorine Chlorine Bromine Iodine 15 16 Computer Components Back to Computer Components… 16 17 Computers Components: CPU Central Processing Unit (CPU): Computer’s brain. Carry out commands. Whenever you press a key, click the mouse, or start an application, you're sending instructions to the CPU. The CPU is a two-inch ceramic square with a silicon chip located inside. The CPU fits into the motherboard's CPU socket, – which is covered by the heat sink, an object that absorbs heat from the CPU. A CPU’s speed is measured in megahertz (MHz), or millions of instructions per second; and gigahertz (GHz), or billions of instructions per second. – However, the actual speed of the computer depends on the speed of many different components—not just the processor. 17 Basic Components of the Memory 20 Computers Components: Memory Implemented as semiconductor memory 20 21 RAM: Random Access Memory RAM: Random Access Memory Short-term memory (Volatile) Calculations temporarily stored at RAM until needed. disappears when the computer is turned off.  Ifyou're working on a document, spreadsheet, or other type of file, you'll need to save it to avoid losing it.  When you save a file, the data is written to the hard drive, which acts as long- term storage. RAM is measured in megabytes (MB) or gigabytes (GB). The more RAM you have, the more things your computer can do at the same time.  Many people add extra RAM to their computers to improve performance. 21 22 Types of RAM: Dynamic and Static Dynamic RAM (or DRAM): Stores each bit of data in a memory cell consisting of a tiny capacitor and a transistor,  both typically based on metal-oxide-semiconductor (MOS) technology. The capacitor can either be charged or discharged; these two states are taken to represent the two values of a bit, 0 and 1. The electric charge on the capacitors slowly leaks off ➔ data on the chip would soon be lost.  ➔ DRAM requires an external memory refresh circuit which periodically rewrites the data in the capacitors, restoring them to their original charge. 22 23 Types of RAM: Dynamic and Static Static RAM (or SRAM): Uses latching circuitry (flip-flop) to store each bit. SRAM is volatile memory; data is lost when power is removed. Unlike DRAM, SRAM does not need to be periodically refreshed. SRAM is faster and more expensive than DRAM; Used for the cache and internal registers of a CPU while DRAM is used for a computer's main memory. 23 24 ROM: Read Only Memory Non-volatile (hard-wired) memory Data cannot be electronically modified after the manufacture of the memory device. Useful for storing software that is rarely changed during the life of the system, also known as firmware. 24 25 Types of ROM Programmable read-only memory (PROM): The data are permanent and cannot be changed. PROMs are used in digital electronic devices to store permanent data, usually low level programs such as firmware or microcode. The key difference from a standard ROM:  ROM: the data is written during manufacturing.  PROM the data is programmed into them after manufacturing. Thus, ROMs used only for large production runs with well-verified data, while PROMs are used to allow companies to test on a subset of the devices before burning data into all of them. 25 26 Types of ROM Erasable Programmable read-only memory (EPROM): Type of PROM Retains its data when its power supply is switched off. It is an array of floating-gate transistors individually programmed by an electronic device that supplies higher voltages than those normally used in digital circuits. Once programmed, an EPROM can be erased by exposing it to strong ultraviolet light source (such as from a mercury-vapor lamp). 26 27 Types of ROM Electrically Erasable Programmable read-only memory (EEPROM): Non-volatile memory used in computers, integrated in microcontrollers for smart cards and remote keyless systems, and other electronic devices. Stores relatively small amounts of data by allowing individual bytes to be erased and reprogrammed. Can programmed and erased in-circuit, by applying special programming signals. An EEPROM has a limited life for erasing and reprogramming, now reaching a million operations in modern EEPROMs. Flash memory is an example of EEPROM. 27 28 Basic organization of DRAM internals The DRAM memory array is a grid of storage cells, where one bit of data is stored at each intersection of a row and a column. https://www.futurelearn.com/info/courses/how-computers- work/0/steps/49282 28 29 Basic organization of DRAM internals This is memory cell, Consists of a transistor and a capacitor (a component that can hold an electric charge). The transistor allows the capacitor to be charged. A fully charged capacitor would represent a 1, and a discharged capacitor would represent 0. 29 30 Basic organization of DRAM internals These are memory cells, can be arranged in a grid. E.g., a grid that is eight memory cells across Any of these cells can be accessed randomly and a 1 or 0 written into the memory cell 30 Thank you ☺ Questions? SOFE 2850U- Chapter 3 31 31 Natural Foundations for Information Technology (SOFE 2850U) Lecture 4: Representation of Information (Part 3) Fall 2024 Dr. Mennatullah Siam Learning Objectives By the end of this lecture, you will be able to: ▪ Explain how characters are represented in computers ▪ E.g. using ASCII and Unicode ▪ Explain how colours, images, sound and movies are represented. 2 Preview: Previous Two Lectures Part1: Number Systems: Decimal, and Binary Systems Conversion between Two Number Systems with Fractional Part. Part 2: Number Representation Whole Numbers Fraction Numbers 3 Today’s Lecture (Part 3): Outline Data Representation Text Numbers Images Audio Video 4 Data Representation What is Data? Data is information that has been translated into a form that is more convenient to process As information take different forms, the most efficient way is to represent all forms of information using a universal format. 6 Data Types Multimedia Word Engineering Image Audio play Video processing programs processing program display programs programs programs 7 Information Coding and Decoding Human senses deal with a variety of information (signals). Input devices of computer translates these information into electrical signals. Electrical signals are then translated into universal format (0s,1s), this is known as coding. After processing, output devices transform back data into their original form, this is known as decoding 8 Text Representation Written text is made of alphabetical symbols (letters). E.g, in English there are 26 uppercase and 26 lowercase letters. Each of those symbols is represented by distinctive bit- pattern (code).  Bit pattern: blocks of bits Example: Representation of word “BYTE” 9 Code System for Text Representation There are about 5 code systems used to represent alphabetical symbols: 1. ASCII (American Standard Code for Information Interchange) 2. Extended ASCII 3. EBCDIC (Extended Binary Coded Decimal Interchange Code) 4. Unicode (Universal Code) 5. ISO (International Organization for Standardization) 10 Character Representation- ASCII ASCII (American Standard Code for Information Interchange) It is the scheme used to represent characters. Each character is represented using 7-bit binary code. If 8-bits are used, the first bit is always set to 0 11 ASCII Table 12 Character Strings How to represent character strings? A collection of adjacent “words” (bit-string units) can store a sequence of letters 'H' 'e' 'l' 'l' o' ' ' 'W' 'o' 'r' 'l' 'd' '\0' null character defines end of string  Null is sometimes written as '\0'  Its binary representation is the number 0000 0000 Example: ASCII 66 89 84 69 13 Exercise Use the ASCII table to write the ASCII code for the following: SOFE2850U 6=2*3 14 Character Representation- Unicode ASCII code can represent only 128 = 27 characters. It only represents the English Alphabet plus some control characters. Unicode is designed to represent the worldwide interchange. It uses 16 bits and can represents 216=65536 characters. For compatibility, the first 128 Unicode are the same as the one of the ASCII. 15 Color Representation Colors can be represented by using a sequence of bits. 256 colors – how many bits? Hint for calculating  To figure out how many bits are needed to represent a range of values, figure out the smallest power of 2 that is equal to or bigger than the size of the range.  That is, find x for 2 x >= 256 24-bit color – how many possible colors can be represented? Hints  Around 16 million possible colors (why 16 millions?) 16 Color Representation 24-bits -- the True color 24-bit color is often referred to as the true colour. Any real-life shade, detected by the naked eye, will be among the 16 million possible colours. 17 Color Representation Example: 2-bit per pixel 22 = 4 choices 00 (off, off)=white = (white) 0 01 (off, on)=light 0 grey = (light grey) 10 (on, off)=dark 0 grey 1 11 (on, on)=black = (dark grey) 1 0 = (black) 1 1 18 18 Image Representation Image representation methods 19 Image Representation An image can be divided into many tiny squares, called pixels. (pi(x)cture element. Stored as a binary number. Each pixel has a particular colour. The resolution of an image is the density of pixels (pixels/inch or ppi) The higher the resolution, the more information the image contains. 20 Bitmap Images The term bitmap refers to how a given pattern of bits in a pixel maps to a specific color. A bitmap images take the form of an array of pixels (each value correspond to the color of that pixel). Each horizontal line in the image is called a scan line. Example: each point below is represented by a 4-bit code corresponding to 1 of 16 shades of gray 21 Pixel Color (Black & white) For black and white images, only 1 bit-patterns are needed (21=2 bits) Remember: 0➔ White, 1 ➔ Black The rows of patterns are then stored in the memory. Example: Bitmap graphic method of a black-and-white image 22 Pixel Color (gray scale) To represent a gray-scale image of 4 colors (for example) we need to increase the length of bit-pattern representing the pixel to be 2-bits. In this case 00→ white pixel 01→ light gray pixel 10→ dark gray pixel 11→ black pixel 23 Pixel Color (colored pixel) The most common way to model color in Computer Graphics (for both CRT and LCD monitors) Any visible color could be constructed from the 3 basic colors Red, Green, Blue (RBG) The difference between one color and another depends on the intensity of the RBG colors in the color Therefore, to represent a colored image, each pixel in the image must be represented by 3 different bit-patterns.  Each of them represent the intensity of the basic colors. The length of a bit pattern representing each basic color is usually 8 bits 24 Pixel Color (colored pixel) 25 RGB Color Code Try this… Lots of fun ☺ https://www.rapidtables.com/web/color/RGB_Color.html 26 Image Compression Image compression reduces the amount of memory needed to store an image Compression ratio: the ratio between the compressed image and the uncompressed image Lossless Image Compression: Lossy Image Compression: takes advantage of the human eyes ability to hide imperfection JEPG: uses Discrete Cosine Transform DCT 27 Image File Format The Graphics Interchange Format (GIF) Easy, but cannot be used for high-precision color, since only 8-bits are used to encode color. Tag Image File Format (TIFF) very general and very complex It uses up to 24 bit JPEG format for still photos JPEG (JFIF/JFI/JPG) is a more recent standard from the Joint Photographic Experts Group An image can have up to 64k x 64k pixels of 24 bits each 28 Image File Format PostScript The family of formats BDF/PDL/EPS store image data using printable ASCII characters. Pixels values are encoded via 7-bit ASCII codes, so these files can be examined and changed by a text editor MPEG (Motion Picture Experts Group) format for video MPEG ( MPG/MPEG-1/MPEG-2) is a stream-oriented encoding scheme for video, audio, text and graphics. Example: MPEG-2 standard provides for up to 15 Mbits per second data rates to handle high definition TV rates 29 Vector Graphic Image is decomposed into lines and curves.  Each curve and line is represented by a mathematical formula. The mathematical formula is stored.  No bit-patterns are stored Example: a line is described by its coordinates, the circle is described by the coordinates of its center and length of the radius. Advantage: the image can be scaled by multiplying the formula by the scale factor without effecting the image resolution as in bitmap representation Shapes can be edited by moving points called nodes (drawing points) Node Handle 30 Vector Graphic Examples Original Image Resized Image Shapes that make up the image. 31 Vector Graphic Uses of Vector Graphics Graphics that will be scaled (or resized) Architectural drawings and CAD programs Flow charts Logos that will be scaled (resized) Cartoons and clip art Graphics on websites  Because they have very small file sizes.  This allows them to load quickly. Fonts and specialized text effects 32 Vector Graphic Advantages of Vectors Resolution Independent Regardless of how much the image is enlarged or reduced, the image definition and quality remain the same. Small File Sizes Easily transferred over the Internet. Disadvantages of Vectors Lower color quality than bitmap images. They do not support as many colors. Not good for photographic images. 33 Vector Graphic Popular Vector Graphic Software Xara Xtreme Adobe Illustrator CorelDraw Inkscape – open source software similar to Adobe Illustrator. 34 Self Reading Audio Representation Audio is sound Sound signal is analog signal The representation of audio signal requires converting analog signal into digital signal (A/D) 36 Audio Representation Representing Sound Graphically X axis: time A: amplitude (volume) Signal period T = inverse of frequency = 1/f Wavelength:  = c/f ( c is the speed of light 3108m/s) A- -A - 37 Audio Representation Sampling Sampling is a method used to digitise sound waves. A sample is the measurement of the amplitude (volum) at a point in time. The quality of the sound depends on:  The sampling rate, the faster the better  The size of the word used to represent a sample. 38 Audio Representation Sampling Capture amplitude at these points Lose all variation between data points Zoomed Low Frequency Signal 39 Audio Representation Sampling Rate So we want to sample an audio wave every so often. The question is: how “often” is “often enough”? Harry Nyquist of Bell Labs addressed this question in a 1925 paper concerning telegraph signals. Thus, we have the sampling theorem (also called the Nyquist theorem):  To represent digitally a signal containing frequency components up to X Hz, it is necessary to use a sampling rate of at least 2X samples per second. In theory, since the maximum audible frequency is 20 kHz, a sampling rate of 40 kHz would be sufficient to re-create a signal containing all audible frequencies For most frequencies, we will oversample The sampling rate for audio CDs is 44.1 kHz. 40 Audio Representation Quantization The accuracy of our measurement depends on how many bits we have to represent these values. Clearly, the more bits we have, the finer the resolution of our ruler. 2 bits Each change of bit represents a change in voltage level 41 Audio Representation Quantization 3 bits Each change of bit represents a change in voltage level 4 bits Each change of bit represents a change in voltage level 42 Audio Representation Quantization CD audio uses 16-bit quantization. Size of Audio Files: 44,100 x 2 x 2 x 60 ≈ 10 MB/minute samples bytes per channels seconds per second sample (for stereo per minute (16 bits) audio) 43 Audio Representation Digitizing Sound 44 Natural Foundations for Information Technology (SOFE 2850U) Lecture 2: Representation of Information (Part 2) Fall 2024 Dr. Mennatullah Siam Learning Objectives By the end of this Chapter, you will be able to: ▪ Explain how integers are represented in computers using: ▪ Unsigned, signed magnitude, excess, and two’s complement notations ▪ Explain how fractional numbers are represented in computers ▪ Floating point notation (IEEE 754 single format) ▪ Calculate the decimal value represented by a binary sequence in: ▪ Unsigned, signed notation, excess, two’s complement, and the IEEE 754 notations. ▪ Explain how characters are represented in computers ▪ E.g. using ASCII and Unicode ▪ Explain how colours, images, sound and movies are represented. 2 Preview: Previous Lecture (Part 1) Number Systems: Decimal, and Binary Systems Conversion between Two Number Systems with Fractional Part. 3 Today’s Lecture (Part 2): Outline Computer Memory Number Representation Whole Numbers Fraction Numbers 4 Computer Memory and Number Representation Computer Memory Computer uses a fixed number of bits to represent a piece of data, which could be a number, a character, or others. ( n-bits → 2n distinct entities). The computer memory location merely stores a binary pattern.  Itis up to the programmer, to decide on how these patterns are to be interpreted. For example, the 8-bit binary pattern "0100 0001" can be interpreted as an unsigned integer 65, or an ASCII character 'A', or some secret information known only to you. 6 Computer Memory Computers store data in memory in binary. One thing that is often overlooked is the formatting at the byte level of this data. This is called endianness and it refers to the ordering of the bytes. 7 Big Endian vs. Little Endian Modern computers store one byte of data in each memory address or location, i.e., byte addressable memory. A 32-bit integer is, therefore, stored in 4 memory addresses. The term "Endian" refers to the order of storing bytes in computer memory. In "Big Endian" scheme, the most significant byte is stored first in the lowest memory address (or big in first), In "Little Endian" stores the least significant bytes in the lowest memory address. In a sense, big-endian is the “normal” way to write things down. E.g., 0x12345678, we write it with the most significant byte first (the 12 part). 8 Big Endian vs. Little Endian: Examp

Use Quizgecko on...
Browser
Browser