EBoard 06 (Section 2): Conditionals

Approximate overview

  • Administrative stuff [20+ min]
  • Questions [?? min]
  • Lab [Approximately 60 min]

Administrivia

Introductory notes

  • I forgot my hearing aids today. You may have to speak a bit louder. (Or those in the front may have to repeat.)
  • Starting today, I’ll use the “randomized calling cards” to call on you. This is an opportunity for you to practice “thinking on your feet”, as it were. Please try, but also feel free to say, “I’m not sure.”
  • Please say your name when you ask or answer a question (even if I’ve just called you by name).
  • Don’t forget that we have evening tutors available 7–10 p.m.
  • Mentor sessions are now scheduled: Sunday 4–5 p.m., Monday 8–9 p.m., and Wednesday 8–9 p.m. All in the CS Commons.
    • This week’s topics: Review quizzes 1 & 2; prep for Quiz 3.
  • I’ve set up a semi-anonymous “check in” survey. Please take the time to fill it out. https://bit.ly/csc-151-2022Sp-week02
  • We do not have class Monday. It’s a “work differently” day. (I’ll be working remotely.)
  • A reminder: Please keep your mask on when working in 3813 or 3815 or any classroom.
  • I realize that not everyone can make my office hours.
    • Feel free to ask questions on Teams (or via email) at almost any time.
    • You can also propose times via the Microsoft Scheduling Assistant. (Sam will demo.)
  • While we remain at Code Blue, all office hours are via video chat on Teams.
    • Protocol: Sam texts “Are you ready?” You say “Yes”. Sam opens a video chat.
    • Alternate Protocol: You text “Are you ready?” I say “Yes”. One of us opens a video chat.

Asking questions on Teams

  • When submitting questions on Teams, please try to use the Q&A channel, rather than direct chat, unless you are asking questions about your code.
    • There are more people who might reply.
    • There are others who would benefit from your question.
  • If possible, title your question.
    • Sam will demo.
  • Sam often goes AFK after 8pm, sometimes earlier.
    • If Sam is not AFK, he will answer.
    • If Sam has insomnia, he might answer at strange times.
    • AFK = “Away from Keyboard”

Racket notes / Debrief from last lab

Experimentation

  • The remainder exercise was intended to suggest that one way we learn about procedures is to play/experiment with them. (We’d hope that the documentation is clear, but it isn’t always.)
  • The “four types of rounding” exercise was to encourage you to play/experiment. floor, ceiling, truncate, round.

Types of numbers

  • Complex: May have an imaginary part; may have a fractional part
  • Real: No imaginary part, may have a fractional part
  • Rational: No imaginary part, may have a fractional part
  • Integer: No imaginary part, no fractional part

Notes

  • All of these can be exact or inexact.
  • Reals and rationals are indistinguishable.
  • We tend to assume rationals are exact.

Rounding

What are the values of the following?

  • (round 7/2)
  • (round 9/2)
  • (round -7/2)
  • (round -9/2)
> (complex? 2)
#t
> (round 7/2)
4
> (round 3.6)
4.0
> (round 3.4)
3.0
> (round 9/2)
4
> (round 11/2)
6
> (round 13/2)
6
> (round 15/2)
8
> (round 17/2)
8

Pattern?

  • When equidistant from two numbers, round rounds to the even.

Why?

  • Mathematicians recommend it for some unknown reason that is only revealed to those who take the appropriate vows.
  • Statisticians prefer this kind of rounding.
  • We need some policy for when the number we are rounding is equidistant from two integers. The natural ones are “round up”, “round down”, and “round towards even, which is what statisticians recommend”.
  • Why do statisticians prefer this? It helps deal with 1/2s in data, particularly if you end up rounding toward integers before averaging. Let’s consider average shoe sizes. 10 10.5 10.5 11 11.5 11.5 12
    • If we averaged the fractional numbers, we get 11
    • If we round in the statistical way and average, we also get 11 (contrived example)
    • If we round everything down and aveage, we’ll get lower than the real average.
    • If we round everything up and average, we’ll get higher than the real average.
    • In practice, rounding “average out”, so our computations end up being more accurate.

Converting between exact and inexact

  • (inexact->exact (exact->inexact (expt 10 50)))
  • Once you lose data, you can’t get it back.

Upcoming work

  • Quiz 2 due tonight at 10:30 p.m.
  • Readings for Wednesday due Tuesday at 10:00 p.m.
    • DDag question: Two important points from the readings.
  • Lab writeup from today due Tuesday at 10:30 p.m.
    • Ideally, you’ll finish that in class today.
    • If not, set up a time to meet with your partners.
    • If that’s not possible, finish (and submit) separately, but cite your partner.
  • Mini-Project 2 due Thursday at 10:30 p.m.
    • On Gradescope
    • Not yet posted to Gradescope
    • We’ll go over it

Upcoming Token-Generating Activities

  • Men’s Tennis 9am and 5pm Saturday in the Field House. (30 min of watching is enough)
  • Swim meet Saturday at 1pm. (30 min of watching is enough)
  • Men’s Basketball Saturday at 1 p.m.

Other Upcoming Activities

  • Women’s Basketball Saturday at 3 p.m.

Friday PSA

  • People care about you. Please take care of yourselves.
  • Embrace moderation
  • Don’t feel peer pressure; decide what is right for you
  • You won’t be alone in your choices
  • Consent is essential

Reading Questions

I’ve started putting answers to the reading questions in the readings. These are ones that didn’t naturally fit in a reading

Last night, I did not have time to review reading questions. You can ask them, or other questions, now.

Other Questions

Are the LAs on SoLAs timed?

Yes. You should be able to do them in 10–15 minutes. You get 60.

What happens if you did not get credit for the Decomposition quiz? (Alternately, what happens if you do not get credit for the Procedural Abstraction quiz?)

Don’t worry!

There will be a decomposition problem on SoLA 1. If you get it right, you’ll now have achieved that learning objective. (Similar answer for any topic.)

I’d recommend that you go to one of the mentor sessions before SoLA 1 so that you are better prepared for the problem.

What happens if you got the Decomposition quiz wrong and you also get it wrong on SoLA 1?

There will be a decomposition problem on SoLA 2. If you get it right, you’ll now have achieved that learning objective.

But you should probably chat with me or a mentor or an evening tutor before you take SoLA 2, so that we can be sure you understand the core concepts. We can also assign you an individual tutor if that will help (and you’re making use of other resources).

What happens if you got the Decomposition quiz wrong and you also get it wrong on SoLA 1 and SoLA 2?

There will be a decomposition problem on SoLA 3. If you get it right, you’ll now have achieved that learning objective.

Once again, you should get help before taking it again.

You’ll also have a chance on SolAs 4 and 5. We hope that’s not necessary.

Lab

Preparation

  • Sam needs to work on the autograder. Grab him if you need help.

During Lab

  • (if #t C A) –> C
  • (if #f C A) –> A
  • (if 5 C A) –> C ; because 5 is truish

Wrapup

  • I guess we have work for work differently day.