cs-3333: add hw3
This commit is contained in:
parent
63276157cf
commit
0334948053
361
Fall-2024/CS-3333/Assignments/3/HW3.typ
Normal file
361
Fall-2024/CS-3333/Assignments/3/HW3.typ
Normal file
@ -0,0 +1,361 @@
|
||||
#set page(margin: (x: .5in, y: .5in))
|
||||
|
||||
#let solvein(solution) = {
|
||||
let outset = 3pt
|
||||
h(outset)
|
||||
box(
|
||||
outset: outset,
|
||||
stroke: blue + .3pt,
|
||||
fill: rgb(0, 149, 255, 15%),
|
||||
radius: 4pt,
|
||||
)[#solution]
|
||||
}
|
||||
|
||||
#let solve(content) = [
|
||||
#align(
|
||||
center,
|
||||
block(
|
||||
inset: 5pt,
|
||||
stroke: blue + .3pt,
|
||||
fill: rgb(0, 149, 255, 15%),
|
||||
radius: 4pt,
|
||||
)[#align(left)[#content]],
|
||||
)
|
||||
]
|
||||
|
||||
#let notein(content) = {
|
||||
let outset = 3pt
|
||||
h(outset)
|
||||
box(
|
||||
outset: outset,
|
||||
stroke: luma(20%) + .3pt,
|
||||
fill: luma(95%),
|
||||
radius: 4pt,
|
||||
)[#content]
|
||||
}
|
||||
|
||||
#let note(content) = [
|
||||
#align(
|
||||
center,
|
||||
block(
|
||||
inset: 5pt,
|
||||
stroke: luma(20%) + .3pt,
|
||||
fill: luma(95%),
|
||||
radius: 4pt,
|
||||
)[#align(left)[#content]],
|
||||
)
|
||||
]
|
||||
|
||||
#align(center)[
|
||||
= CS 3333 Mathematical Foundations
|
||||
Homework 3 (100 points)\
|
||||
#underline[Price Hiller] *|* #underline[zfp106]
|
||||
]
|
||||
|
||||
#line(length: 100%, stroke: .25pt)
|
||||
|
||||
= Submission:
|
||||
|
||||
Same as HW1.
|
||||
|
||||
= Questions
|
||||
|
||||
Convert a number in a number system to another one. *Write down the intermediate steps of your calculations.*
|
||||
|
||||
+ Decimal numbers to binary numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$157$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(157)_10 &= 2 ⋅ 78 &+ #text(red)[1]\
|
||||
78 &= 2 ⋅ 39 &+ #text(red)[0]\
|
||||
39 &= 2 ⋅ 19 &+ #text(red)[1]\
|
||||
19 &= 2 ⋅ 9 &+ #text(red)[1]\
|
||||
9 &= 2 ⋅ 4 &+ #text(red)[1]\
|
||||
4 &= 2 ⋅ 2 &+ #text(red)[0]\
|
||||
2 &= 2 ⋅ 1 &+ #text(red)[0]\
|
||||
1 &= 2 ⋅ 0 &+ #text(red)[1]
|
||||
$
|
||||
#solve[$(157)_10 = (10011101)_2$]
|
||||
]
|
||||
],
|
||||
[
|
||||
$39.25$
|
||||
|
||||
#notein[
|
||||
#align(center)[#underline[Whole Number]]
|
||||
$
|
||||
(39)_10 &= 2 ⋅ 19 &+ #text(red)[1]\
|
||||
19 &= 2 ⋅ 9 &+ #text(red)[1]\
|
||||
9 &= 2 ⋅ 4 &+ #text(red)[1]\
|
||||
4 &= 2 ⋅ 2 &+ #text(red)[0]\
|
||||
2 &= 2 ⋅ 1 &+ #text(red)[0]\
|
||||
1 &= 2 ⋅ 0 &+ #text(red)[1]
|
||||
$
|
||||
#align(center)[#underline[Fraction]]
|
||||
$
|
||||
.50 &= 0.25 ⋅ 2 #note[#text(red)[0]]\
|
||||
1.00 &= 0.50 ⋅ 2 #note[#text(red)[1]]
|
||||
$
|
||||
#solve[$(39.25)_10 = (100111.01)_2$]
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
+ Binary numbers to decimal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$(10111010)_2$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(1 ⋅ 2^7) + (0 ⋅ 2^6) + (1 ⋅ 2^5) + (1 ⋅ 2^4) + (1 ⋅ 2^3) + (0 ⋅ 2^2) + (1 ⋅ 2^1) + (0 ⋅ 2^0) = #solve[$(186)_10$]
|
||||
$
|
||||
]
|
||||
],
|
||||
[
|
||||
$(1101.011)_2$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(1 ⋅ 2^3) + (1 ⋅ 2^2) + (0 ⋅ 2^1) + (1 ⋅ 2^0) + (0 ⋅ 2^-1) + ( 1 ⋅ 2^-2) + (1 ⋅ 2^-3) = #solve[$(13.375)_10$]
|
||||
$
|
||||
]
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
+ Octal integers to binary numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$(527)_8$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Octal*], [$5$], [$2$], [$7$],
|
||||
[*Binary*], [$101$], [$010$], [$111$],
|
||||
)
|
||||
#solve[$(527)_8 = (101010111)_2$]
|
||||
]
|
||||
],
|
||||
[
|
||||
$(4361)_8$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto, auto),
|
||||
[*Octal*], [$4$], [$3$], [$6$], [$1$],
|
||||
[*Binary*], [$100$], [$011$], [$110$], [$001$],
|
||||
)
|
||||
#solve[$(4361)_8 = (100011110001)_2$]
|
||||
]
|
||||
],
|
||||
)
|
||||
+ Octal integers to decimal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$(527)_8$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(5 ⋅ 8^2) + (2 ⋅ 8^1) + (7 ⋅ 8^0) = #solve[$(343)_10$]
|
||||
$
|
||||
]
|
||||
],
|
||||
[
|
||||
$(4361)_8$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(4 ⋅ 8^3) + (3 ⋅ 8^2) + (6 ⋅ 8^1) + (1 ⋅ 8^0) = #solve[$(2289)_10$]
|
||||
$
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
+ Binary numbers to octal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$(10 110 110)_2$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Binary*], [$#text(red)[0]10$], [$110$], [$110$],
|
||||
[*Octal*], [$2$], [$6$], [$6$],
|
||||
)
|
||||
#solve[$(10 110 110)_2 = (266)_8$]
|
||||
]
|
||||
],
|
||||
[
|
||||
$(11 110.011)_2$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Binary*], [$#text(red)[0]11$], [$110$], [$011$],
|
||||
[*Octal*], [$3$], [$6$], [$3$],
|
||||
)
|
||||
#solve[$(11 110.011)_2 = (36.3)_8$]
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
+ Hexadecimal integers to binary numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
(F$6$A$)_16$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Hexadecimal*], [F], [$6$], [A],
|
||||
[*Binary*], [$1111$], [$0110$], [$1010$],
|
||||
)
|
||||
#solve[(F6A$)_16 = (1111 0110 1010)_2$]
|
||||
]
|
||||
],
|
||||
[
|
||||
(D$0$EB$)_16$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto, auto),
|
||||
[*Hexadecimal*], [D], [$0$], [E], [B],
|
||||
[*Binary*], [$1101$], [$0000$], [$1110$], [$1011$],
|
||||
)
|
||||
#solve[(D$0$EB$)_16 = (1101 0000 1110 1011)_2$]
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
+ Hexadecimal integers to decimal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
(F6A$)_16$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(15 ⋅ 16^2) + (6 ⋅ 16^1) + (10 ⋅ 16^0) = #solve[$(3946)_10$]
|
||||
$
|
||||
]
|
||||
],
|
||||
[
|
||||
(D0EB$)_16$
|
||||
|
||||
#notein[
|
||||
$
|
||||
(13 ⋅ 16^3) + (0 ⋅ 16^2) + (14 ⋅ 16^1) + (11 ⋅ 16^0) = #solve[$(53483)_10$]
|
||||
$
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
+ Binary numbers to hexadecimal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$(10 1101. 011)_2$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Binary*], [$#text(red)[00]10$], [$1101$], [$011#text(red)[0]$],
|
||||
[*Hexadecimal*], [$2$], [D], [$6$],
|
||||
)
|
||||
#solve[$(10 1101. 011)_2 = (2$D$.6)_16$]
|
||||
]
|
||||
|
||||
],
|
||||
[
|
||||
$(1 1011 1101)_2$
|
||||
|
||||
#notein[
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Binary*], [$#text(red)[000]1$], [$1011$], [$1101$],
|
||||
[*Hexadecimal*], [$1$], [B], [D],
|
||||
)
|
||||
#solve[$(1 1011 1101)_2 = (1$BD$)_16$]
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
+ Octal numbers to hexadecimal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
$(605.35)_8$
|
||||
|
||||
#notein[
|
||||
1. #underline[Octal to Binary]
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto, auto, auto, auto),
|
||||
[*Octal*], [$6$], [$0$], [$5$], [$.$], [$3$], [$5$],
|
||||
[*Binary*], [$110$], [$000$], [$101$], [$.$], [$011$], [$101$],
|
||||
)
|
||||
#note[$=11 000 0101 .011 101$]
|
||||
//$=1 1000 0101.0111 01$
|
||||
2. #underline[Binary to Hexadecimal]
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto, auto, auto, auto),
|
||||
[*Binary*],
|
||||
[$#text(red)[000]1$],
|
||||
[$1000$],
|
||||
[$0101$],
|
||||
[$.$],
|
||||
[$0111$],
|
||||
[$01#text(red)[00]$],
|
||||
|
||||
[*Hexadecimal*], [$1$], [$8$], [$5$], [$.$], [$7$], [$4$],
|
||||
)
|
||||
#solve[$(605.35)_8 = (185.74)_16$]
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
+ Hexadecimal numbers to octal numbers. (10 pts)
|
||||
#enum(
|
||||
numbering: "a.",
|
||||
[
|
||||
(C$9$A.$3$B$)_16$
|
||||
|
||||
#notein[
|
||||
1. #underline[Hexadecimal to Binary]
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto, auto, auto, auto),
|
||||
[*Hexadecimal*], [C], [$9$], [A], [$.$], [$3$], [B],
|
||||
[*Binary*], [$1100$], [$1001$], [$1010$], [$.$], [$0011$], [$1011$],
|
||||
)
|
||||
#note[$=1100 1001 1010 . 0011 1011$]
|
||||
//$=110 010 011 010.001 110 11
|
||||
2. #underline[Binary to Octal]
|
||||
#table(
|
||||
columns: (auto, auto, auto, auto, auto, auto, auto, auto, auto),
|
||||
[*Binary*],
|
||||
[$110$],
|
||||
[$010$],
|
||||
[$011$],
|
||||
[$010$],
|
||||
[$.$],
|
||||
[$001$],
|
||||
[$110$],
|
||||
[$11#text(red)[0]$],
|
||||
|
||||
[*Octal*], [$6$], [$2$], [$3$], [$2$], [$.$], [$1$], [$6$], [$6$],
|
||||
)
|
||||
#solve[(C$9$A.$3$B$)_16 = (6232.166)_8$]
|
||||
]
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue
Block a user