SlideShare a Scribd company logo
Numerical Methods
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
Number Systems
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
Number Conversion
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
Representation of
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
SIG
N
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
Computer Arithmetic
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
Errors in Arithmetic
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

Assignment model
Assignment modelAssignment model
Assignment model
Palash Badal
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
RavikumarR77
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
Vertex cover Problem
Vertex cover ProblemVertex cover Problem
Vertex cover Problem
Gajanand Sharma
 
Assignment method
Assignment methodAssignment method
Assignment method
R A Shah
 
Chapter1 - Signal and System
Chapter1 - Signal and SystemChapter1 - Signal and System
Chapter1 - Signal and System
Attaporn Ninsuwan
 
BISECTION METHOD
BISECTION METHODBISECTION METHOD
Presentation aust final
Presentation aust finalPresentation aust final
Presentation aust final
Satyajit Nag Mithu
 
Gauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptxGauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptx
AHSANMEHBOOB12
 
SE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneSE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of Pune
Bhavesh Shah
 
Numerical Methods 1
Numerical Methods 1Numerical Methods 1
Numerical Methods 1
Dr. Nirav Vyas
 
Cbse class-2-maths-question-paper-fa-1
Cbse class-2-maths-question-paper-fa-1Cbse class-2-maths-question-paper-fa-1
Cbse class-2-maths-question-paper-fa-1
Sunaina Rawat
 
Number system
Number systemNumber system
Number system
Chauhan Dharmendra
 
Lagrange multiplier
 Lagrange multiplier Lagrange multiplier
Lagrange multiplier
Anjali Devi J S
 
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
Akhilesh Mishra
 
Numerical differentiation
Numerical differentiationNumerical differentiation
Numerical differentiation
andrushow
 
Regulafalsi_bydinesh
Regulafalsi_bydineshRegulafalsi_bydinesh
Regulafalsi_bydinesh
Dinesh Kumar
 
Bisection method in maths 4
Bisection method in maths 4Bisection method in maths 4
Bisection method in maths 4
Vaidik Trivedi
 
Newton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with ExampleNewton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with Example
MuhammadUsmanIkram2
 
Dominance method
Dominance methodDominance method
Dominance method
pooja rani
 

What's hot (20)

Assignment model
Assignment modelAssignment model
Assignment model
 
3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt3.Fixed-Floating Point.ppt
3.Fixed-Floating Point.ppt
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
 
Vertex cover Problem
Vertex cover ProblemVertex cover Problem
Vertex cover Problem
 
Assignment method
Assignment methodAssignment method
Assignment method
 
Chapter1 - Signal and System
Chapter1 - Signal and SystemChapter1 - Signal and System
Chapter1 - Signal and System
 
BISECTION METHOD
BISECTION METHODBISECTION METHOD
BISECTION METHOD
 
Presentation aust final
Presentation aust finalPresentation aust final
Presentation aust final
 
Gauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptxGauss Jorden and Gauss Elimination method.pptx
Gauss Jorden and Gauss Elimination method.pptx
 
SE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneSE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of Pune
 
Numerical Methods 1
Numerical Methods 1Numerical Methods 1
Numerical Methods 1
 
Cbse class-2-maths-question-paper-fa-1
Cbse class-2-maths-question-paper-fa-1Cbse class-2-maths-question-paper-fa-1
Cbse class-2-maths-question-paper-fa-1
 
Number system
Number systemNumber system
Number system
 
Lagrange multiplier
 Lagrange multiplier Lagrange multiplier
Lagrange multiplier
 
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
 
Numerical differentiation
Numerical differentiationNumerical differentiation
Numerical differentiation
 
Regulafalsi_bydinesh
Regulafalsi_bydineshRegulafalsi_bydinesh
Regulafalsi_bydinesh
 
Bisection method in maths 4
Bisection method in maths 4Bisection method in maths 4
Bisection method in maths 4
 
Newton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with ExampleNewton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with Example
 
Dominance method
Dominance methodDominance method
Dominance method
 

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
 
Numbering System Base Conversion
Numbering System Base ConversionNumbering System Base Conversion
Numbering System Base Conversion
The University of Lahore
 
Number System Conversion
Number System ConversionNumber System Conversion
Number System Conversion
Faraz Ahmed
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
Aman anand kumar
 
3 Performing Mensuration and Calculation.pptx
3 Performing  Mensuration and Calculation.pptx3 Performing  Mensuration and Calculation.pptx
3 Performing Mensuration and Calculation.pptx
GemDL
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
vinay arora
 
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
 
W1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptxW1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptx
Ghassan44
 
3 2 adding and subtracting rational numbers lesson
3 2 adding and subtracting rational numbers lesson3 2 adding and subtracting rational numbers lesson
3 2 adding and subtracting rational numbers lesson
gwilson8786
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
Emmanuel Eniola Falade
 
Number systems
Number systemsNumber systems
Number systems
ponandannel
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
ececourse
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
RicardoDeGuzman9
 
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
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
pravinwj
 
Adding and subtracting
Adding and subtractingAdding and subtracting
Adding and subtracting
Diana Pineda
 
Arithmetic of Computers
Arithmetic of Computers Arithmetic of Computers
Arithmetic of Computers
Dhamodhar M
 

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
 
Numbering System Base Conversion
Numbering System Base ConversionNumbering System Base Conversion
Numbering System Base Conversion
 
Number System Conversion
Number System ConversionNumber System Conversion
Number System Conversion
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
 
3 Performing Mensuration and Calculation.pptx
3 Performing  Mensuration and Calculation.pptx3 Performing  Mensuration and Calculation.pptx
3 Performing Mensuration and Calculation.pptx
 
Uta005 lecture3
Uta005 lecture3Uta005 lecture3
Uta005 lecture3
 
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"
 
W1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptxW1-L1 Negative-numbers-ppt..pptx
W1-L1 Negative-numbers-ppt..pptx
 
3 2 adding and subtracting rational numbers lesson
3 2 adding and subtracting rational numbers lesson3 2 adding and subtracting rational numbers lesson
3 2 adding and subtracting rational numbers lesson
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
Number systems
Number systemsNumber systems
Number systems
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
15minute-math-integers.ppt
15minute-math-integers.ppt15minute-math-integers.ppt
15minute-math-integers.ppt
 
Coin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic ProgrammingCoin Change : Greedy vs Dynamic Programming
Coin Change : Greedy vs Dynamic Programming
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
 
Adding and subtracting
Adding and subtractingAdding and subtracting
Adding and subtracting
 
Arithmetic of Computers
Arithmetic of Computers Arithmetic of Computers
Arithmetic of Computers
 

Recently uploaded

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)
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
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
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
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
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
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
 
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
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 

Recently uploaded (20)

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...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
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
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
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
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
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
 
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
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 

Lecture 1 - Numerical Methods

  • 1. Numerical Methods 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. Number Systems 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. Number Conversion 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. Representation of 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 SIG N 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. Computer Arithmetic 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. Errors in Arithmetic 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