SlideShare a Scribd company logo
NumericalMethods
Lecture 1
Representation of Numerical Values in the Computer
Overview
– Number Systems
– Number Conversion
– Representation of Numbers
– Computer Arithmetic
– Errors in Arithmetic
Tashreef Muhammad 2
NumberSystems
Let us discuss mainly about “Positional Number
Systems”
Tashreef Muhammad 3
Number Systems
– Non-positional Number Systems
– Positional Number Systems
– Decimal
– Binary
– Hexadecimal
Tashreef Muhammad 4
NumberConversion
Converting numbers represented in one format, to
other
Tashreef Muhammad 5
Number Conversion
– Decimal to Non-decimal Number
– Non-decimal to Decimal Number
– Binary to Hexadecimal Number
– Hexadecimal to Binary Number
Tashreef Muhammad 6
Representationof
Numbers
How modern computers store and represent numbers
Tashreef Muhammad 7
Representation of Numbers
– Dependent on words
– Words are a number of bits
– Word size varies from machine to machine
– Computers process using binary
– Humans easily understand decimal
– Hexadecimal expresses more in less digits
Tashreef Muhammad 8
Representation of Numbers
– Integer Representation
– For word size n, maximum possible number to store is 2n – 1
– Negative numbers are stored as 2’s complement
– The use of sign bit makes the highest possible number 2n-1 – 1
– First toggle all the bits of the number
– Add 1 to the whole number
– Use the sign bit as it is
Tashreef Muhammad 9
Representation of Numbers
– Floating Point Representation
– Exponential form, 𝑥𝑥 = 𝑓𝑓 × 10𝐸𝐸
– 𝑓𝑓 is mantissa and 𝐸𝐸 is exponent
– The entire memory location is divided to three parts
– Sign, mantissa and exponent
– Typically 24 bits for mantissa and 7 bits for exponent are used on a
32 bit word representation system
Tashreef Muhammad 10
Representation of
Numbers
A sample floating point representation from
Numerical Methods textbook (Figure 3.1)
Tashreef Muhammad 11
SIGN EXPONENT MANTISSA
1 bit 7 bits 24 bits
0
24 23
31 30
Representation of Numbers
– Floating Point Representation
– Shifting of decimal pints  Normalisation
– Numbers in normalized form  Normalised Floating Point Numbers
– Two possible notations: 0.596 x 10-2 or .596E-2
– Conditions to be satisfied by mantissa, 𝑓𝑓
– For positive numbers: 0.1 ≤ 𝑓𝑓 < 1.0
– For negative numbers: −1 < 𝑓𝑓 ≤ −0.1
– In general: 0.1 ≤ |𝑓𝑓| < 1.0
Tashreef Muhammad 12
ComputerArithmetic
How computers process arithmetic operations
Tashreef Muhammad 13
Computer Arithmetic
– Integer Arithmetic
– Integer arithmetic always results in integer
– Exception:
– Cannot represent infinite numbers, bounded above and below
– Integer division provides two results: quotient and remainder
– Sample integer arithmetic:
– 25 + 12 = 37, 25 - 12 = 13, 12 – 25 = -13
– 25 x 12 = 300, 25 ÷ 12 = 2, 12 ÷ 25 = 0
– Show the following is incorrect for integer arithmetic
–
𝑎𝑎+𝑏𝑏
𝑐𝑐
=
𝑎𝑎
𝑐𝑐
+
𝑏𝑏
𝑐𝑐
Tashreef Muhammad 14
Computer Arithmetic
– Floating Point Arithmetic: Addition
– Let 𝑥𝑥 and 𝑦𝑦 be added to result in 𝑧𝑧; where 𝑥𝑥 ≥ 𝑦𝑦
– The fractional parts: f𝑥𝑥, f𝑦𝑦, f𝑧𝑧
– The exponent parts: E𝑥𝑥, E𝑦𝑦, E𝑧𝑧; where E𝑥𝑥 ≥ 𝐸𝐸𝑦𝑦
– Algorithm:
– Set E𝑧𝑧 = max(E𝑥𝑥, E𝑦𝑦)  E𝑧𝑧 = E𝑥𝑥
– Shift f𝑦𝑦 to the right by E𝑥𝑥 − E𝑦𝑦 places
– Set f𝑧𝑧 = f𝑥𝑥 + f𝑦𝑦
– Normalize if necessary
Tashreef Muhammad 15
Computer Arithmetic
– Floating Point Arithmetic: Subtraction
– Addition with different sign bits
– May result in mantissa overflow
– Left shift f𝑧𝑧 and decrease E𝑧𝑧 accordingly
Tashreef Muhammad 16
Computer Arithmetic
– Floating Point Arithmetic: Multiplication
– Multiply mantissa, f𝑧𝑧 = 𝑓𝑓𝑥𝑥 × 𝑓𝑓𝑦𝑦
– Add the exponents, E𝑧𝑧 = 𝐸𝐸𝑥𝑥 + 𝐸𝐸𝑦𝑦
– Normalise if necessary
Tashreef Muhammad 17
Computer Arithmetic
– Floating Point Arithmetic: Division
– Divide mantissa, f𝑧𝑧 = 𝑓𝑓𝑥𝑥 ÷ 𝑓𝑓𝑦𝑦
– Subtract the exponents, E𝑧𝑧 = 𝐸𝐸𝑥𝑥 − 𝐸𝐸𝑦𝑦
– Normalise if necessary
Tashreef Muhammad 18
Computer Arithmetic
– Floating Point Arithmetic: Practice
– Add 0.964572 E2 and 0.586351 E5
– Add 0.735816 E4 and 0.635742 E4
– Subtract 0.994576 E-3 from 0.999658 E-3
– Multiply 0.20 E4 and 0.40 E-2
– Divide 0.876543 by 0.200000 E-3
Tashreef Muhammad 19
Computer Arithmetic
– Floating Point Arithmetic: Practice Answers
– Add 0.964572 E2 and 0.586351 E5  0.587315 E5
– Add 0.735816 E4 and 0.635742 E4  0.1371558 E5
– Subtract 0.994576 E-3 from 0.999658 E-3  0.508200 E-5
– Multiply 0.20 E4 and 0.40 E-2  0.80 E1
– Divide 0.876543 by 0.200000 E-3  0.438271 E-1
Tashreef Muhammad 20
ErrorsinArithmetic
Errors that are seen in arithmetic operations
Tashreef Muhammad 21
Errors in Arithmetic
– Floating Point Arithmetic
– Inexact binary representation of decimal number: 0.1 to
0.0001100110011…
– Errors due to rounding-off a number: Add the numbers
0.500000 E1 and 0.100000 E-7
– Subtractive cancellation: Subtract 0.499998 from 0.500000
– Overflow or underflow of numbers
Tashreef Muhammad 22
Errors in Arithmetic
– Laws of Arithmetic
– Errors in arithmetic induce error in associative and distributive law
errors
– 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 ≠ 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 and 𝑥𝑥 × 𝑦𝑦 × 𝑧𝑧 ≠ 𝑥𝑥 × 𝑦𝑦 × 𝑧𝑧
– 𝑥𝑥 × 𝑦𝑦 + 𝑧𝑧 ≠ 𝑥𝑥 × 𝑦𝑦 + 𝑥𝑥 × 𝑧𝑧
– Provide an example where associative law of addition fails due to
an arithmetic error of floating point number
– 𝑥𝑥 = 0.456732 × 10−2
, 𝑦𝑦 = 0.243451, 𝑧𝑧 = −0.248000
– 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 ≠ 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧
Tashreef Muhammad 23
Thank You
Tashreef Muhammad 24

