% ENGR 11: Lesson 3
% Suggested Problems
% Author: Wesley Cheung
% Last Updated: 3/27/2020
%
% Theoretical Problems
% 1.A. The most popular sets of numbers in mathematics are natural numbers (ℕ), integers (ℤ), rational number (ℚ), real numbers (ℝ), and complex numbers (ℂ).
% B. For unsigned integers, we are essentially talking about the set of positive whole numbers with zero included, which is natural numbers. For signed integers, we are talking about the set of all the positive, negative whole numbers and zero.
% C. While the position number is n, the digit number will be (n+1).
% D. For each digit, from the least significant to the most significant (right to left), it is multiplied by the radix raised to the power of the position number.
% E. Bit stands for binary digits. For both binary and decimal digit, each of their digit has a maximum value that each can hold. Yet, the values that each digit can hold in binary digits are {0,1} while that of in decimal digits are {0,1,2,3,4,5,6,7,8,9}.
% F. A bit means one binary digit. 4 bits (4 binary digits) makes a nibble. 2 nibbles (8 bits) make one byte. Two bytes (4 nibbles, 16 bits) make one word.
% G. A positional system is a numeral system in which the contribution of a digit to the value of a number being the product of the value of the digit by a factor determined by the position of the digit. In binary, decimal, and hexdecimal number system, each digit is multiplied by a radix raised to the power of its respective position number.
% H. A 4-bit string of binary digits can produce 16 unique nibbles (0-15).
% I. 4-bit nibble                 hexadecimal
%        0000                                0
%        0001                                1
%        0010                                2
%        0011                                3
%        0100                                4
%        0101                                5
%        0110                                6
%        0111                                7
%        1000                                8
%        1001                                9
%        1010                                a
%        1011                                b
%        1100                                c
%        1101                                d
%        1110                                e
%        1111                                 f
% J. There are 16 data types in MATLAB, namely logical, char, uint8, uint16, uint32, uint64, int8, int16, int32, int64, single, double, table, cell, struct, and function handle.
% K. The 10 numerical data types are uint8, uint16, uint32, uint64, int8, int16, int32, int64, single, double. For all the "uint" data type, they are for unsigned integers, which is basically all the natural numbers. For all the "int" data type, they are for signed integers, which are all the integers. As for single and double data type, they are for floating point numbers.
% L. The most significant digit refers to the left-most digit of a number while the least significant digit refers to the right-most digit.
% M. Radix is the base of multiplication for each digit in the positional numerical system. For binary digits, the radix is 2, decimal being 10, and hexadecimal being 16.
% N. format hex displays numbers in hexadecimal format.
% O. uint8(x)/uint16(x)/uint32(x)/uint64(x), where x is the value that we want to store.
%
% Suggested Problems
% 20.A.i) Refer to attachment.
%         ii)

A = dec2bin(247)

%        iii) Refer to attachment.
%        iv)

A = dec2hex(247)

%      B. i) Refer to attachment.
%          ii)

B = dec2bin(543)

%         iii) Refer to attachment.
%         iv)

B = dec2hex(543)

%       C. i) Refer to attachment.
%           ii)

C = dec2bin(4095)

%          iii) Refer to attachment.
%          iv)

C = dec2hex(4095)

%       D. i) Refer to attachment.
%           ii)

D = dec2bin(51203)

%          iii) Refer to attachment.
%          iv)

D = dec2hex(51203)

%
% 21.A. i) Refer to attachment.
%          ii)

a = bin2dec('1011')

%          iii) Refer to attachment.
%          iv)

a = dec2hex(11)

%      B. i) Refer to attachment.
%          ii)

b = bin2dec('01101001')

%          iii) Refer to attachment.
%          iv)

b = dec2hex(105)

%      C. i) Refer to attachment.
%          ii)

c = bin2dec('011100001110')

%         iii) Refer to attachment.
%         iv)

c = dec2hex(1806)

%       D. i) Refer to attachment.
%           ii)

d = bin2dec("0001101100101101")

%          iii) Refer to attachment.
%          iv)

d = dec2hex(6957)

%
% 22. A. i) Refer to attachment.
%           ii)

aa = dec2hex(227)

%           iii) Refer to attachment.
%           iv)

aa = bin2dec('11100011')

%        B. i) Refer to attachment.
%            ii)

bb = dec2hex(3482)

%           iii) Refer to attachment.
%           iv)

bb = bin2dec('1101 1001 1010')

%       C. i) Refer to attachment.
%           ii)

cc = dec2hex(6732)

%          iii) Refer to attachment.
%          iv)

cc = bin2dec('0001101001001100')

%       D. i) Refer to attachment.
%           ii)

dd = dec2hex(4294967295)

%          iii) Refer to attachment.
%          iv)

dd = bin2dec( ...
    '11111111111111111111111111111111')