# Blog, ECS 132, Winter 2021

Saturday, January 23, 12:30 pm

ECS 132 news items:

• Please remember to include 'ECS 132' in the Subject line when you send us e-mail.
• Recall that I will be giving each of your oral quizzes, individually. I had originally planned this for Weeks 5 and 6, but I am changing it to weeks 6 and 7.
Friday, January 22, 6:30 pm

Somehow the quiz for Sec. 2 is not up. We will do two quizzes for Sec. 2 next week.

Friday, January 22, 2:25 pm

As noted before, even if a homework problem asks you to find a probability, expected value etc. analytically (i.e. math), you should still write simulation code for your own benefit, to check your math.

In Problem 4, I have the opposite advice: Use an analytical solution to check your simulation code. I've added a couple of examples to the problem writeup.

Friday, January 22, 2:20 pm

Homework submission information on CSIF, per Arnav. Use the handin app:

handin acharyya hwk1

Friday, January 22, 9:40 am

In order to give you exposure to more examples involving expected value and variance (Problem 5), I'm moving the due date of Hwk 1 back to 1/27.

Wednesday, January 20, 11:20 pm

Keep in mind, the quiz policy is just like that of the homework. If a problem asks for a probability, expected value etc., it means the exact answer is required; do not do simulation unless it is specifically requested.

Please MAKE SURE you are mindful of the blog post of Thursday, January 14, 7:45 pm, especially the point about NOT simplifying math answers.

Wednesday, January 20, 7:10 pm

In a discussion of Problem 1a in the OH today, a student said his solution steps led him to finding

P(X1 + X2 ≥ 4 | X1 ≤ 3 and Y1 ≤ 3)

where Xi and Yi are Jill's and Jack's ith rolls, respectively. (Note that for instance X2 is undefined if Jill wins on the first turn.) He was unsure where to go next.

Well, first, we have that

P(X1 + X2 ≥ 4 | X1 ≤ 3 and Y1 ≤ 3) = P(X1 + X2 ≥ 4 | X1 ≤ 3)

Now, what to do with that? Rewrite it as

P(X1 + X2 ≥ 4 | X1 = 1 or X1 = 2 or X1 = 3)

Then use P(B | A) = P(A and B) / P(A) etc.

The message is, Don't give up! Persistence is key! Your solution may turn out to be rather lengthy in some cases.

Wednesday, January 20, 7:10 pm

I'm still seeing a lot of students try to intuit their way into solutions to the probability problems. Yes, intuition is highly important, but it will often lead you astray if you don't couple it with detailed, step-by-step use of the mailing tubes.

Wednesday, January 20, 7:00 pm

