if: using if statements and logical expressions to control a calculation. We look at the determination of leap years, the Pittsburgh bus fare, the inclusion of a point inside an interval, and the Collatz conjecture.
Lecture notes:
The bus_fare example:
Three ways to sample a circle, one a little wasteful, one using uniform values for r and t, one using weighted values for r:
The Collatz conjecture:
The game of craps:
Heron's formula for triangle area:
The leap year:
Sort a, b, c:
Assignment #1 due on Friday, 17 January: