Discrete Mathematics Assignment Solution for MAT1101, Semester 1, 2019

Verified

Added on  2023/01/18

|11
|1531
|1
Homework Assignment
AI Summary
This document presents a comprehensive solution to a Discrete Mathematics assignment. The assignment covers a range of topics, including binary representation, exploring the maximum value in 12-bit systems and 2's complement representation. It delves into floating-point number representation, scientific notation, and the conversion between decimal and binary formats. The solution also addresses the storage of text characters, like "Bob", using binary patterns. Furthermore, it includes problems involving hexadecimal conversions, bit manipulation, and the use of pseudocode. The assignment also touches upon double-precision floating-point numbers and the conversion of decimal numbers to their binary equivalents. This document provides detailed explanations and solutions to each problem, making it a valuable resource for students studying discrete mathematics.
Document Page
1
DISCRETE MATHEMATIC
Student’s Name:
University Affiliation:
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
2
Problem 1
The maximum value of the exponential x in 12-bits can be found as;
10x =22047 which tends to x=616.
As a result, the maximum positive number in 12 bits 2’s complement is
2047.
But 2047 is equivalent to 011111111111 in binary system.
You notice that the decimal component i.e 2047 is obtained by converting
011111111111 as illustrated below;
(1024 +512 +256 +128 + 64 + 32 + 16 +8 + 4 +2 + 1)~(0 1 1 1 1 1 1 1
1 1 1 1 1 )
2047.
Problem 2
To find the values of a 12-bits representation of a signed integer, the
following steps are involved;
i)Find the positive value.
ii)Switch to 1s and 0s.
iii)Add 1.
This can be expressed as;
(-128 + 64 + 32 +16 + 8 + 4 + 2 + 1) = -95
(-128 + 0+ 32 + 0 + 0 + 0 + 0 +0 + 1) = -95
(1 0 1 0 0 0 0 0 1)
Problem 3
Computers use a form of scientific notation for floating point representation.
The numbers themselves are written in scientific notation that have got
three components as a whole.
Therefore,
121.12 can also be expressed in scientific notation;
Document Page
3
121.12=1.2112 * 103
But;
121 can be expressed to be equivalent to (64 +32 + 16 + 8 + 0 + 0 + 1) in
a 12- bits notation.
This gives,
(1 1 1 1 0 0 1) ~ exponent
However, this is not the exact;
You can also express 1.2112 * 103 as 0.12112 * 104
Hence, you can use your 13 biased experiment and add 4 to give;
17 10=(16+ 0+0+0+1)
~(1 0 0 0 1 ) ~ mantissa
But;
The floating-point number is represented as sign| mantissa |Exponent;
Expressed as 0 |1 0 0 0 1 | 1 1 1 1 0 0 1|
The integer number is a positive hence expressed as o in the float.
Problem 4
The number stored in question 3 is not exact due to some errors.
The errors can be corrected by finding the quotient value;
1 1 1 0
=1 0 0 0 1 1 1 1 1 0 0 1
- 1 0 0 0 1
1 1 1 1
1 1 1 1 0
-1 1 1 1 1
-1 0 0 0 1
Document Page
4
1 0 1 0
Hence the exact number to be stored is given as 1 1 1 0.
Problem 5
The bits in electronic form can only take two values i.e. 0 and 1.
A letter is usually stored using a byte (8 bits) which should be confirmed,
otherwise, a challenge.
“Bob” is a text which is stored on a computer by first converting each
character to an integer and then storing the integer.
For instance,
You are to store “B” as 66, and “O” as 79 as the integer numbers assigned.
But, “Bob” have got three characters each with independent integer values.
This is equivalent to;
66 + 66 + 79 =211.
211~(128 +64 +32+ 0 + 0 + 4 + 2 +1+ 1)
=(1 1 1 0 0 1 1 1 1)
Therefor, “Bob” would be stored as 9 bits in the computer system.
Problem 6
To get the actual pattern required to store “Bob”, You are required to assign
a different pattern of bits to each of the characters.
For instance, “Bob” has got only three characters.
Each is usually stored in 8 bits but with limitations, with one wasted bit. The
first bit in each of the 8 bits pattern is a 0.
To confirm the pattern;
Let character “B” and “b” be represented by 66 as the integer values and
character “o” as 79.
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
5
Therefore,
B~66 = (64 + 0 + 0 + 0 + 0 + 2)
(1 0 0 0 0 1)
Hence the pattern would be (0 1 0 0 0 0 1)
O~79= (64 + 0 + 0 + 8 + 4 + 2 + 1)
= (1 0 0 1 1 1 1)
The exact pattern is (0 1 0 0 1 1 1 1)
Problem 7
The decimal number system is also known as base 10, consisting of ten
numerals i.e. 0 to 9, where 9 refer to the 10th item.
You are to represent the current state of 24-bits as a single hexadecimal.
0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 is the 24-bits
You can convert this to a binary system and decimals;
0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 =217 – 1
=131072-1
=131071.
Hence,131071 is the decimal value.
To convert this to hexadecimal, you subtract one.
i.e.
131071-1
=131070.
Problem 8
From a string, one character is often equivalent to 8 bits.
But 0 1 0 1 0 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1 is a 24 bits system.
You are asked to determine the characters involved in the 24-bits system.
Document Page
6
If one character is equivalent to 8 bits, how many characters are involved in
a 24-bits system?
=24/8
= 3
From table 1,the characters;”CAN”,”HTS”,”SOS”,”ESA”,”EPA”,HTJ”,”XXX”
possibly are involved.
Problem 9
If 24-bits are used for binary presentation, you are to select the bias in such
a way that you split the range equally, that is, you can choose a bias of 2n-1-
1.
However, there is a specified range of values that can be expressed in 24 –
bits.
For instance;
224-1-1=8388607 is a decimal value
This can also be represented as 8388607 + 23=8388630 ads a decimal
value.
Problem 10
You are to express the binary number system to decimal in finding the pair
of single precision floating point number representation of 24-bits.
2n=10x
But n=24,
Hence;
224=10x
10x=16777216
Xlog10=log16777216
X=7.2247
Document Page
7
You can then use your 25 biased experiment and add 7.22247 to get
32.224710
But;
32.224710= (32 + 0)
= (1 0)
Similarly;
32.2247= (16 + 8 + 4 + 2 + 1 + 1)
= (1 1 1 1 1 1)
Problem 11
In double precision, the smallest positive floating-point number is the
positive number closest to zero.
This is represented as the demoralized value with all 0’s in the exponential
field and binary value 1 in the fraction field.
This is given as;
2-52 * 2-1022
Which is equivalent to;
4.94066 * 10-324
Problem 12
You are to use the procedure below;
i)Find the positive value.
ii)Switch to 0s and 1s
Add 1.
For instance;
-121.12 ~121.12
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
8
This can be expressed to the scientific notation;
121.12=1.2112* 102=0.12121* 103
This is equivalent to;
121.12= (64 + 32 +16 +8 +4 +2 +1)
= (1 1 1 1 1 1)
This can be represented as;
1|1 0 0 0 1|1 1 1 1 0 01|
Problem 13
Use Pseud0-code, for values of F, thus, converted to a single execution.
F͢ True
While F =TRUE
Input F
F1 = 0
F2=--5
F3 =10
Print -F
Input count,
If CONT=1
F ͢ FALSE.
End while.
Problem 14
L0=TRUE
While l0=TRUE.
Document Page
9
Input l
L1=20
L2 =128
L3=210.
Print l0 and l
Input COUNT
If count=1
L0͢ False.
End if
End while.
Document Page
10
Reference
Knill, E. (1996). Conventions for quantum pseudocode (No. LA-UR-96-2724).
Los Alamos National Lab., NM (United States).
Erin Liong, V., Lu, J., Wang, G., Moulin, P., & Zhou, J. (2015). Deep hashing for
compact binary codes learning. In Proceedings of the IEEE conference on
computer vision and pattern recognition (pp. 2475-2483).
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
11
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]