Someone asked whether numerical values will be announced for the math problems in the homework, so you can check your work. As I explained a couple of times in the blog and in class, what I prefer is that you write simulation code for the purpose of such checks (even if the problem doesn't ask for simulation code).

It may be that you find that your math and simulation answers don't match. Carefully go through each, and if you can't find the reason for the discepancy, contact a TA or me.

Note that simulation gives only approximate answers, so the math and simulation answers will not match perfectly. Try a much larger value of nreps if you are concerned that the difference may be due to a logical error. The discepancy should diminish.

Tuesday, January 19, 9:40 am

Homework news:

• I clarified the submission instructions at the top of the Hwk 1 file. Please note carefully.
• Problem 5: Note that I added that d = 3.
• Problem 3a: A student asks whether "we should take into account the people getting off the bus as well."

The problem asks for three probabilities; for concreteness, let's consider P(2 fail to board). Once again, the road to clarity comes from the notebook idea. There would be a column in the notebook labeled "2 passengers fail to board." This column would be filled with Yes's and No's. Neither the column's label nor its contents say anything about whether any passengers alight. Of course, in computing the requested probabilities, you will probably need to break events down by the number of alighting passengers, but the P(2 fail to board) probability itself does not mention such passengers.

• Remember, you can always check your mathematical solution by writing simulation code. I highly recommend this.
Monday, January 18, 9:00 pm

News items:

• By this point, you should have already been interacting with your group members. If you are not yet doing so, you need to remedy this right away.

As explained in the course syllabus and the ethics group meetings, it is imperative that you work closely with your group. Please, MAKE THIS WORK. I have found repeatedly that students who are in relatively inactive groups tend to do poorly in the class.

If a group finds that one of its members is devoting little or no time to the group's work, the group needs to let me know right away.

• Remember, precise thinking is key to success in the course. So for example, make sure to NOT write something like

P(Jill wins on 1st try) or P(Jill doesn't win on 1st try and Jack wins on 1st try)

This is nonsense. You are OR-ing together two numbers, when OR should only combine booleans.

What you should write is

P(Jill wins on 1st try or Jill doesn't win on 1st try and Jack wins on 1st try) = P(Jill wins on 1st try) + P(Jill doesn't win on 1st try and Jack wins on 1st try)

Now you are +ing together two numbers, the appropriate role for .

This point is made in the book (first bullet, p.17).

• Remember, only some of the pages of the book are covered in class. (These are the ones I believe involve the most difficult concepts, thus most important for devoting class time.) But you are responsible for the entire book, except sections that I specifically say to skip.

This coming week we will have Quiz 1, which will cover all of Chapter 2.

• Make sure you have read the blog post of January 15, 8:40 pm, regarding lost records of your work.
Friday, January 15, 8:40 pm

Reminder:

As explained in our course syllabus, all my files recording your grades on quizzes, homework and the term project are indexed by your official UCD e-mail address (which is the address I've been using in my e-mail messages to you). If you use some other e-mail address, in effect we have no record of your work! This is not good. :-(

Keep in mind that this is an issue not just for quizzes, but also for homework and term projects. Note that in the latter two cases, you work in groups. For instance, your group makes just one submission for the group, not one for each group member. That means that the person who submits the homework or term project must make sure that the e-mail address for each group member is correct.

Friday, January 15, 3:55 pm

There has been a change in office hours. Arnav will take over for Shubham. See our "course at a glance page for details. Shubham is still one of the TAs, so you can still e-mail him etc.

Friday, January 15, 2:05 pm

Make sure you understand R's *apply() functions. None is absolutely necessary, but they can simplify your work quite a lot.

Reminder: All blog posts are considered part of your official course materials. Be ready to use the *apply() functions on quizzes.

Thursday, January 14, 7:45 pm

Some tips to remember for Quiz 1 next week and all subsequent quizzes:

• Each quiz problem will be labeled either as "R code" or "text."
• If a problem is labeled "R code," it really means that. Your submission will be run though the R interpreter. If you have any non-code in it, the interpreter will generate an error message.
• Comment lines, beginning with '#', do count as R code. If you need to say something to the grader, place it in a comment.
• In problems labeled "R code," DO NOT SIMPLIFY YOUR ANSWERS. E.g. do not simplify

```(1/2) * (4/5) + 1/3
```

to 11/15. By submitting your un-simpllfied answer, you will be showing your work. Remembe, yur answer will be evaluated by R, so there is no need for simpllfication. And leaving things un-simpllfied is important in case you are partly wrong but deserve partial credit. And even if fully correct, SIMPLIFIED ANSWERS MAY NOT GET CREDIT.

Thursday, January 14, 12:30 pm

Someone asked whether it's OK to use '=' instead of '<-' as your assigment operator. The answer is "usually." There are situations, e.g. this one, where it may give you the wrong result or even generate an error message.

On the principle of "better safe than sorry," I do urge you to use '<-' for assigment. And I urge you to put a shortcut into your text editor's startup file. For instance, I have this line in my vim startup file:

```map! eqq <-
```

Then every time I want the "left arrow" assignment operator, I simply type 'eqq'. No hunting on the keyboard for '<','i, '-' or even '='.

Wednesday, January 13, 2:50 pm

Shubam will hold a special OH today re OMSI, 4 pm.

Tuesday, January 12, 11:00 pm

Misc.:

Tuesday, January 12, 9:55 pm

Concerning office hours (TAs and myself):

• OHs are for the purpose of clarifying course concepts, helping with code issues and helping with homework problems.
• If you need hints for a homework problem, we will provide them, so that you can think about them at home and continue work on the problem. (Note: "You" here is plural, meaning you and your homework group; you are all working together.)
• Needless to say, we will not provide you with a complete solution, but hopefully enough hints to get you started. If after further work at home you (plural) later need more hints, we will provide them. You can attend another OH or send e-mail.
• When more than one person is present in an OH, we will have you take turns asking whatever questions you have. When others are asking their own questions, you are very welcome to listen.
• Please do not try to complete your homework right there in the OH, hastily writing something up and then asking us, "Is this right?" Again, careful contemplation at home is the goal.
• Note that simulation can usually serve as a check on your analytical (i.e. math) solution, even if the problem does not ask for simulation.
• Every homework problem, every quiz problem, is different. This is not a matter of learning set patterns, which you may have done in calculus. Intuition is key, and that only comes from long, careful thought.
• Again, remember you are working in a GROUP. When you are in an OH, you are representing your group, and will bring what you learn in th OH back to the group. Please the word "we" rather than "I."
Tuesday, January 12, 4:50 pm

CRUCIAL instructions for taking quizzes. Follow these TO THE LETTER!

1. Make sure you have thoroughly tested OMSI, playing the roles of both student and instructor.
2. In your above tests, do at least one in which the server is running on CSIF, which will be the case during quizzes. Note that that means you must be running the UCD VPN.
3. The server host and port for your quiz will be shared with you in separate e-mail message, the day before the quiz. DO NOT SHARE THESE WITH OTHER STUDENTS; doing so will result in a report to the SJA.
4. That e-mail message will also state the start and end times of the quiz, usually a duration of 25 minutes. Of course, once the server shuts down, you cannot submit any further work. In fact, even if you submit just before the server goes down, it may not be processed by the server on time.
5. The quiz will be hosted during the discussion sections. You must take the quizzes in your enrolled discussion section.
6. As your discussion section is about to start, enter the Zoom session for that section, via Canvas. The TA will start the server at the appointed time, and you may begin the quiz.
7. Questions from students to the TA via Chat are allowable for clarification of the quiz questions' wording. Questions about the course content, the location of items in the textbook and other course materials will be answered with a polite statement, "Sorry, I can't answer that kind of question."
8. If you have a question during the quiz, address it ONLY to the TA, not to Everyone (the default). We may be able to disable the latter.
9. Quizzes are open book/notes. For convenience, you may wish to use OMSI's PDF feature, as it allows searches.
10. You are NOT allowed to otherwise access the Internet during quizzes.
11. You are NOT allowed to communicate with anyone, in the class or not, during a quiz.
12. Be ready for the quiz ON TIME. Clearly, with the quizzes being only 25 minutes in duration, you cannot afford to be late.

Tuesday, January 12, 8:40 am

ECS 132 news items:

• If your student ID number is on the list in the blog post of Sunday, January 10, 11:30 am, you should have received e-mail from me last night with the Zoom link for tomorrow's ethics meeting. You are required to attend. It will be held at the end of class but on a DIFFERENT Zoom link.
• I made a correction to a link in the post of 1/11, 19:15.
• Hwk 1 due date is January 25.
• I will be posting the next batch of problems for Hwk 1 today.
Monday, January 11, 19:15 pm

This post will be about LaTeX.

LaTeX is a standard typesetting language in tech and the sciences. It was invented by a computer scientist, the Turing Award winner Leslie Lamport. It consists of a number of macros for the more basic typesetting language, TeX, invented by another Turing Award winner, Stanford CS professor Donald Knuth . It is used by most CS professors in their research. If you do research with a professor, you probably will use it. It is also the basis for math typesetting in the Wikipedia.

What tools might you use to write LaTeX?

• I myself use my regular text editor, Vim, with my own homegrown macros. For instance, say I want to typeset e-x1. In LaTeX, that is

```e^{-x_{1}}
```

But I merely type

emsp-xmsb1

Here 'msp' is the name of my macro ("Math SuPerscript"), and it is automatically expanded as I type. I have 'msb' for subscripts etc. This is very, VERY fast to type once you get used to it.

I use Evince as my PDF viewer on my Linux desktop machines (home, office), and Skim on my Mac laptop. Both have the advantage of automatically updating the PDF file when one compiles the .tex file (which by the way I have triggered by a Makefile). Not quite as good as the continuous updating of Lyx, but on the whole the best solution for me.

• A popular tool for writing LaTeX is Overleaf . Its chief advantage is for collaborative work. For us CS people, who are users of GitHub, Overleaf may not be advantageous.
• Another popular LaTeX tool is LyX. It is fully point-and-click, which some of you may find appealing, and the PDF window is updated as you type.

How can you learn how to do a certain LaTeX trick, e.g. having a column of equations with the = signs lined up?

• If you've seen it in my book, just go to the site containing the PDF of the book. All the .tex files that are sources for the book are right there. Just the Google 'site:' option to search for a particilar string, say "bus ridership," and then see the raw LaTeX that produced the effect you saw in the book.
• And of course, Google is a great place to look up LaTeX information.
Monday, January 11, 11:55 am

I corrected the time for the last ethics meeting (earlier blog post today). It is 11:45.

Monday, January 11, 10:10 am

I've mentioned that as CS students, you should be good at using Unix (i.e. Unix-family OSs, notably Mac or Linux). This is NOT required for our course, but it's something that you should do simply as a tech expert. Note again that Intel once complained that UCD CS grads don't know Unix well.

The only way to get good at Unix is to use it in your daily life. Just because you, say, did well on Unix exam questions in ECS 36B doesn't mean you know Unix, not at all. The only way to know Unix on a practical level is to USE it, learning along the way as issues arise to be solved. If you have a Mac, fine (but use the command line a lot). Otherwise, run Linux.

And that means using REAL Linux. Any emulator, virtual machine etc. will fall short in one way or another. That includes the Windows Subsystem for Linux.

A student tried to run OMSI on WSL, and got an error message, "no \$DISPLAY environment variable." That was apparently due to this problem with WSL, a great example of why WSL is not the "real" Linux, even though Linux has been installed.

But the incident shows more than just the failings of WSL. The important thing is that, as a CS student, you should know what this error message means. In fact, it was discussed briefly in my blog post of January 4, 7:15 pm, so you can see it is a common error, thus something any CS student should know about. This is an example of what I meant above in my "learning along the way" remark; this kind of daily life stuff will NOT be on an ECS 36B exam.

Using Unix on a daily basis will improve your productivity. Same for a using a debugging tool. If you learned, say, gdb in ECS 36B but are still using print statements to debug your code, you are doing yourself a disfavor. The purpose of including a debugging tool in the ECS 36B topic list is to prepare you to do effective debugging in every course from then on, NOT just to have one more topic for your final exam.

If you have a Windows machine, I recommend that you set it up to dual-boot Windows and Linux.

Monday, January 11, 10:00 am

The last ethics meeting will occur at the end of class this Wednesday, at 11:45 am. If you are in the list in the blog post below (1/10, 11:30 am), you must participate at that time. A Zoom invitation will be e-mailed to you later today.

Sunday, January 10, 11:30 am

Here is a list of students, by last 4 digits of student ID, who we believe have not yet participated in the ethics meeting:

```7264
6580
7488
8351
3884
8815
1526
4619
7484
7793
9171
8729
1502
0394
5729
7446
```

If you did participate, please let me know as soon as possible.

Friday, January 8, 2:20 pm

I fixed a typo in the homework: d> should be just d.

On p.12 in the book, there is reference to node A and node B. This is confusing, as readers may think this is related to events A and B in, e.g., Equation (2.6). So, instead, say that we have two terminals, at which John and Mary are typing. Call the nodes Node John and Node Mary.

So, between (2.15) and (2.16), "A" means Node John and "B" means Node Mary.

Thursday, January 7, 10:55 pm

The first two problems for Hwk 1 are now on our class Web site. There may be some small changes made in the next day or so, but basically the problems are ready and you should get started now.

Thursday, January 7, 9:30 pm

Important news items:

• Arnav will be forming homework groups early next week. If you would prefer to work with someone, please let him know, aacharyya@ucdavis.edu by TUESDAY, JANUARY 12. Otherwise, he will assign you to a group.
• I hope to have the first two homework problems on the Web sometime today. As always, it will be announced here on the blog. Remember, I will be posting the homework problems a few at a time. We will have two assignments in the quarter, with the first due at the end of Week 3, I believe.
• The ethics meeting for Section A01 went well this morning, I think. I look forward to meeting the Section A02 students tomorrow. Please have your microphone and camera ON, so we can interact. (You will need to have them on in other contexts in the course as well, notably the interactive homework grading and the oral quiz.) Also, please do not log on with a pseudonym.
Wednesday, January 6, 9:30 pm

Several points:

• Again, please make sure to arrive to the Zoom session ON TIME in your ethics meeting. Breakout rooms will be formed for whoever is present at the time. If you miss your assigned meeting, don't worry; you'll have a chance to schedule one.
• At some points while you're waiting in your breakout room, a TA will come by to answer any questions you have on the course, the lectures, R, the textbook, etc.
• After your meeting with me, you are done with the meeting and may leave.
• Keep your camera and microphone ON. Remember, you and I will be interacting.
• You will need your camera and microphone ON during the Oral Quiz (Week 5 for Sec. A01, Week 6 for Sec. A02). BTW, it will count as two quizzes (with the same grade). If your grade is below B-, you may take the quiz again; the grade you get there will replace the old grade if it is higher, otherwise discarded.
Wednesday, January 6, 3:25 pm

Ethics meetings: Those who added the course late, or who miss their assigned meeting, will be handled separately.

Wednesday, January 6, 12:15 pm

Reminder: We have our "ethics meetings" this week, during your assigned discussion sections.

You were e-mailed Zoom invitations. (In class today I mistakenly said it was via Canvas, which is not true. For this particular meeting, it is on my personal Zoom room.)

It is crucial that you JOIN THE ZOOM SESSION ON TIME. I will create breakout sessions and meet with you one group at a time, and the way I have it set up, Zoom will form breakout room groups AMONG THOSE PRESENT AT THE TIME. (Breakout rooms can be pre-assigned, but I didn't do it this way.)

After your group's meeting is done, you are free to leave.

Tuesday, January 5, 9:55 pm

Office hours for the TAs and me have now been posted, as recurrent meetings on Zoom via Canvas.

• NM M,W 4:30-5:30 pm
• AA Tu 10:30 am-12 pm, Tu 6-7:30 pm
• SP M 9-10:00 am, W 1 pm to 2 pm

Tuesday, January 5, 1:55 pm

If you were enrolled in the course as of early afternoon today, you have been e-mailed an invitation to the ethics meeting for your discussion section THIS WEEK. Please read the instructions immediately.

As has been mentioned, this meeting is REQUIRED. You will not be able to take any quizzes (70% of the course grade) if you have not attended. Since this is your regular discussion section, you should not have a time conflict, but if you do, please contact me immediately.

Those on the class Waiting List will be handled separately, if/when you are admitted to the course.

Monday, January 4, 8:45 pm

Sorry for all the blog posts today. We of course will have more now at the start of the quarter, but once things settle down there will usually between 0 and 2 per day.

The purpose of the current post is to announce that the course syllabus is ready

Yes, it is absurdly lengthy, but it is your user manual for the course. It gives you full information on homework, quizzes, the term project, group work and grading.

Note these points in particular:

• Homework grading is interactive. You attend the grading session with your group, but you are graded individually. You might, say, get an A grade while one of your teammates gets a D. The TA will ask you questions like, "What if the problem statement had instead been such and such?", and also ask you questions on the general course material so far.
• Course grades are flexible. There is a formula based on your quiz and homework grades, but that is just a lower bound; your grade can actually be higher than that. See the worked-out example.
• Note in particular the importance of the term project. In my view, the term project is the course. I've mentioned several times that my goal is that at the end of the quarter, you feel you've learned something that will stay with you after graduation and beyond; I hope the term project makes a big contrbution to that goal.

The importance of following directions correctly cannot be overemphasized. A sad example occurred one time concerning the term project, which is due at 11:59 pm the day of the scheduled final exam. (We don't have a final.) At 12:03 a.m. I received a message from a frustrated, very panicky student saying that he didn't know how to submit the project to CSIF. His teammate had been the one to submit the homework to CSIF, but he was already on a plane home. Of course, I explained what to do and didn't impose a penalty, but this student had gone through a lot of avoidable anguish.

Anyway, that's the last of the numerous messages this evening. See you Wednesday!

Monday, January 4, 7:40 pm

More on OMSI:

As you know, our first quiz will be held in Week 2. It will be a "warmup" quiz. EVERYONE should get an A+.

And MOST everyone will. Here is the distribution from my teaching the course last year:

```> z <- read.table('Quiz0Grades')
> table(z\$V7)

A  A+   B   C   D  D+   F
1 106  20   1   9   5   1
```

As you can see, more than 2/3 of the class did get an A+, but about 10% got D or F grades. Those in that latter group simply didn't prepare. Some did recover and eventually get A or B grades in the course, but it certainly is a bad way to start the quarter. :-)

Remember, OMSI helps YOU get a better grade, because you can test your code and revise it if it doesn't work right. One time (pre-pandemic days), a student forgot his laptop and had to take the quiz on paper. He was very upset with himself, saying "That puts me at a disadvantage."

I've been using OMSI for 5 years now, and it works well. It's not fancy, e.g. no code syntax highlighting, but it does its job. You may wish to browse through the source code; it's complex but hopefully well organized. Good example of network and threaded programming.

Suggestions for new features etc. are always welcome, but unless they are quick to implement, they may just be filed away.

OMSI is simple to use, but you do need to read through the entire documentation. Please be patient.

Monday, January 4, 7:15 pm

During quizzes, please run OMSI on your own laptop, not CSIF (stated here, which is linked to from the OMSI docs). I have several reasons for this, but now I'd like to use this as a "Unix lesson."

A student tried running the OMSI on CSIF, and get an error message, "no \$DISPLAY environment variable." Here's why:

When you use ssh to connect to CSIF remotely, you can only run text applications, not GUI. That error message is saying the CSIF machine has nowhere to display the OMSI window.

My point in bringing this up is to show an example of what "knowing Unix" means. I mentioned today in class that Intel recruiters once complained that UCD grads don't know Unix well. As you can see here, it's a lot more than just knowing the ls and cd commands. And the only way to gain this knowledge is to use Unix (Mac or Linux) in your daily life.

BTW, one can run GUIs with ssh if one uses the -Y command line option.

Monday, January 4, 2:50 pm

Re Discord:

• I encourage students to help each other on homework. Teamwork is important, and camaraderie is especially vital in these gloomy days of pandemic. So, if students want to form a Discord page, I think it's great.
• However, I myself don't set up Piazza sites and the like, for a reason: Many students treat these sites as first resorts, not last resorts. They are just using the sites as shortcuts, a way to minimize the time they spend in the course. Here is an example I saw once (not in my class):

Student: Anyone know how to do Problem 1 in the homework?
Student, 5 minutes later: Oh, never mind, I see it. But what about Problem 2?
Student, 5 minutes later: Oh, I see it. But what about Problem 3?

:-)

• Also, I know of at least one case where students used Piazza as a way to say abusive things about an instructor, to her face. She could have turned these students into SJA; she didn't, but I hope we all agree that this is unacceptable.
• Finally, I goes without saying that use of Discord etc. is absolutely forbidden during quizzes. Any communication with others during those times is illegal, and will be prosecuted. Any student found cheating will receive a grade of F in the course (grade in the COURSE, not just on that quiz or homework assignment).
Monday, January 4, 2:00 pm

Problems 1 and 2, especially Problem 1, in most quizzes will be very easy. I do this because I want to make sure every student who has been keeping up with the class gets some points. Thus, don't try to overinterpret a problem that you might feel is "too easy."

Monday, January 4, 2:00 pm

In sending e-mail to me or the TAs, please put '[ECS 132]' in the Subject line.

Monday, January 4, 12:10 pm

Sorry I didn't see the Chat messages. They weren't visible to me once I did screen sharing. I'll see about fixing this. Meanwhile, let's see if I can address them here.

The URL for the textbook was in one of the pre-quarter e-mail messages I sent. Those messages are archived here. If you haven't read those messages yet, read them NOW; they are crucial to your success in the course.

Re CSIF: You will need to use CSIF only for submitting the homework and term project. Make sure everyone in your group knows how to do this, to avoid disaster, e.g. unsubmitted term project and failed course grade.

Note: As mentioned over the break, as CS experts, you all should know Unix (Linux or Mac) well; Windows is for non-techies. Knowing ssh is part of that.

Nicholas asked whether the main computer in the example would hold a queue of messages in a buffer. Not in our very simple example here. And even a buffer can fill, with other messages being discarded.

Monday, January 4, 10:40 am

My office hours will be MW 4:30-5:30 pm (starting in Week 2) and by apppointment. TA office hours will be announced soon.

Sunday, December 27, 11:20 pm

Starting January 4, all course announcements will be made here.