Exercises
These exercises check whether you can read notation and translate it into meaning.
Try each prompt before opening the hint or solution.
If , compute:
Compute it first, then check your number.
HintSubstitute first
Replace with 6. Multiply before subtracting.
SolutionSubstitute and simplify
Given :
The important step is substitution: replace the name with the value it names, then do the arithmetic.
Let
Compute .
Compute it first, then check your number.
HintUse 5 as the input
The notation means use 5 as the input. Replace every with
5.
SolutionEvaluate the function
Use 5 as the input:
The notation is a function call. It means run the same rule with 5
as the input.
Let
Enter 1 if means cat is one of the allowed labels.
Compute it first, then check your number.
HintRead the symbol
The symbol means "is in".
SolutionMembership sentence
Enter 1. The statement means cat is a member of the set .
In this label example, it means cat is one of the allowed labels.
Let
Using mathematical indexing, what is ?
Compute it first, then check your number.
HintCount mathematically
In this chapter, mathematical indexing starts at 1: is the first item.
SolutionThird item
Using mathematical indexing:
So . The subscript names the position in mathematical indexing; it is not multiplication by 3.
If , , and , compute:
Compute it first, then check your number.
HintExpand first
Write the sum as .
SolutionExpand and substitute
Expand the summation:
Substitute the values:
The sigma notation is only a compact way to write this repeated addition.
In
enter 1 if the expression means "average the loss values."
Compute it first, then check your number.
HintRead inside out
First read the summation. Then read the factor .
SolutionAverage loss
The summation adds the loss values:
Multiplying by divides that total by n.
So the expression is the average loss over n examples.
A reader says:
If , then is
9because Python uses zero-based indexing.
Enter the correct value of in mathematical indexing.
Compute it first, then check your number.
HintSeparate the conventions
In mathematical indexing, is the first item.
SolutionDo not mix indexing systems
In mathematical indexing, is the first item. So if
then:
In Python, the second item is x[1], not x[2].
A model accepts one token from the set
Enter 1 if is true.
Compute it first, then check your number.
HintRead membership
Ask whether yes is listed in the set.
SolutionVocabulary membership
Enter 1. The token yes appears in , so is true.
Three examples have losses , , and .
What is the average loss?
Compute it first, then check your number.
HintUse the average pattern
Average means total divided by count.
SolutionAverage
Average means total divided by count. Here the total is 18 and the count is
3, so the average loss is 6.
Enter 1 if reading a formula aloud should include what the formula means in
the problem, not only the names of the symbols.
Compute it first, then check your number.
HintThree layers
Symbol name, operation, meaning in context.
SolutionMeaning matters
Enter 1. A useful reading does not stop at "sigma" or "x sub i." It says
what computation is being performed and what it means in the current problem.
After these exercises, use the revision notes to check the ideas before moving to vectors.