Introduction to
Numerical
Methods
Numerical Methods (ME 212)
Author: Dr. Shoeb Ahmed Syed
Papua New Guinea University of Technology
Department of Mechanical Engineering
1
Binary Representation
How a Decimal Number is
Represented
2102
+ 5101
7100
+ 710−1
+ 610−2
= +
257.76
3
Base 2
23
22
0
21
+120
)
 (1 
+ 0 +1
 
=
(1011.0011)2
 + +1 2−4
)
2−1
2−2
2−3
(0 + +1
 10
=11.1875
4
Convert Base 10 Integer to
binary representation
Table 1 Converting a base-10 integer to binary representation.
Hence
(11)10 = (a3a2 a1a0 )2
= (1011)2
5
Quotient Remainder
11/2 5 1 = a0
5/2 2 1 = a1
2/2 1 0 = a2
1/2 0 1 = a3
Start
Input (N)10
Is Q = 0?
Yes
STOP
6
n = i
(N)10 = (an. . .a0)2
No
ai = R
i=i+1,N=Q
Divide N by 2 to get
quotient Q & remainder R
i = 0
Integer N to be
converted to binary
format
Fractional Decimal Number
to Binary
Table 2. Converting a base-10 fraction to binary representation.
decimal
Hence
(0.1875)10 = (a−1a−2a−3a−4 )2
= (0.0011)2
7
Number Number after
decimal
Number before
0.1875 2 0.375 0.375 0 = a−1
0.3752 0.75 0.75 0 = a−2
0.752 1.5 0.5 1 = a−3
0.52 1.0 0.0 1 = a−4
Start
Input (F)10
i = i −1, F = T
Is T =0?
Yes
STOP
8
n = i
(F)10 = (a-1. . .a-n)2
No
ai = R
Multiply F by 2 to get
number before decimal,
S and after decimal, T
i = −1
Fraction F to be
converted to binary
format
Decimal
(11.1875)
Number to Binary
( )
= ?.?
10 2
Since
(11)10
= (1011)2
and
(0.1875)10 =
we have
(11.1875)10
(0.0011)2
= (1011.0011)2
9
All Fractional Decimal Numbers
Cannot be Represented Exactly
Table 3. Converting a base-10 fraction to approximate binary representation.
before
(0.3)10  = (0.01001)2 =
(a−1a−2a−3a−4a−5 )2 0.28125
10
Number
Number
after
decimal
Number
Decimal
0.3 2 0.6 0.6 0 = a−1
0.62 1.2 0.2 1 = a−2
0.2 2 0.4 0.4 0 = a−3
0.4 2 0.8 0.8 0 = a−4
0.82 1.6 0.6 1 = a−5
Another Way to Look at
Conversion
(11.1875)10
Convert
(11)
to base 2
23
23
23
=
=
=
+ 3
10
21
21
+
+
+1
20
+
23
22
21
20
=1 + 0 +1 +1
=
(1011)2
11
(0.1875) 2−3
2−3
=
=
+ 0.0625
10
2−4
+
2−1
2−2
2−3
2−4
= 0 + 0 +1 +1
= (.0011)2
(11.1875)10 = (1011.0011)2
12
Floating Point Representation
Floating Decimal Point : Scientific Form
2.5678×102
written as +
256.78 is
is written as +3.678×10−3
is written as − 2.5678×102
0.003678
− 256.78
Example
The form is
sign × mantissa ×10exponent
or
σ ×m×10e
Example: For
− 2.5678×102
σ = −1
m = 2.5678
e = 2
Floating Point Format for Binary
Numbers
2e
y =σ ×m×
(0 - ve)
σ = sign of number for + ve,1for
m = mantissa [(1)2
m < (10)2 ]
<
1 is not stored as it is always
e = integer exponent
given to be 1.
Example
9 bit-hypothetical word
▪the first bit is used for the sign of the number
,
▪the second bit for the sign of the exponent,
▪the next four bits for the mantissa, and
▪the next three bits for the exponent
(54.75) = (110110.11) = (1.1011011)× 25
10 2
≅ (1.1011)2 × (101)2
2
We have the representation as
mantissa exponent
Sign of the
number
Sign of the
exponent
0 0 1 0 1 1 1 0 1
Machine Epsilon
Defined as the measure of accuracy and found
by difference between 1 and the next number
that can be represented
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
IEEE 754 Standards for Single
Precision Representation
IEEE-754 Floating Point
Standard
Standardizes representation
floating point numbers on
different computers in single
double precision.
• of
and
• Standardizes representation
floating point operations on
different computers.
of
One Great Reference
What every computer scientist (and even if
you are not) should know about floating point
arithmetic!
http://www.validlab.com/goldberg/paper
.pdf
IEEE-754 Format Single
Precision
32 bits for single precision
Biased
Exponent (e’)
Sign
(s)
Mantissa (m)
1.m) ×
Value = (−1) ×( e'−127
s
2
2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Exponent for 32 Bit IEEE-754
8 bits would represent
e′
0 ≤ ≤ 255
Bias is 127; so subtract
representation
127 from
−127 ≤ e ≤128
Exponent for Special Cases
e′
Actual range of
e′
1≤ ≤ 254
e′ and e′
= 0 = 255 are reserved for special numbers
e
Actual range of
−126 ≤ e ≤ 127
Special Exponents and Numbers
e′ = 0 all zeros
all ones
e′ = 255
s e′ m Represents
0 all zeros all zeros 0
1 all zeros all zeros -0
0 all ones all zeros ∞
1 all ones all zeros − ∞
0 or 1 all ones non-zero NaN
IEEE-754 Format
The largest number by magnitude
( ) ×
2
127 38
= 3.40×10
1.1........1 2
The smallest number by magnitude
( ) −126 −38
×2 = 2.18×10
1.00......0 2
Machine epsilon
2−23
= 1.19 ×10−7
ε =
mach
Taylor Series Revisited
What
Some examples
seen
x2
is a Taylor series?
of T
aylor series which you must have
x4
x6
cos(x) =1− + − +
2!
x3
4!
x5
6!
x7
sin(x) = x − + − +
3!
x2
5!
x3
7!
x
e = 1+ x + + +
2! 3!
General Taylor Series
The general
f (x + h) =
form of the T
aylor series is given by
f (x)h +
f  (x) h2
+
f (x) h3
f (x)+ +
2! 3!
provided that all derivatives of f(x) are continuous
exist in the interval [x,x+h]
and
What does this mean in plain English?
As Archimedes would have said, “Give me the value of the function at
a single point, and the value of all (first, second, and so on) its
derivatives
function at
at that single point, and I can give you the value of the
any other point” (fine print excluded)
Example—Taylor Series
f (6) f (4)=125, f (4)= 74,
derivatives
Find the
f  (4)= 30,
value of
f (4)= 6
given that
and all other higher order
f (x)
of at are zero.
x = 4
Solution:
f (x + h)=
x =
h2
h3
f (x)+ f (x)h +
4
f  (x) f (x)
+ +
2! 3!
h = 6 − 4 = 2
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
Dr.Shoeb_ME212_Lec-3_numerical methods_G
1. http://numericalmethods.eng.usf.edu
2. http://numericalmethods.eng.usf.edu/topics/binary_repr
esentation.html
3.http://numericalmethods.eng.usf.edu/topics/floatingpoint_re
presentation.html
4. http://numericalmethods.eng.usf.edu/topics/taylor_seri
es.html
References
THE END

More Related Content

PPTX
digital-electronics.pptx
PDF
Digital_Electronics_Basics.pdf
PDF
digital-electronics (1)_watermark.pdfhindi
PPT
45196656565656565656565656565656565656566.ppt
PPTX
06 floating point
PPT
ch3a-binary-numbers.ppt
PPT
binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt
digital-electronics.pptx
Digital_Electronics_Basics.pdf
digital-electronics (1)_watermark.pdfhindi
45196656565656565656565656565656565656566.ppt
06 floating point
ch3a-binary-numbers.ppt
binary-numbers.ppt
ch3a-binary-numbers.ppt

Similar to Dr.Shoeb_ME212_Lec-3_numerical methods_G (20)

PPT
mmmmmmmmmmmmmmmmmmmmmmbinary-numbers.ppt
PPT
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
PPT
Review on Number Systems: Decimal, Binary, and Hexadecimal
PPT
ch3a-binary-numbers.ppt
PPTX
Bca 2nd sem-u-1.8 digital logic circuits, digital component floting and fixed...
PPTX
B.sc cs-ii-u-1.8 digital logic circuits, digital component floting and fixed ...
PPT
ch3a-binary-numbers.ppt-BINARY SYSTEM---
PPT
ch3a-binary-numbers.ppt
PPTX
Computer Representation of Numbers and.pptx
PPTX
digital logic circuits, digital component floting and fixed point
PDF
Data types - things you have to know!
PPT
L12-FloatingPoint.ppt
PPTX
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
PPT
ch3a-binary-numbers.ppt
PPTX
Unit 1 PDF.pptx
PPT
Video lectures
PPT
Mba ebooks
PPTX
ees pptfdgddrgncbfxdbfngdfxvcbnbcvdzfxv cgn
PPT
Introduction to Information Technology Lecture 2
PPT
chapter 3 000Number_Systems.ppt
mmmmmmmmmmmmmmmmmmmmmmbinary-numbers.ppt
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
Review on Number Systems: Decimal, Binary, and Hexadecimal
ch3a-binary-numbers.ppt
Bca 2nd sem-u-1.8 digital logic circuits, digital component floting and fixed...
B.sc cs-ii-u-1.8 digital logic circuits, digital component floting and fixed ...
ch3a-binary-numbers.ppt-BINARY SYSTEM---
ch3a-binary-numbers.ppt
Computer Representation of Numbers and.pptx
digital logic circuits, digital component floting and fixed point
Data types - things you have to know!
L12-FloatingPoint.ppt
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
ch3a-binary-numbers.ppt
Unit 1 PDF.pptx
Video lectures
Mba ebooks
ees pptfdgddrgncbfxdbfngdfxvcbnbcvdzfxv cgn
Introduction to Information Technology Lecture 2
chapter 3 000Number_Systems.ppt
Ad

More from ShoebAhmedSyed2 (14)

PDF
Dr.Shoeb_ME212_Lec-2-NUMERICAL METHODS_g
PDF
Dr.Shoeb_ME212_Lec-1_numerical methods_G
PPTX
Dr.Shoeb_ME311_Lec-1_2023.pptx
PPTX
Kinematics of Machinery Digital Material_VVVVImp.pptx
PPT
lecture-1-mechanismsof HT_524.ppt
PPT
Chap01_lecture_notes.ppt
PPTX
14_LectureOutline.pptx
PPTX
Lecture-1 (CDS11).pptx
PPTX
PPTs for Online Teaching Training(1).pptx
PPTX
OEP UNITECH.pptx
PDF
PNGUNITEC3_Game-basedquizzesforZoom (1).pdf
PPT
introduction-to-linear-kinematics.ppt
PPT
48.KVikramKumar (2).ppt
PPSX
Week 01 (3).ppsx
Dr.Shoeb_ME212_Lec-2-NUMERICAL METHODS_g
Dr.Shoeb_ME212_Lec-1_numerical methods_G
Dr.Shoeb_ME311_Lec-1_2023.pptx
Kinematics of Machinery Digital Material_VVVVImp.pptx
lecture-1-mechanismsof HT_524.ppt
Chap01_lecture_notes.ppt
14_LectureOutline.pptx
Lecture-1 (CDS11).pptx
PPTs for Online Teaching Training(1).pptx
OEP UNITECH.pptx
PNGUNITEC3_Game-basedquizzesforZoom (1).pdf
introduction-to-linear-kinematics.ppt
48.KVikramKumar (2).ppt
Week 01 (3).ppsx
Ad

Recently uploaded (20)

PDF
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
PPTX
Building constraction Conveyance of water.pptx
PPTX
Information Storage and Retrieval Techniques Unit III
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PPTX
Petroleum Refining & Petrochemicals.pptx
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
Computer organization and architecuture Digital Notes....pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PDF
UEFA_Embodied_Carbon_Emissions_Football_Infrastructure.pdf
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
Feature types and data preprocessing steps
PPTX
mechattonicsand iotwith sensor and actuator
PDF
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
PPTX
Management Information system : MIS-e-Business Systems.pptx
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PPTX
CN_Unite_1 AI&DS ENGGERING SPPU PUNE UNIVERSITY
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
Unit I -OPERATING SYSTEMS_SRM_KATTANKULATHUR.pptx.pdf
Building constraction Conveyance of water.pptx
Information Storage and Retrieval Techniques Unit III
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Petroleum Refining & Petrochemicals.pptx
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Computer organization and architecuture Digital Notes....pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Abrasive, erosive and cavitation wear.pdf
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
August 2025 - Top 10 Read Articles in Network Security & Its Applications
UEFA_Embodied_Carbon_Emissions_Football_Infrastructure.pdf
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Feature types and data preprocessing steps
mechattonicsand iotwith sensor and actuator
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
Management Information system : MIS-e-Business Systems.pptx
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
CN_Unite_1 AI&DS ENGGERING SPPU PUNE UNIVERSITY
Exploratory_Data_Analysis_Fundamentals.pdf

Dr.Shoeb_ME212_Lec-3_numerical methods_G

  • 1. Introduction to Numerical Methods Numerical Methods (ME 212) Author: Dr. Shoeb Ahmed Syed Papua New Guinea University of Technology Department of Mechanical Engineering 1
  • 3. How a Decimal Number is Represented 2102 + 5101 7100 + 710−1 + 610−2 = + 257.76 3
  • 4. Base 2 23 22 0 21 +120 )  (1  + 0 +1   = (1011.0011)2  + +1 2−4 ) 2−1 2−2 2−3 (0 + +1  10 =11.1875 4
  • 5. Convert Base 10 Integer to binary representation Table 1 Converting a base-10 integer to binary representation. Hence (11)10 = (a3a2 a1a0 )2 = (1011)2 5 Quotient Remainder 11/2 5 1 = a0 5/2 2 1 = a1 2/2 1 0 = a2 1/2 0 1 = a3
  • 6. Start Input (N)10 Is Q = 0? Yes STOP 6 n = i (N)10 = (an. . .a0)2 No ai = R i=i+1,N=Q Divide N by 2 to get quotient Q & remainder R i = 0 Integer N to be converted to binary format
  • 7. Fractional Decimal Number to Binary Table 2. Converting a base-10 fraction to binary representation. decimal Hence (0.1875)10 = (a−1a−2a−3a−4 )2 = (0.0011)2 7 Number Number after decimal Number before 0.1875 2 0.375 0.375 0 = a−1 0.3752 0.75 0.75 0 = a−2 0.752 1.5 0.5 1 = a−3 0.52 1.0 0.0 1 = a−4
  • 8. Start Input (F)10 i = i −1, F = T Is T =0? Yes STOP 8 n = i (F)10 = (a-1. . .a-n)2 No ai = R Multiply F by 2 to get number before decimal, S and after decimal, T i = −1 Fraction F to be converted to binary format
  • 9. Decimal (11.1875) Number to Binary ( ) = ?.? 10 2 Since (11)10 = (1011)2 and (0.1875)10 = we have (11.1875)10 (0.0011)2 = (1011.0011)2 9
  • 10. All Fractional Decimal Numbers Cannot be Represented Exactly Table 3. Converting a base-10 fraction to approximate binary representation. before (0.3)10  = (0.01001)2 = (a−1a−2a−3a−4a−5 )2 0.28125 10 Number Number after decimal Number Decimal 0.3 2 0.6 0.6 0 = a−1 0.62 1.2 0.2 1 = a−2 0.2 2 0.4 0.4 0 = a−3 0.4 2 0.8 0.8 0 = a−4 0.82 1.6 0.6 1 = a−5
  • 11. Another Way to Look at Conversion (11.1875)10 Convert (11) to base 2 23 23 23 = = = + 3 10 21 21 + + +1 20 + 23 22 21 20 =1 + 0 +1 +1 = (1011)2 11
  • 12. (0.1875) 2−3 2−3 = = + 0.0625 10 2−4 + 2−1 2−2 2−3 2−4 = 0 + 0 +1 +1 = (.0011)2 (11.1875)10 = (1011.0011)2 12
  • 14. Floating Decimal Point : Scientific Form 2.5678×102 written as + 256.78 is is written as +3.678×10−3 is written as − 2.5678×102 0.003678 − 256.78
  • 15. Example The form is sign × mantissa ×10exponent or σ ×m×10e Example: For − 2.5678×102 σ = −1 m = 2.5678 e = 2
  • 16. Floating Point Format for Binary Numbers 2e y =σ ×m× (0 - ve) σ = sign of number for + ve,1for m = mantissa [(1)2 m < (10)2 ] < 1 is not stored as it is always e = integer exponent given to be 1.
  • 17. Example 9 bit-hypothetical word ▪the first bit is used for the sign of the number , ▪the second bit for the sign of the exponent, ▪the next four bits for the mantissa, and ▪the next three bits for the exponent (54.75) = (110110.11) = (1.1011011)× 25 10 2 ≅ (1.1011)2 × (101)2 2 We have the representation as mantissa exponent Sign of the number Sign of the exponent 0 0 1 0 1 1 1 0 1
  • 18. Machine Epsilon Defined as the measure of accuracy and found by difference between 1 and the next number that can be represented
  • 21. IEEE 754 Standards for Single Precision Representation
  • 22. IEEE-754 Floating Point Standard Standardizes representation floating point numbers on different computers in single double precision. • of and • Standardizes representation floating point operations on different computers. of
  • 23. One Great Reference What every computer scientist (and even if you are not) should know about floating point arithmetic! http://www.validlab.com/goldberg/paper .pdf
  • 24. IEEE-754 Format Single Precision 32 bits for single precision Biased Exponent (e’) Sign (s) Mantissa (m) 1.m) × Value = (−1) ×( e'−127 s 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • 27. Exponent for 32 Bit IEEE-754 8 bits would represent e′ 0 ≤ ≤ 255 Bias is 127; so subtract representation 127 from −127 ≤ e ≤128
  • 28. Exponent for Special Cases e′ Actual range of e′ 1≤ ≤ 254 e′ and e′ = 0 = 255 are reserved for special numbers e Actual range of −126 ≤ e ≤ 127
  • 29. Special Exponents and Numbers e′ = 0 all zeros all ones e′ = 255 s e′ m Represents 0 all zeros all zeros 0 1 all zeros all zeros -0 0 all ones all zeros ∞ 1 all ones all zeros − ∞ 0 or 1 all ones non-zero NaN
  • 30. IEEE-754 Format The largest number by magnitude ( ) × 2 127 38 = 3.40×10 1.1........1 2 The smallest number by magnitude ( ) −126 −38 ×2 = 2.18×10 1.00......0 2 Machine epsilon 2−23 = 1.19 ×10−7 ε = mach
  • 32. What Some examples seen x2 is a Taylor series? of T aylor series which you must have x4 x6 cos(x) =1− + − + 2! x3 4! x5 6! x7 sin(x) = x − + − + 3! x2 5! x3 7! x e = 1+ x + + + 2! 3!
  • 33. General Taylor Series The general f (x + h) = form of the T aylor series is given by f (x)h + f  (x) h2 + f (x) h3 f (x)+ + 2! 3! provided that all derivatives of f(x) are continuous exist in the interval [x,x+h] and What does this mean in plain English? As Archimedes would have said, “Give me the value of the function at a single point, and the value of all (first, second, and so on) its derivatives function at at that single point, and I can give you the value of the any other point” (fine print excluded)
  • 34. Example—Taylor Series f (6) f (4)=125, f (4)= 74, derivatives Find the f  (4)= 30, value of f (4)= 6 given that and all other higher order f (x) of at are zero. x = 4 Solution: f (x + h)= x = h2 h3 f (x)+ f (x)h + 4 f  (x) f (x) + + 2! 3! h = 6 − 4 = 2