Lecture 0 - Exercises
Outcomes:
Overview
- Get a sense for what the course is about
- Meet your classmates and set the tone for a collaborative,
interactive learning environment
Sets 0
- Describe what a set is and how a set’s contents and members are
denoted (\(\{\ldots\}\),\(\in\) )
- Know the notation for natural numbers (\(\mathbb{N}\)), integers (\(\mathbb{Z}\)), rational numbers (\(\mathbb{Q}\)), real numbers, and the empty
set (\({\varnothing}\) or \(\emptyset\), or occasionally \(\{\}\))
Racket 0
- Know how to interpret and write expressions in prefix operator
notation
- Know how to interact with the Racket interpeter in DrRacket
- Know how to represent and work with basic data types (booleans,
numbers, strings) in racket.
Part A
Write down each of the following sets using the roster method:
- \(V\), the set of all vowels in the
English alphabet.
- \(O\), the set of all positive
integers less than 10
- \(S\), the set of all positive
integers less than 100
- The set of all integers
Part B
True or false:
- \(0 \in \mathbb{Z}\)
- \(0 \in \mathbb{N}\)
- \(V = \{u, i, a, e, o, u\}\) (using
\(V\) as defined above in Part A)
- \(\pi \in \mathbb{Q}\)
Part C
- Recall that the formula for the volume of a sphere is \(\frac{4}{3}\pi r^3\). Racket has a built-in
function
expt
to calculate exponents; its two arguments are
the base and the exponent. Racket also has a built-in variable
pi
containing the (approximate) value of \(\pi\). Suppose a variable r
has been defined, and write a Racket expression to compute the volume of
a sphere with radius r
.