Unit 1 - Number Systems and Errors
Unit 1 - Number Systems and Errors
MASTER OF COMPUTER
jpaac
APPLICATIONS
SEMESTER 1
O02CA501
COMPUTATIONAL MATHEMATICS
Unit: 1 – Number Systems and Errors 1
O02CA501: Computational Mathematics
Unit 1
Number Systems and Errors
TABLE OF CONTENTS
Fig No /
SL SAQ /
Topic Table / Page No
No Activity
Graph
1 Introduction - -
4-5
1.1 Learning Objectives - -
2.1 Integers - -
3 Significant Figures/Digits - -
3.1 Definition - -
16-18
3.2 Note - -
3.3 Example - -
4 Errors - -
4.6 Example - -
5.2 Definition - -
5.3 Definition - -
6 Mathematical Preliminaries - -
6.1 Theorem - -
6.4 Example - -
7 Summary - - 32
9 Terminal Questions - - 35
10 Answers - -
1. INTRODUCTION
Computational Mathematics forms the bedrock of modern computing and is pivotal in an MCA
(Master of Computer Applications) program. This discipline intertwines mathematical theory,
computational techniques, and algorithm development, enabling students to solve complex
scientific, engineering, and business problems efficiently. As we delve deeper into the era of data,
understanding the nuances of computational methods becomes indispensable. These methods
not only enhance analytical skills but also equip students with the ability to model real-world
scenarios, optimize processes, and innovate within the rapidly evolving tech landscape. The study
of computational mathematics fosters a robust analytical framework, critical for algorithm design,
data analysis, software development, and beyond. It cultivates a mindset that is adept at
approaching problems methodically, ensuring solutions are not just effective but also scalable and
adaptable to future technological advancements.
Unit 1, titled "Number Systems and Errors," serves as the gateway to understanding the
foundational elements of computational mathematics within the MCA curriculum. This unit
embarks on a journey through the fundamental concept of number systems, including Decimal,
Binary, Octal, and Hexadecimal, which are crucial for data representation in computing. It
elucidates how integers, forming the core of mathematical and computer science concepts, are
represented and manipulated across these systems to achieve efficient storage and computation.
Furthermore, the unit explores the representation of fractions and the intricacies of floating-point
arithmetic, which are essential for handling real numbers and performing accurate calculations.
The segment on errors delves into the unavoidable aspect of computational mathematics - the
approximation and rounding errors inherent in numerical computations. Understanding these
errors is vital for developing algorithms that minimize inaccuracies and enhance the reliability of
computational results.
Studying "Number Systems and Errors" demands a multifaceted approach, blending theoretical
understanding with practical application. Begin by solidifying your grasp of the various number
systems through hands-on exercises that involve conversions and operations within and across
these systems. Dive into the conceptual underpinnings of floating-point arithmetic to appreciate
its significance in computing and numerical analysis. Engage in practical tasks that simulate real-
world scenarios, applying different number systems and observing the impact of errors on
computational outcomes. Leverage software tools and programming languages to implement and
experiment with numerical algorithms, enhancing your understanding of precision and accuracy
in computational contexts. Collaborate with peers to tackle complex problems, fostering a
collective learning environment that encourages the exchange of ideas and solutions. As you
progress, continually reflect on the application of these fundamental concepts in advanced
computational mathematics and computer science topics, ensuring a well-rounded and deep
comprehension of the subject matter.
2.1 Integers
Integers, the set of whole numbers including positive, negative, and zero, form a fundamental part
of mathematical and computer science concepts. In computer systems, integers are represented
in various formats to facilitate efficient storage, computation, and manipulation. Understanding
these representations is crucial for both theoretical mathematics and practical computing
applications.
Representing integers in different number systems is a fundamental concept in mathematics and
computer science. Let’s explore how integers can be represented in various commonly used
number systems: Decimal, Binary, Octal, and Hexadecimal.
Decimal System (Base-10)
The decimal system is the most widely used number system, employing base-10. It consists of
ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Each position in a decimal number represents a power
of 10, based on its position from the right, starting with 100
Example: The decimal number 345 can be broken down as:
3𝑥102 + 4𝑥101 + 5𝑥100
Therefore,
1578 = 11110
2.2 Fractions
Fractions represent a part of a whole or, more generally, any number of equal parts. In
mathematics, they are crucial for precise expressions of non-integer values. Fractions can be
represented in various forms, each serving different purposes in mathematical computation and
practical applications.
Simple Fraction
A simple fraction consists of two integers, one on top of the other, separated by a line. The number
above the line is called the numerator, and the number below is the denominator. For example,
3
4
represents three parts of a whole that is divided into four equal parts.
Decimal Representation
Fractions can be converted into decimal form by dividing the numerator by the denominator. This
form is widely used in everyday life and in most scientific calculations due to its simplicity. For
example, the fraction
1
2
is equivalent to the decimal 0.5.
Percentages
Percentages are a way to express fractions with a denominator of 100. Converting a fraction to a
percentage involves finding an equivalent fraction with 100 in the denominator or converting the
fraction to a decimal and then multiplying by 100. For instance,
3
4
as a percentage is 75%, as
3
= 0.75
4
and
0 ⋅ 75 × 100 = 75%
Continued Fractions
Continued fractions are an expression of a number as the sum of its integer part and the reciprocal
of another number, which can also be expressed as a continued fraction. This representation is
useful for precise expressions of irrational numbers and for certain types of mathematical analysis.
For example, the Golden Ratio
1
∅=1+
1
1+ 1
1+1+⋯
Binary Fractions
In computing, fractions can also be represented in binary, similar to binary integers. The place
values to the right of the binary point represent
1 1 1
, , ,…
2 4 8
and so on. Let’s take an example of 0.112 which represents the decimal fraction 0.7510 because
it is equivalent to
1 1
+
2 4
Examples:
1. Decimal to Fraction: To convert the decimal 0.25 to a fraction, recognize that 25 is 25% and
25⁄ 1
100 can be simplified to ⁄4.
2. Fraction to Decimal: To convert the fraction 5⁄8 to decimal, divide 5 by 8 to get 0.625.
3. Percentage to Fraction: To convert 20% to a fraction, write it as 20⁄100 and simplify to 1⁄5.
2.0 × 103
From
5.0 × 103
involves direct mantissa subtraction since the exponents are already equal, resulting in
3.0 × 103
3. Multiplication: Multiply the mantissa and add the exponents. For example, multiplying
1 ⋅ 2 × 103
by
3.0 × 102
gives
3.6 × 105
4. Division: Divide the mantissa and subtract the exponents. Dividing
6 ⋅ 0 × 104
by
2 ⋅ 0 × 102
yields
3.0 × 102
Precision and Rounding
Due to the finite number of bits available to store mantissas and exponents, floating point
arithmetic can introduce rounding errors. For example, the decimal number 0.1 cannot be
precisely represented in binary floating point, leading to a small error when repeatedly adding
0.1 in a binary computer system.
Special Values
Floating point systems include representations for special values such as "infinity" (for results of
operations that exceed the maximum representable value) and "NaN" (Not a Number, for results
of undefined operations like 0/0).
Normalization
Normalization in floating point numbers ensures that the mantissa is within a certain range
(usually between 1 and 2 for binary systems). For example, the number 0.0125 would be
normalized to
1.25 𝑥 10−2
in scientific notation.
Importance in Computing
Floating point arithmetic is crucial in fields that require extensive numerical computations, such as
physics simulations, financial modelling, and machine learning. It allows for efficient and
reasonably accurate calculations over a vast range of magnitudes, from subatomic scales to
astronomical distances.
Understanding floating point arithmetic, including its limitations and best practices, is essential for
software developers, engineers, and scientists who rely on precise and efficient numerical
computations in their work.
For the fractional part, follow the multiplication process as shown below:
.265 x 2 .265 x 8 .265 x 16
0.530 x 2 2.120 x 8 4.240 x 16
1.060 x 2 0.960 x 8 3.840 x 16
0.120 x 2 7.680 x 8 D.440 x 16
0.240 x 2 5.440 x 8 7.040 x 16
0.480 3.520 0.640
(0.265)10 = (0.0100)2 (0.265)10 = (0.20753)8 (0.265)10 = (0.43𝐷70)16
Therefore,
(100.265)10 = (1100100.0100)2
(100 ⋅ 265)10 = (144 ⋅ 20753)8
(100.265)10 = (64 ⋅ 43𝐷70)16
1 001
2 O10
3 011
4 100
5 101
6 110
7 111
Similarly, to convert Hexadecimal to Binary or vice-a-versa, we should now the equivalent
numbers for both systems.
Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Example:
Convert 61358 :
Solution:
6 1 3 5
110 001 011 101
61358 = 1100010111012
Example:
Convert 1𝐴2𝐶16 to binary
1 A 2 C
0001 1010 0010 1100
1𝐴2𝐶16 = 11010001011002
3. SIGNIFICANT DIGITS/FIGURES
There are two kinds of numbers, exact and approximate numbers. The numbers like 1, 2, 3, …,
1 (= 0.5), 3 (= 1.5), ... are treated as exact numbers. But there are numbers 2 (= 0.285714….),
2 2 7
3.1 Definition:
The digits that are used to express a number are called significant digits or significant figures. The
significant figures of a number are defined as follows:
Rule 1: (Numbers without decimal point): If the number does not have any decimal point, the
significant figures of the number are the digits counted from the first non-zero digit on the left to
the last non-zero digit on the right. Therefore, the number 12040 has four significant figures.
Rule 2: (Numbers with decimal point): If the number has a decimal point, the significant figures of
the number are the digits counted from the first non-zero digit on the left to the last digit on the
right side (irrespective of whether it is zero or non-zero). Therefore, the number, 2100.4, has five
significant figures, and the number 0.015, has two significant figures.
Thus each of the numbers 3.1416, 0.60125 and 4.0002 contain five significant digits while the
numbers 0.00386, 0.000587 and 0.00205 contain only three significant digits, since zeros only
help to fix the position of the decimal point.
3.2 Note:
The following statements describe the notion of significant digits,
1. All non-zero digits are significant
2. All zeros occurring between non-zero digits are significant digits.
3. Trailing zeros following a decimal point are significant. For example 3.500, 65.00 and 0.3210
have four significant digits each.
4. Zeros between the decimal point and preceding a non-zero digit are not significant.
Integer numbers with trailing zeros may be written in scientific notation to specify the significant
digits. The concept of accuracy and precision are closely related to significant digits. They are
related as follows.
3.3 Example:
i) 7.560 has four significant digits
25000 has two significant digits
2.00004 has six significant digits
0.04500 has four significant digits
0.0201 has three significant digits
0.00001 has one significant digit
100.00001 has eight significant digits
ii) Accuracy refers to the number of significant digits in a value. For example, the number 57.396
is accurate to five significant digits.
Solution:
(a) This has five significant digits.
(b) This has four significant digits. The leading or higher order zeros are only place holders.
(c) This has six significant digits.
(d) This has two significant digits.
(e) This has four significant digits. The zeros were made significant by writing .00 after 3600.
iii) Precision refers to the number of decimal positions, i.e. the order magnitude of the last digit
in a value. The number 57.396 has precision of 0.001or 10-3.
Solution:
(a) 4.2301 has a precision of 10 –4
(b) 4.23 has a precision of 10 –2
(c) 4.230106 has a precision of 10 –6.
4. ERRORS
understandable to the user – before their print out. Therefore, an additional error is committed at
this stage too. This error is called local round-off error.
It is clear that (0.7625)10 = (0.11000011 0011)2. If a particular computer system has a word length
of 12 bits only, then the decimal number 0.7625 is stored in the computer memory in binary form
as 0.110000110011. However, it is equivalent to 0.76245. Thus, in storing the number 0.7625, we
have committed an error equal to 0.00005, which is the round-off error; inherent with the computer
system considered.
4.4 Definition:
We define the error as
Error = True value – Computed value
4.6 Example:
The following numbers rounded-off to four significant digits:
7.8926 to 7.893
128.614 to 128.6
3.14159 to 3.142
0.859321 to 0.8593
8476.7 to 8477
In any Numerical computation, we come across the following types of errors.
n
S = a i x i is replaced by the finite sum ai x i
i =0 i =0
= 0.1402755 10 –2.
ii) Truncation error when first four terms are added.
2 3 4 5 6
Truncation error = ex –(1 + x + x – x ) = + x + x + x
2 ! 3! 4! 5! 6!
= 0.694222 10 – 4.
iii) The truncation error when first five terms are added = 0. 275555 10-5.
Let X be a number such that X _ X a X, then X is an upper limit on the magnitude of
5.2 Definition:
The relative error is the absolute error divided by the true value of the quantity and this is denoted
by Er,
Absolute error Ea
Relative error Er = = .
True value X
X X
Similarly, the quantity ~ measures the relative accuracy.
X Xa
5.3 Definition:
The percentage error Epis given by Ep = E a 100 =Er 100.
X
Observations:
1. The relative and percentage errors are independent of the units used while absolute error is
expressed in terms of these units.
Example:
If the number X = 0.51 and is correct to two decimal places, then
X = 1 10 −2 = 0.005
2
Example:
Solution:
Absolute error Ea = True value – Approximate value
2 2 − 2.01 1
= − 0.667 = = 10−3
3 3 3
Absolute error
Relative error Er =
True value
1
( 10−3 )
1
= 3 = 10−3
2/3 2
6. MATHEMATICAL PRELIMINARIES
In this section we state without proof, certain mathematical results which would be useful in the
sequel.
6.1 Theorem:
If f(x) is continuous in a ≤ x ≤ b and if f(a) and f(b) are of opposite signs, then f(c) = 0 for at least
one number c such that a < c < b.
6.4 Example:
Verify Rolle’s theorem for the function f(x) = |x| in (–1, 1).
Solution: Here f(x) = –x for – 1 < x < 0.
= 0 for x = 0
= x for 0 < x < 1
f(-1) = 1 = f(1)
Hence f(-1) = f(1)
f1(x) = -1 for – 1 x 0
f1(x) = 1 for 0 x 1
Therefore f 1(x) does not exist at x = 0 and hence f(x) is not differentiable in (–1, 1) Rolle’s theorem
is not applicable to the function f(x) = |x| in (–1, 1)
y y = f(x) = |x|
x1 O x
y1
Example: f(x) = x2 + x – 1
f(0) = 0 + 0 –1 = –1 < 0
f(1) = 1 + 1 –1 = 1 > 0
Here f(x) = x2 + x –1 is a continuous function and f(0) and f(1) are of different signs, therefore at
least one real root lies between 0 and 1.
R
y
Q
P f(c)
f(b)
f(a)
x1 x
O x=a x=c x=b
1
y
Hence this theorem tells that there is at least one point R on the curve PQ where the tangent to
the curve is parallel to the chord PQ.
If f(x) is continuous and possesses continuous derivatives of order n in an interval that includes x
= a, then in that interval
( x − a) 2 ( x − a) n −1 (n–1)
f(x) = f(a)+ (x–a) f1(a) + f (a) + .... +
''
f (a) +Rn (x)
2! (n − 1)!
where Rn (x), the remainder term can be expressed as
( x −a ) n n
Rn (x) = f (), a << x.
n!
Then the elements of C which satisfy the above rules of addition and multiplication are called
complex numbers. If z = (x, y) is a complex number then x is called the real part and y is called
the imaginary part of the complex number z and they are denoted by x = Re z and y = Im z. If (x1,
y1) and (x2, y2) are two complex numbers then (x1, y1) = (x2, y2) if and only if
x1 = x2 and y1 = y2.
3. Associative law: z1 + (z2 + z3) = (z1 + z2) + z3 for every z1, z2, z3 C Proof of this is similar to
above proof.
4. Existence of identity element: There exists an element (0, 0) C such that,
(x, y) + (0, 0) = (x + 0, y + 0) = (x, y) for every (x, y) C. Here (0, 0) is called the additive
identity element of C.
5. Existence of inverse: For every (x, y) C there exists (–x, –y) C such that
(x, y) + (–x, –y) = (x – x, y – y) = (0, 0).
Hence (–x, –y) is the additive inverse of (x, y).
Thus we have shown that the set C is an abelian group w.r.t. the addition of complex numbers
defined by (1).
(b) Properties of multiplication
1. Closure law: If z1 = (x1, y1), z2 = (x2, y2) C then from (2)
z1z2 = (x1, y1) (x2, y2) = (x1x2 – y1y2, x1y2 + x2y1), which is also an ordered pair of real numbers.
Hence z1z2is also a complex number.
Thus, for every z1, z2 C, z1z2 C.
2. Commutative law: z1z2 = z2z1for every z1, z2 C.
Nowz1z2 = (x1, y1) (x2, y2) = (x1x2 – y1y2, x1y2 + x2y1) ….. (i)
and z2z1 = (x2, y2) (x1, y1) = (x2x1 – y2y1, x2y1 + x1y2)
= (x1x2 – y1y2, x1y2 + x2y1) ….. (ii)
From (i) and (ii) z1z2 = z2z1.
3. Associative law: z1(z2z3) = (z1z2) z3, for every z1, z2, z3 C.
Proof is similar to above proof.
4. Existence of identity element: There exists (1, 0) C such that
(x, y) (1, 0) = (x . 1 – y . 0, x . 0 + 1 . y) = (x, y) for every (x, y) C.
Here (1, 0) is called the multiplicative identity element.
5. Existence of inverse: Let z = (x, y) (0, 0), be a complex number. Let (u, v) be the inverse of
(x, y).
Then (u, v) . (x, y) = (1, 0), the identity element.
i.e. (ux – vy, uy + vx) = (1, 0).
Hence ux – vy = 1, and uy + vx = 0.
x −y
Solving for u and v, we get, u = , v=
x +y
2 2
x + y2
2
x −y
Hence , C is the multiplicative inverse of (x, y).
x +y
2 2
x 2 + y 2
Thus we have shown that the set of non-zero complex numbers forms an abelian group w.r.t. the
multiplication defined by (2).
Also we can prove that the multiplication is distributive over addition.
The complex numbers whose imaginary parts are equal to zero possess the following properties.
Thus, if z = x + iy then z = x − iy .
and z − z = (x + iy ) − (x − iy ) = 2 iy = 2 i lm z.
Also, z . z = (x + iy ) . (x − iy )
= x2 – i2y2
=x2 + y2, which is a real number.
Thus the product of complex number and its conjugate is a real number.
z1 z1
3. = , z2 0
z2 z2
i.e., the conjugate of a quotient is equal to the quotient of the conjugates.
is denoted by | z |.
Thus z = x 2 + y 2 .
4. z1 − z2 z1 − z2
7. SUMMARY
8. SELF-ASSESSMENT QUESTIONS
C) Truncation error
D) Overflow error
15. In floating-point arithmetic, the part of the number that represents the significant digits is
called the:
A) Exponent
B) Mantissa
C) Base
D) Coefficient
9. TERMINAL QUESTIONS
10. ANSWERS