### Math 210, Fall 2001: Day By Day Part 1

A day by day outline of some topics what we cover.

These are not intended to be balanced or comprehensive notes. They are to supply motivation and fill gaps. Thus, standard material easily available in traditional texts will be skipped, while brief (quick and dirty) notes about computer or Internet issues may be here.

In principle, the Wednesday classes will involve more computer issues. But real life is never that tidy.

Contents

Thurs. Sep. 6
After a rough outline of the course, we briefly discussed writing your own web "Home Page". How do you give others permission to read a web page you wrote? Where do you put these pages on your computer?
NOTE: Although this class mainly touched on some computer issues, the first topic in the course proper will be a study of various questions involving probability.

Tues. Sep. 11
No class because of the tragedy.

Wed. Sept. 12
More computer issues.

Thurs. Sept. 13
An introduction to probability.
Example 1. If you toss two dice, what is the probability that you will get a pair of 6's?
What is the likelihood at least one of the die has a 6?
If you toss four dice, what is the probability that at least one of them is a 6?
Moral: In probability computations where "or" is involved (as: either one die or the other has a 6), then it is usually wise to use the "complementary event".
Example 2. Birthday problem. In a class of 30 students, what is the probability that two of them have the same birthday?
Example 3. (Continuous probability). Every day you go to the corner and catch the bus. The busses come every 10 minutes, but begin at random times each morning. What is your average waiting time?
Same problem, but now two bus lines are available. They both run every 10 minutes, starting at random times each morning.
Example 4. (Conditional probability) Say of a group of 1 year old babies, 95% have a life expectancy of at least 65 years and 60% have a life expectancy of at least 75 years. From this same group, what percentage of those who live to be 65 are expected to live to be 75?

Tues. Sep. 18

Wed. Sept. 19
This lecture was an introduction to the computer langauge Perl.
Example 1. Carrying out the computation in the Birthday Problem. We need to compute (364/365)(363/365)...(341/365). This can be painful. We write a computer program using perl:
Birthday Computation program for 50 people
If you want to post something on the web, where on your computer do you put it? The answer depends on how the computer was set-up. On mail.sas, eniac.seas and the class computer johnny.sas files you have go in the directory named html, a subdirectory of your "home" directory. They can also go in sub-directories of this directory.
Although most computers do not allow you to have programs on the web, our class does allow this. However, for security, they can only be in the directory html/cgi-bin/ (or its sub-directories).
Any programs on the web must allow anyone to execute them. On a Unix computer this usually means
chmod 755 [program_name]

Programs not intended for the web can be located in any of your directories. You may wish to make a directory 210 for our class stuff:
`  mkdir \$HOME/210`
Although we will primarily use Perl in class, please feel free to use any other computer language you may prefer. Just don't assume that I will be able to help you with it.

Example 2. A simple Perl example. This will also run on mail.sas or eniac.seas, except that you may need to change the location of perl. [To find the location just type which perl.]
Example 3. A Web form that collects input for an addition Perl program. This is essentially identical to the previous line, except using the Web for input.
Example 3a. Another example using the Web for input
Example 3b.A similar script, only using JavaScript instead of Perl. This is entirely self-contained. View the Page Source to see the details.
Example 4.See Voting on the Web for a sequence of Perl examples I wrote for this class.

Thurs. Sept. 20
Day of the Week: Given a month, day, and year, how do you compute the day of the week? Pick a reference day, say Jan. 1, 2001 which was a Monday. Find how many days have elapsed between then and your target date. Thus, if 14 or 700 days have elapsed, then since these numbers are divisible by 7, the given date is also a Monday. If 702 days have elapsed it is a Wednesday.
Example: June 1, 2001 We need to observe that June 1 is the 152nd day in 2001 (since 31+28+31+30+31+1 = 152) so it is 152-1 = 151 days after Jan. 1. Because 151 = 21*7 + 4, we know the day is 4 days later, a Friday.
Example: June 1, 2017 We know that 16 full years have elapsed making 16*365 days, to which we need to add 4 days for the leap years 2004, 2008, 20012, and 2016. Finally, as above we add 152-1=151 to compute that N = 16*365 + 4 + 151 days have elapsed since Jan. 1, 2001. To determine the day of the week we need only the remainder when dividing N by 7. It is 3 so the day is three days after Monday: a Thursday.
To check these computations, on a Unix computer the command cal 2017 gives a calendar for the year 2017, while cal 6 2017 gives a calendar for June 2017.

Conditional Probabilities
See The Legacy of the Reverend Bayes (this is the example we did in class) and Grinstead and Snell, Chapter 4 (pdf)
Baysean Inference -- Tutorials and Resources