More Related Content

What's hot

Floating point arithmetic operations (1)
Floating point arithmetic operations (1)Floating point arithmetic operations (1)
Floating point arithmetic operations (1)
cs19club
 
Chap8 new
Chap8 newChap8 new
Chap8 new
Loc Tran
 
Associative memory 14208
Associative memory 14208Associative memory 14208
Associative memory 14208
Ameer Mehmood
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
Omprakash Chauhan
 
Heaps
HeapsHeaps
Computer Graphics - Output Primitive
Computer Graphics - Output PrimitiveComputer Graphics - Output Primitive
Computer Graphics - Output Primitive
Rupesh Mishra
 
Heap
HeapHeap
Coal 21- macro in Assembly Programming
Coal 21- macro in Assembly ProgrammingCoal 21- macro in Assembly Programming
Coal 21- macro in Assembly Programming
Muhammad Taqi Hassan Bukhari
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Polygon filling
Polygon fillingPolygon filling
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
Assembly language
Assembly languageAssembly language
Assembly language
gaurav jain
 
Insertion and merge sort
Insertion and merge sortInsertion and merge sort
Insertion and merge sort
Preetham Devisetty
 
Rabin karp string matcher
Rabin karp string matcherRabin karp string matcher
Rabin karp string matcher
Amit Kumar Rathi
 
8087 Data Processor
8087 Data Processor8087 Data Processor
8087 Data Processor
manu2008
 
COA-QUESTION-BANK.pdf
COA-QUESTION-BANK.pdfCOA-QUESTION-BANK.pdf
COA-QUESTION-BANK.pdf
JasmineKaur346682
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and Paging
Emery Berger
 
Cpu organisation
Cpu organisationCpu organisation
Cpu organisation
Er Sangita Vishwakarma
 
Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer Architecture
Haris456
 

What's hot (20)

Floating point arithmetic operations (1)
Floating point arithmetic operations (1)Floating point arithmetic operations (1)
Floating point arithmetic operations (1)
 
Chap8 new
Chap8 newChap8 new
Chap8 new
 
Associative memory 14208
Associative memory 14208Associative memory 14208
Associative memory 14208
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Heaps
HeapsHeaps
Heaps
 
Computer Graphics - Output Primitive
Computer Graphics - Output PrimitiveComputer Graphics - Output Primitive
Computer Graphics - Output Primitive
 
Heap
HeapHeap
Heap
 
Coal 21- macro in Assembly Programming
Coal 21- macro in Assembly ProgrammingCoal 21- macro in Assembly Programming
Coal 21- macro in Assembly Programming
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Insertion and merge sort
Insertion and merge sortInsertion and merge sort
Insertion and merge sort
 
Rabin karp string matcher
Rabin karp string matcherRabin karp string matcher
Rabin karp string matcher
 
8087 Data Processor
8087 Data Processor8087 Data Processor
8087 Data Processor
 
COA-QUESTION-BANK.pdf
COA-QUESTION-BANK.pdfCOA-QUESTION-BANK.pdf
COA-QUESTION-BANK.pdf
 
Virtual Memory and Paging
Virtual Memory and PagingVirtual Memory and Paging
Virtual Memory and Paging
 
Cpu organisation
Cpu organisationCpu organisation
Cpu organisation
 
Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer Architecture
 

Similar to Lecture 1 - Numerical Methods

Number system(everyday41.com).pdf
Number system(everyday41.com).pdfNumber system(everyday41.com).pdf
Number system(everyday41.com).pdf
everyday
 
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptxICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ssuser2f67c91
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
MinilikDerseh1
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
jaywarven1
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
vinay arora
 
Numbering System Base Conversion
Numbering System Base ConversionNumbering System Base Conversion
Numbering System Base Conversion
The University of Lahore
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
Aman anand kumar
 
Number System Conversion
Number System ConversionNumber System Conversion
Number System Conversion
Faraz Ahmed
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Ra'Fat Al-Msie'deen
 
3 Performing Mensuration and Calculation.pptx
3 Performing  Mensuration and Calculation.pptx3 Performing  Mensuration and Calculation.pptx
3 Performing Mensuration and Calculation.pptx
GemDL
 
Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic Programming
Syeda Khadizatul maria
 
W1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptxW1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptx
Ghassan44
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
RicardoDeGuzman9
 
Es272 ch2
Es272 ch2Es272 ch2
Computer algorithm(Dynamic Programming).pdf
Computer algorithm(Dynamic Programming).pdfComputer algorithm(Dynamic Programming).pdf
Computer algorithm(Dynamic Programming).pdf
jannatulferdousmaish
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
ececourse
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
pravinwj
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
Emmanuel Eniola Falade
 
Arithmetic of Computers
Arithmetic of Computers Arithmetic of Computers
Arithmetic of Computers
Dhamodhar M
 
Numerical Techniques
Numerical TechniquesNumerical Techniques
Numerical Techniques
Yasir Mahdi
 

Similar to Lecture 1 - Numerical Methods (20)

Number system(everyday41.com).pdf
Number system(everyday41.com).pdfNumber system(everyday41.com).pdf
Number system(everyday41.com).pdf
 
ICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptxICT_Seminar_flow_charts_for_2013_Nov.pptx
ICT_Seminar_flow_charts_for_2013_Nov.pptx
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
 
Numbering System Base Conversion
Numbering System Base ConversionNumbering System Base Conversion
Numbering System Base Conversion
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
 
Number System Conversion
Number System ConversionNumber System Conversion
Number System Conversion
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
 
3 Performing Mensuration and Calculation.pptx
3 Performing  Mensuration and Calculation.pptx3 Performing  Mensuration and Calculation.pptx
3 Performing Mensuration and Calculation.pptx
 
Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic Programming
 
W1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptxW1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptx
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
 
Es272 ch2
Es272 ch2Es272 ch2
Es272 ch2
 
Computer algorithm(Dynamic Programming).pdf
Computer algorithm(Dynamic Programming).pdfComputer algorithm(Dynamic Programming).pdf
Computer algorithm(Dynamic Programming).pdf
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
Arithmetic of Computers
Arithmetic of Computers Arithmetic of Computers
Arithmetic of Computers
 
Numerical Techniques
Numerical TechniquesNumerical Techniques
Numerical Techniques
 

Recently uploaded

Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 

Recently uploaded (20)

Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 

Lecture 1 - Numerical Methods

  • 1. NumericalMethods Lecture 1 Representation of Numerical Values in the Computer
  • 2. Overview – Number Systems – Number Conversion – Representation of Numbers – Computer Arithmetic – Errors in Arithmetic Tashreef Muhammad 2
  • 3. NumberSystems Let us discuss mainly about “Positional Number Systems” Tashreef Muhammad 3
  • 4. Number Systems – Non-positional Number Systems – Positional Number Systems – Decimal – Binary – Hexadecimal Tashreef Muhammad 4
  • 5. NumberConversion Converting numbers represented in one format, to other Tashreef Muhammad 5
  • 6. Number Conversion – Decimal to Non-decimal Number – Non-decimal to Decimal Number – Binary to Hexadecimal Number – Hexadecimal to Binary Number Tashreef Muhammad 6
  • 7. Representationof Numbers How modern computers store and represent numbers Tashreef Muhammad 7
  • 8. Representation of Numbers – Dependent on words – Words are a number of bits – Word size varies from machine to machine – Computers process using binary – Humans easily understand decimal – Hexadecimal expresses more in less digits Tashreef Muhammad 8
  • 9. Representation of Numbers – Integer Representation – For word size n, maximum possible number to store is 2n – 1 – Negative numbers are stored as 2’s complement – The use of sign bit makes the highest possible number 2n-1 – 1 – First toggle all the bits of the number – Add 1 to the whole number – Use the sign bit as it is Tashreef Muhammad 9
  • 10. Representation of Numbers – Floating Point Representation – Exponential form, 𝑥𝑥 = 𝑓𝑓 × 10𝐸𝐸 – 𝑓𝑓 is mantissa and 𝐸𝐸 is exponent – The entire memory location is divided to three parts – Sign, mantissa and exponent – Typically 24 bits for mantissa and 7 bits for exponent are used on a 32 bit word representation system Tashreef Muhammad 10
  • 11. Representation of Numbers A sample floating point representation from Numerical Methods textbook (Figure 3.1) Tashreef Muhammad 11 SIGN EXPONENT MANTISSA 1 bit 7 bits 24 bits 0 24 23 31 30
  • 12. Representation of Numbers – Floating Point Representation – Shifting of decimal pints  Normalisation – Numbers in normalized form  Normalised Floating Point Numbers – Two possible notations: 0.596 x 10-2 or .596E-2 – Conditions to be satisfied by mantissa, 𝑓𝑓 – For positive numbers: 0.1 ≤ 𝑓𝑓 < 1.0 – For negative numbers: −1 < 𝑓𝑓 ≤ −0.1 – In general: 0.1 ≤ |𝑓𝑓| < 1.0 Tashreef Muhammad 12
  • 13. ComputerArithmetic How computers process arithmetic operations Tashreef Muhammad 13
  • 14. Computer Arithmetic – Integer Arithmetic – Integer arithmetic always results in integer – Exception: – Cannot represent infinite numbers, bounded above and below – Integer division provides two results: quotient and remainder – Sample integer arithmetic: – 25 + 12 = 37, 25 - 12 = 13, 12 – 25 = -13 – 25 x 12 = 300, 25 ÷ 12 = 2, 12 ÷ 25 = 0 – Show the following is incorrect for integer arithmetic – 𝑎𝑎+𝑏𝑏 𝑐𝑐 = 𝑎𝑎 𝑐𝑐 + 𝑏𝑏 𝑐𝑐 Tashreef Muhammad 14
  • 15. Computer Arithmetic – Floating Point Arithmetic: Addition – Let 𝑥𝑥 and 𝑦𝑦 be added to result in 𝑧𝑧; where 𝑥𝑥 ≥ 𝑦𝑦 – The fractional parts: f𝑥𝑥, f𝑦𝑦, f𝑧𝑧 – The exponent parts: E𝑥𝑥, E𝑦𝑦, E𝑧𝑧; where E𝑥𝑥 ≥ 𝐸𝐸𝑦𝑦 – Algorithm: – Set E𝑧𝑧 = max(E𝑥𝑥, E𝑦𝑦)  E𝑧𝑧 = E𝑥𝑥 – Shift f𝑦𝑦 to the right by E𝑥𝑥 − E𝑦𝑦 places – Set f𝑧𝑧 = f𝑥𝑥 + f𝑦𝑦 – Normalize if necessary Tashreef Muhammad 15
  • 16. Computer Arithmetic – Floating Point Arithmetic: Subtraction – Addition with different sign bits – May result in mantissa overflow – Left shift f𝑧𝑧 and decrease E𝑧𝑧 accordingly Tashreef Muhammad 16
  • 17. Computer Arithmetic – Floating Point Arithmetic: Multiplication – Multiply mantissa, f𝑧𝑧 = 𝑓𝑓𝑥𝑥 × 𝑓𝑓𝑦𝑦 – Add the exponents, E𝑧𝑧 = 𝐸𝐸𝑥𝑥 + 𝐸𝐸𝑦𝑦 – Normalise if necessary Tashreef Muhammad 17
  • 18. Computer Arithmetic – Floating Point Arithmetic: Division – Divide mantissa, f𝑧𝑧 = 𝑓𝑓𝑥𝑥 ÷ 𝑓𝑓𝑦𝑦 – Subtract the exponents, E𝑧𝑧 = 𝐸𝐸𝑥𝑥 − 𝐸𝐸𝑦𝑦 – Normalise if necessary Tashreef Muhammad 18
  • 19. Computer Arithmetic – Floating Point Arithmetic: Practice – Add 0.964572 E2 and 0.586351 E5 – Add 0.735816 E4 and 0.635742 E4 – Subtract 0.994576 E-3 from 0.999658 E-3 – Multiply 0.20 E4 and 0.40 E-2 – Divide 0.876543 by 0.200000 E-3 Tashreef Muhammad 19
  • 20. Computer Arithmetic – Floating Point Arithmetic: Practice Answers – Add 0.964572 E2 and 0.586351 E5  0.587315 E5 – Add 0.735816 E4 and 0.635742 E4  0.1371558 E5 – Subtract 0.994576 E-3 from 0.999658 E-3  0.508200 E-5 – Multiply 0.20 E4 and 0.40 E-2  0.80 E1 – Divide 0.876543 by 0.200000 E-3  0.438271 E-1 Tashreef Muhammad 20
  • 21. ErrorsinArithmetic Errors that are seen in arithmetic operations Tashreef Muhammad 21
  • 22. Errors in Arithmetic – Floating Point Arithmetic – Inexact binary representation of decimal number: 0.1 to 0.0001100110011… – Errors due to rounding-off a number: Add the numbers 0.500000 E1 and 0.100000 E-7 – Subtractive cancellation: Subtract 0.499998 from 0.500000 – Overflow or underflow of numbers Tashreef Muhammad 22
  • 23. Errors in Arithmetic – Laws of Arithmetic – Errors in arithmetic induce error in associative and distributive law errors – 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 ≠ 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 and 𝑥𝑥 × 𝑦𝑦 × 𝑧𝑧 ≠ 𝑥𝑥 × 𝑦𝑦 × 𝑧𝑧 – 𝑥𝑥 × 𝑦𝑦 + 𝑧𝑧 ≠ 𝑥𝑥 × 𝑦𝑦 + 𝑥𝑥 × 𝑧𝑧 – Provide an example where associative law of addition fails due to an arithmetic error of floating point number – 𝑥𝑥 = 0.456732 × 10−2 , 𝑦𝑦 = 0.243451, 𝑧𝑧 = −0.248000 – 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 ≠ 𝑥𝑥 + 𝑦𝑦 + 𝑧𝑧 Tashreef Muhammad 23