homework for intro comp sci home page
submit homework

hw27:  build another procedure
due at the beginning of your class on Thursday, 2021-10-28

expected to take 0.3 – 0.4 hours. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 4 min.) Compare your answers on hw ("build a procedure") with answers that will be contributed in Piazza@207–205 on Piazza by 8p.m.


Concepts to use:


1.  Build and display a procedure (estimated time: 8 min.)  …which accepts two parameters and calculates their average, like the averaging function in hw25#3b. As in hw26#3, your output should show that a procedure has been built, rather than showing results from invoking that procedure.


2.  Invoke (estimated time: 5 min.)  …two copies of your averaging procedure, and display the results, as in hw26#4. Pass different pairs of values as arguments. For the second invocation, compute the average of \( \sqrt{2} \) and \( \sin( \pi/4) \). Write code to make Racket compute those numbers, rather than using a separate calculator or your knowledge of trigonometry.

Racket has a built-in procedure named sin that computes sines. It expects an argument that is an angle measure, in radians.


3.  Submit the file for this assignment to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 1 min.)


hw26:  build a procedure
due at the beginning of your class on Wednesday, 2021-10-27

expected to take 0.5 hours. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 3 min.) Compare your answers on hw25 ("steal from math") with answers that will be contributed in Piazza@200 on Piazza by 8p.m.


1.  Learn from your grade on 1test. (estimated time: 5 min.) 

  1. Compare the points deducted on your 1test to the grade shown on IO Classroom.

  2. Reflect on the efficacy of your preparation for 1test:

  3. If and only if your score on 1test was less than 75, construct an email with the subject
         learning from 1test
    showing your three reflections. Send it to me at the correct email address, with a copy to the parents/ caregivers shown in Talos.


Concepts to use: (estimated time to read: 3 min.)


2.  Download and stare at (estimated time: 4 min.)  …this annotated version of the program from class. Match each pair of parentheses with its purpose. Time spent here will be repaid in the next steps.


3.  Build and display (estimated time: 6 min.)  …a procedure that will compute the area of a circle, given its radius. Save your .rkt file before running it.

This task asks you to "build and display" the procedure, NOT invoke it. Understand the distinction. Your output for this task should look like
     #<procedure:... other info >
telling the reader that you have built a procedure.

Approximate π. As we have discussed, irrational numbers are approximated anyway. A value like 3.1 is fine. Even if you have made the life error of memorizing too many digits of π (as we geeks are prone to doing), be aware of the comp sci learning: Racket will use only the first 15 digits.


4.  Invoke (estimated time: 5 min.)  …a copy of your procedure to calculate the area of a circle with a radius of 10, and display the results.

Leave your code from the previous task intact, so that your output show the contrast between displaying…

The code you write will be complicated enough that it is difficult to program without error, and difficult to read afterward. So program it well:


5.  Invoke 2 copies (estimated time: 5 min.)  …of your procedure, and display the results. That is, paste two copies of the invocation code and modify the copies to compute results for 2 additional radii.


6.  Submit the file for this assignment to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 1 min.)


hw25:  steal from math
due at the beginning of your class on Tuesday, 2021-10-26

expected to take 0.5 – 0.7 hours, including 5–10 minutes in class. Record the time at which you re-start this assignment.


0.  review previous hw Compare your answers on hw24 ("arithmetic approximations") with answers that will be contributed in Piazza@193–191 on Piazza by 8p.m.


Concepts to use: (estimated time to read: 3 min.)


1.  Recall (estimated time: 4 min.)  …the terms from Monday's class in the corresponding class notes, including the following vocabulary terms as they relate to functions:


2.  Prepare to hand-write (estimated time: 2 min.)  your results for this assignment onto a separate piece of paper in accordance with the standard instructions.


3.  Define (estimated time: 2 min.)  …functions, using math notation, to compute…

  1. the area of a circle, given its radius

  2. the average of two numbers

  3. the area of a trapezoid, given the lengths of its two bases and the altitude between them


4.  Write two invocations (estimated time: 5 min.)  …of each function. Make half the arguments expressions with operators, like \( 5 \times 2 \) or \( \sqrt{9} \), rather than simple constants, like 10 or 3. Evaluate each invocation.


5.  Write instructions (estimated time: 12 min.)  …in English for invoking a function. You performed six example invocations in the previous task, so use that experience as the basis for your instructions. Your single list of instructions must work for all of your examples. Expect writing the instructions to require 3–5 sentences and serious thought.

The only purpose to learning vocabulary is to facilitate communication. So use the terms related to functions.

Think of the target audience for your instructions as a middle-school student whose knowledge of functions is limited to the terms related to functions. The kid is willing to read your directions carefully and repeatedly. Imagine that they will be given a function definition and the right number of arguments for invoking the function. Following your instructions should result in their evaluating the function.

Do not write a separate list of instructions for each evaluation. Rather, write a single list of instructions that generalizes your actions. Those instructions must work for any of the invocations.

To appreciate the need for generalization, notice that you used multiplication to calculate the area of circles, but used addition to calculate averages. So your generalized instructions cannot specify either. Instead, you will probably write language language directing the fifth-grader to perform the "specified operations" for the function at hand.

Drafting your answer in a word processor helps. It takes me several drafts to write clear instructions. Using a word processor facilitates revision.


5.  Submit an image of your work to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 1 min.)


hw24:  arithmetic approximations
due at the beginning of your class on Monday, 2021-10-25

expected to take 0.4 – 0.5 hours for the required parts. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 3 min.) Compare your answers on hw23 ("check alleged solutions") with answers that will be contributed in Piazza@189–187 by 8p.m.


Concepts to use: (estimated time to read: 1 min.)


1.  Let WolframAlpha show you (estimated time: 3 min.)  …both the exact and the approximate solutions to the quadratic equation we worked on:
     -0.618x2 + 1.618x + 1.732 = 0
The exact solutions need the square-root signs, since there is no way to display the exact value of the irrational result using decimal fractions alone.


2.  Start a word-processed document (estimated time: 2–5 min.)  …in accordance with the standard instructions.

Have you considered creating a template that you could use for this and future homework assignments in this course?


3.  division (estimated time: 6 min.)  Why do divisions on a computer often result in quotients that are approximately right, not exactly right? Answer in 1–3 sentences, totaling less than 60 words.


4.  truncation vs. rounding (estimated time: 6 min.)  Once you have decided how many digits you are willing to spend on representing a fraction in decimal form, what is the difference between truncating the decimal representation versus rounding it off? Answer in 1–3 sentences, totaling less than 60 words. Create an example that illustrates the difference.


5.  \(\sqrt{2}\) never quits. (optional extra education; estimated time: 9 min.) The great Vi Hart dishes the dirt on Pythagoras and proves that there is no fraction that is the square root of 2. That's right, she proves that something does not exist.


6.  radical thinking (estimated time: 6 min.)  Why does calculating a square root on a computer often result in a value that is approximately right, not exactly right, in addition to the problem discussed for division? Answer in 1–3 sentences, totaling less than 60 words.


7.  Submit a pdf of your document to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 1 min.)


hw23:  check alleged solutions
due at the beginning of your class on Friday, 2021-10-22

expected to take 0.4 – 0.6 hours, including about 0.2 hours in class. Record the time at which you re-start this assignment.


Concepts to use: (estimated time to read: 3 min.)


1.  Check the alleged solutions of the first equation (estimated time: 12 min.)  …using the following steps:

  1. Copy the portion of the code in Piazza@177. that calculates and displays one solution to the first equation. You're going to try running that, right? You're not going trust code someone else hands you, right? Good.

  2. Keep the calculation of the solution in your code, But instead of displaying the result of that calculation, bind that result to a symbol. Your program should NOT contain a numeric literal for the solution to the equation.

  3. Further modify the code to display the value of the symbol, so that the output looks unchanged.

  4. Write a Racket expression to display the value of the quadratic expression on the left-hand side of the equation, evaluated for the alleged solution. For perspicuity, display some text before the value, to tell the person running the program the meaning of number they are looking at.

    One top-level student in this course reported requiring 10 minutes of hard thinking to understand those previous two sentences. How many times have you read them so far?


2.  Check the other alleged solution to the first equation (estimated time: 3 min.)  …using similar steps.


3.  Check both alleged solutions of the second equation (estimated time: 7 min.)  …using similar steps, but adapted for the second equation.


4.  Submit the file for this assignment to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 1 min.)


hw22:  realistic use of symbols
due at the beginning of your class on Thursday, 2021-10-21

expected to take 0.4 – 0.5 hours. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 7 min.) Compare your answers on hw21 ("process symbols more") with answers that will be contributed in Piazza@167–165 by 8p.m.


Concepts to use:


1.  NTTSTT, version 0 (estimated time: 9 min.) 

  1. Download this solution-finding program.

  2. Check whether it runs correctly.
    Do this check as the first step in incremental development whenever you inherit code from anyone, for the rest of your programming career. Otherwise, when you subsequently see an error, you won't know whether to look for the error in the code you inherited or the code you developed. That error-locating hint is the single biggest advantage of incremental development. Don't forgo it.

  3. Add a standard header to the top of your file.

  4. Eliminate violations of the rule that one should Never Type The Same Thing Twice. That is, deploy symbols, so that each coefficient is typed only once.

    Do this incrementally. That is, start by replacing only one coefficient with a symbol. The answers should remain unchanged. When one replacement works, proceed to the next.


2.  solutions to another equation (estimated time: 6 min.)  …to appreciate the value of this work.

  1. Leaving previous code untouched, add code below that work, to bind new values to ab, and c. For the new values, use the coefficients of
          2.71828x2 + 7.64x + 1.616 = 0

  2. Copy the solution-displaying Racket commands that you wrote for the previous tasks to the bottom of your file, below the define lines that you just wrote for this task.

  3. Do not modify the insides of the commands. Since you used symbols, there should be no numbers in those commands that need modifying anyway! That's the benefit of the work you did to use symbols.


3.  Is that right? (estimated time: 4 min.)  As someone once said, "A correct-looking solution that has not been tested is almost certainly wrong". Check your answers for the second equation. WolframAlpha gives great help for real math. You can learn lots at low cost. It is not just another site for losers who want to cheat on their math homework.


4.  Never type the same thing twice! Never type the same thing twice! (estimated time: 3 min.)  Did you calculate the discriminant's square root twice? If so, eliminate the duplication by introducing a new symbol, called discriminant_sqrt.

This revision illustrates the way good programs are written in the real world: write the program; throw it out; re-write the program; throw it out; re-wr… until your boss grabs the program from you and ships it to the client. No joke.


5.  Submit the file for this assignment to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 1 min.)


hw21:  process symbols more
due at the beginning of your class on Wednesday, 2021-10-20

expected to take 0.3 – 0.5 hours. Record the time at which you start this assignment.


Concepts to use: (estimated time to read: 1 min.)


0.  Start a word-processed document (estimated time: 1 min.)  in accordance with the standard instructions, plus one of the following formatting aids:


1.  start where the previous assignment ended (estimated time: 4 min.) This assignment relies on your understanding the contents of DrRacket's symbol table and output window assuming the code in the previous assignment had just run. Understand those contents in Piazza@147.

If you start with the wrong contents, you may waste any time you spend on the rest of this assignment. So this task spends your 4 minutes in a good cause.


tasks 2 – 3 are omitted, so that the next task continues the numbering from the previous assignment. For the next tasks, follow the same instructions, applying Racket's steps for processing symbols, showing results in the same three sub-sections (A,B,C) as in the previous assignment, but with new task numbers.


4.  nickel computed from penny (estimated time: 6 min.) 

(define penny 27)       ; line 00
(display penny)         ; line 01
(display "\n")          ; line 02

(define penny 1)        ; line 04
(display penny)         ; line 05
(display "\n")          ; line 06

(define nickel          ; line 08
  (* penny 5)           ; line 09
  )                     ; line 10
(display nickel)        ; line 11
(display "\n")          ; line 12

The silver-colored code is copied from the previous assignment's task 3. So start this task's sub-section B (resulting symbol table) and C (output) with copies of the answers from Piazza@147!


5.  Define penny using penny? (estimated time: 5 min.)  Should this work? Can you define a symbol using that symbol? What do you think?
Bad questions. Racket doesn't care what you think.
Better question: What to the steps do?

(define penny 27)       ; line 00
(display penny)         ; line 01
(display "\n")          ; line 02

(define penny 1)        ; line 04
(display penny)         ; line 05
(display "\n")          ; line 06

(define nickel          ; line 08
  (* penny 5)           ; line 09
  )                     ; line 10
(display nickel)        ; line 11
(display "\n")          ; line 12

(define penny           ; line 14
  (+ penny 7)           ; line 15
  )                     ; line 16
(display penny)         ; line 17


6.  effect on nickel (estimated time: 3 min.)  This last task is subtle and crucial. Banish intuition and creativity. Apply the steps. Sweat the details.

(define penny 27)       ; line 00
(display penny)         ; line 01
(display "\n")          ; line 02

(define penny 1)        ; line 04
(display penny)         ; line 05
(display "\n")          ; line 06

(define nickel          ; line 08
  (* penny 5)           ; line 09
  )                     ; line 10
(display nickel)        ; line 11
(display "\n")          ; line 12

(define penny           ; line 14
  (+ penny 7)           ; line 15
  )                     ; line 16
(display penny)         ; line 17

(display "  nickel: ")  ; line 19
(display nickel)        ; line 20


7.  Submit a pdf of your document to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 2 min.)


hw20:  process symbols
due at the beginning of your class on Tuesday, 2021-10-19

expected to take 0.4 – 0.5 hours. Record the time at which you start this assignment.


Concepts to use:


0.  Start a word-processed document (estimated time: 1 min.)  in accordance with the standard instructions, plus one of the following formatting aids:


1.  Read these instructions (estimated time: 8 min.)  …that aim to echo the steps we took in class.

First, read Racket's steps for processing symbols in the class notes. These rules are polished versions of the rules you wrote in the previous homework and which we revised in class.

Look at the "sample answer" below while reading the rest of these instructions. The sample answer shows the results of applying the rules to three lines of Racket code, which are labeled line 00 – line 02 in comments.

Arrange to look at the sample answer while you are reading these instructions. If your screen is large enough, open a second browser window that displays the sample answer. Or print the sample answer. Otherwise, you can page forward and backward in this browser window.

For each of the number tasks below (2 and 3), your document will have three sub-sections:

  1. symbol-processing steps
  2. resulting symbol table
  3. output

Here are the details on the contents of each section:

  1. symbol-processing steps
    State the steps DrRacket follows to process the symbols, by quoting from Racket's steps for processing symbols. Take a look at sub-section A of the sample answer.

    Retain the wording of Racket's steps for processing symbols whenever possible. You should augment that wording by…

    But eschew unnecessary re-wording.

    A student kindly contributed a solid example:

    language from Racket's steps for processing symbols:
    If a slot named for symbol is found, re-use that slot in the next steps.

    helpful re-wording:
    Since a slot named for penny is found, re-use that slot in the next steps.

    unnecessary re-wording:
    Since there is an entry in the symbol table with penny stored as the symbol, prepare that slot for use in the following steps.

  2. resulting symbol table
    Each define affects the symbol table, building on the effects from previous steps. So sub-section B in the sample answer shows the symbol table after Racket processes the three lines of code line 00 – line 02.

  3. output
    List output that results from the display functions.

    The code snippets include
         (display "\n")
    to separate the pieces of output. Here's the classy way to show that you know the effect of these: paste a copy of a hooked arrow like this one
        
    into your word-processing document at the end of each line that DrR would produce, as shown in sub-section C of the sample answer, below.

sample answer: understand the classes' answers for 3 lines of code


2.  define the symbol penny (estimated time: 6 min.)  In class we started applying Racket's steps for processing symbols to the following code snippet:

(define penny 27)       ; line 00
(display penny)         ; line 01
(display "\n")          ; line 02

Make sense of the following answer as you copy it into your document. The A, B, and C sections correspond to the instructions above.

2. define the symbol penny

A. Symbol-processing steps

for (define penny 27)       ; line 00

Look for penny in the symbol table.

Since no slot named for penny exists, reserve a new slot named for penny, and use the new slot in the next steps.

Evaluate the expression 27, resulting in the value twenty-seven

Store twenty-seven in the symbol table slot for penny.

for (display penny)         ; line 01

Look for penny in the symbol table.

Since a slot named for penny is found, replace penny with its value, 27, resulting in…
     (display 27)
Put dots of light in the interactions window that that look like 27

for (display "\n")          ; line 02

Add a newline at the end of the output.

B. resulting symbol table
symbol value
penny 27

C. output

27

your turn

3.  re-define a symbol (estimated time: 6 min.)  Populate the three subsections (A,B,C) for the following code:

(define penny 27)       ; line 00
(display penny)         ; line 01
(display "\n")          ; line 02

(define penny 1)        ; line 04
(display penny)         ; line 05
(display "\n")          ; line 06

The silver-colored code is copied from the previous task. So copy the answers for the silver code from the previous task!

In constructing your answer, it helps to have three windows open simultaneously:


4.  Submit a pdf of your document the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 2 min.)


hw19:  steps in symbol processing
due at the beginning of your class on Monday, 2021-10-18

expected to take 0.4 – 0.5 hours. Record the time at which you start this assignment.


Concepts to use:


0.  Recall (estimated time: 3 min.)  … the central ideas of symbols from your notes from Thursday 2021-10-14 and the snap of board work below.

 symbol table

— photo credit to Eugene of pd7
with thanks


1.  Imagine (estimated time: 1 min.)  …the backstory: Irwin Zahn, the generous Stuy alum behind the Innovation Lab, offers to spring for lunch for the whole class. We want to Racket to calculate an estimate of the cost, based on the number of people in class today and the cost of a sandwich.


2.  Understand a demo program. (estimated time: 7 min.)  Download this skeleton of a program, run it, and finish it, all with the aim of understanding what Racket does to…

Questions? Piazza!


3.  Start a word-processed document (estimated time: 1 min.)  …in accordance with the standard instructions.


4.  steps for binding (estimated time: 7 min.)  List 3–5 steps that you can imagine Racket would need to follow when it binds a value to a symbol. A perfect answer is beyond the scope of the course, so don't copy junk off the internet. Instead, build your understanding by making intelligent guesses from the operation of the program.

Start your answer with…
     When Racket processes a define

Here and in the future, write steps in a numbered or lettered list. A list is easier to read and edit than a paragraph.

For items in a numbered list, programmers start numbering at zero. Welcome to the club! Any decent word processor —and Google Docs, too— will allow you to specify a list's starting value.

To visualize "the steps Racket follows" it may help to think about writing instructions that could be followed by an eight-year-old who reads instructions extremely carefully, interprets them extremely literally, but has no common sense and is too uncooperative to exercise it if they had any. Think Amelia Bedelia on steroids, but without the good intentions.


5.  steps for retrieving (estimated time: 7 min.)  List the 1–2 steps that you can imagine Racket would need to follow when it processes a symbol in an expression.

"In an expression" means that the program is requesting that Racket retrieve a value that was bound to a symbol in a previous define step. Every appearance of a symbol is such a request, except the appearance of a symbol as the first argument in a define, which you covered in the previous task.

Start your answer with…
     When Racket processes a symbol that appears in an expression…


6.  Submit a pdf of your document to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 1 min.)


hw18:  improve on 1test?
due at the beginning of your class on Thursday, 2021-10-14

expected to take 0.2+ hours. Record the time at which you start this assignment.


Concepts to use:


0.  Allocate time (estimated time: 1 min.)  Decide how much time you will spend before Thursday's class on preparing for 1test.


1.  Read the directions (estimated time: 7 min.)  …and sample problems on the practice test. Find it in Piazza's "Resources" section, via the link in the blue bar at the top of Piazza's page.


2.  Sample problems You need more sample problems than I have time to create. Crowdsourcing their creation would help lots of people. And creating problems exercises the thinking that allows the creator to predict and do others' problems. So help and expect to benefit:


3.  A reference sheet is optional. Collaboration may help. Recall the rules, including that late reference sheets will be unavailable for use during the test. "Late" means "absent from the pile collected from your file". So if someone in your file is slow to add theirs to the pile, only you can take responsibility for working around that, as discussed in class on Tuesday.


4.  Reflect (estimated time: 2 min.)  How much time did you actually spend? How do you feel about that? What steps will you take next for this test, if any?


There is nothing to submit for this assignment.


hw17:  verify hw16 & 0test score
due at the beginning of your class on Wednesday, 2021-10-13

expected to take 0.2 hours.


0.  review previous hw (estimated time: 7 min.) Compare your answers on hw16 ("display solutions nicely") with answers that will be contributed in Piazza@110–108 on Piazza by 8p.m.


1.  Verify your 0test score (estimated time: 5 min.)  …against the data in IO Classroom (f.k.a. "Skedula"). This test is scored out of 100, like all tests in this course. Adding 100 plus the values in green from the left margin of your answer sheet should produce the value shown in IO Classroom.

Remember to "Ignore values labeled 'MP1'…", as documented on the course home page.

The raw score that is visible now is expected to be curved eventually. We can hope that the prevalence of low scores on 0test can be partially ascribed to sophomores' inexperience in preparing for tests, and that Friday's 1test shows evidence of learning to prepare better.


There is nothing to submit for this assignment.


A practice test (optional extra education)  …has been published, with model instructions and questions. Find it in Piazza's "Resources" section, via the link in the blue bar at the top of Piazza's page.


hw16:  display solutions nicely
due at the beginning of your class on Tuesday, 2021-10-12

expected to take 0.5 – 0.7 hours, including the time spent in class. Record the time at which you start this assignment.


0.  display answers to hw14# nicely (estimated time: 10 min., started in class)  Paste the code from Piazza@90–89 into the definitions window. Then add invocations of display to result in the following output in the interactions window. Produce exactly 4 lines of output, one of them blank:

hw14#3a. length of other leg: result_a units

hw14#3b. quotient: result_b
That's all, folks!

Use Racket code to calculate the values to replace the red letters. That means that the value of the answers will NOT appear in your code. Instead, you code will generate the answers in the interactions window.


1.  review previous hw (estimated time: 3 min.) Compare your answers on hw15 ("examples of math terms") with answers that will be contributed in Piazza@100–94 on Piazza by 8p.m.


Concepts to use: (estimated time to read: 3 min.)


2.  one solution (estimated time: 6 min.)  Write a Racket expression to display one solution of the quadratic equation above.


3  Is that right? (estimated time: 2 min.)  Check your answer. Wolfram Alpha can help.


4.  Add text. (estimated time: 3 min.)  Augment your program with a call to display that produces
     One solution is approximately 
in front of the solution's value.


5.  the other solution (estimated time: 4 min.)  Add code to calculate and display the second solution. If you were about to re-type that whole, nasty expression, think of a better way.


6.  Finish the job. (estimated time: 3 min.)  Check the value of the second solution. Add the text
     The other solution is approximately 


7.  Submit the file for this assignment to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 1 min.)


hw15:  examples of math terms
due at the beginning of your class on Friday, 2021-10-08

expected to take 0.4 – 0.5 hours. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 3 min.) Compare your answers on hw14 ("expressions with comments") with answers that will be contributed in Piazza@91–88 by 8p.m.


Concepts to use:


1.  Prepare (estimated time: 2 min.) 

  1. …to hand-write your results for this assignment onto a separate piece of paper in accordance with the standard instructions

  2. …to re-read and employ the definitions from class by opening a browser window to Thursday's class notes.


2.  Hand-write two examples (estimated time: 21 min.)  …of each term in the following list of steps, which are taken from Thursday's class notes. Write math notation (not Racket), building towards finding and verifying solutions for quadratic equations. That is…

  1. For the plain expression, any two expressions are fine.

  2. Refine your choices, to write two quadratic expressions.

  3. Evaluate each quadratic expression using your favorite non-zero value. For a real-world quadratic expression, I would expect neither the value nor the coefficients to be integers, so a calculator will help.

    It is only in math classes that all the numbers come out to be small integers. Join the rest of us in the real world.

  4. Write a quadratic equation using each of your quadratic expressions, asserting equality between the expression and zero.

  5. Prove that 3.571428 does or does not solve the quadratic equation
          1.618034x2 - 8.09017x + 9.708204 = 0

    In the past, students have required hard thinking to figure out what would constitute proof. What do we mean when we say that a value solves an equation?

  6. Find both solutions for each of your quadratic equations, by evaluating the expression in the quadratic formula for your quadratic equations. (not by factoring).

    Show steps that would help another mathematician understand your work.

  7. Prove that the values you found do or do not solve the corresponding equation.


3.  Submit an image of your work to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 2 min.)


hw14:  expressions with comments
due at the beginning of your class on Thursday, 2021-10-07

expected to take 0.4 – 0.6 hours. Record the time at which you start this assignment.


Concepts to use:


0.  Racket → infix (estimated time: 5 min.) 

  1. Hand-write your results for this task onto a separate piece of paper in accordance with the standard instructions for hw on paper. Note the paper size; students in the past have missed that requirement.

  2. Express the following Racket code…

    (/ (* (abs -7)
          (sqrt (+ 12 4))
          )
       5 4 3 2 1
       )

    …in standard infix notation, using the arithmetic operators
       () + – × ÷   |absolute value|   √  
    Use the normal, seventh-grade rules of precedence and associativity to eliminate redundant parentheses. Make no algebraic simplifications. Do no arithmetic.


1.  download and review previous hw (estimated time: 7 min.) Recall the aim of reviewing homework. Compare your answers on hw13#1 ("expressions in files") with my answers, by…

  1. selecting this link to download my file; then…
  2. opening the downloaded file in DrRacket and…
  3. understanding the content.

If you have questions on the process or the content, look for existing contributions on Piazza, or start a new thread if necessary.


2.  new .rkt file, with header comments (estimated time: 6 min.)  In DrRacket, start a new file named hw14_commentedExpressions.rkt with the standard header for program files.

Are you raising your incremental development game? Good.
So what do you expect when you run the program written so far?
What does DrRacket produce?


3.  more infix → Racket (estimated time: 6 min.)  Add to your hw04_commentedExpressions.rkt file, in the definitions window, by doing the following two problems from a previous semester's test. Write perspicuously.

Make no algebraic simplifications. Do no arithmetic. Instead, program Racket to evaluate the entirety of each expression.

Precede each solution with a comment giving its task identifier, like
     task 3a
     task 3b

Write Racket code to evaluate…

  1. \( \sqrt{ | 12^2 - 13^2 | } \)

  2. \( \dfrac{ 11 \div 22}{ 5^{2.5} - 123} \)


4.  Submit your work (estimated time: 6 min.) …for this assignment to the homework server. There are two slots for this assignment; you are asked to submit a file to each of them:

Since having two slots increases the complexity of the submission a little, check your work, by visiting the "View homework" menu on the homework server. I aim to check also, but I charge Points for errors that you make me find.


optional education Donald Knuth, a giant in this field wrote…

The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly. A programmer is ideally an essayist who works with traditional aesthetic and literary forms as well as mathematical concepts, to communicate the way that an algorithm works and to convince a reader that the results will be correct.
— quoted all over the WWW


hw13:  expressions in files
due at the beginning of your class on Wednesday, 2021-10-06

expected to take 0.3 – 0.4 hours. Record the time at which you start this assignment.


Concepts to use:


0.  definitions window → file → definitions window (estimated time: 3 min.) 

  1. In DrRacket, in the upper pane — which is called the definitions window — paste the following classic, one-line program:
         (display "hello, world")
    Use the Racket → Run command to see what it does.

  2. Save your nascent definitions in a file called expressions.rkt

  3. Close DrRacket, re-open your expressions.rkt file and verify that it still runs.

There is no need to save the results that you see in the interactions window (that is, the lower pane) since you can always reproduce them by re-running the code that is in the definitions window.

Problems you can't solve? Seek help on Piazza or elsewhere.


1.  infix → Racket (estimated time: 15 min.)  Still working in the definitions window, add to your expressions.rkt file. Write code to compute and display each of the following expressions. Do none of the arithmetic in your head. Rather, tell Racket to do it all.

  1. \(\dfrac{4}{5.5-1.5}\)   Check your work, of course.

  2. \(5^2 - \frac{4}{5.5-1.5}\)

  3. \( 16 + 8 \times -\sqrt9 \)      

    Demonstrate your negation skillz.

  4. \( \dfrac{5^2 - \frac{4}{5.5-1.5}}{16 + 8 \times -\sqrt9} \)


2.  Submit your expressions.rkt file to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 2 min.)


hw12:  starting with DrRacket
due at the beginning of your class on Tuesday, 2021-10-05

expected to take 0.4 – 0.5 hours for the required parts. Record the time at which you start this assignment.


Concept to use:


0.  Download and install DrRacket (estimated time: 8 min.)  …from here.


1.  Start DrRacket (estimated time: 3 min.)  Then…

  1. Use the LanguageChoose language menu to select "other languages".
  2. Select the legacy language R5RS and select "OK".
  3. Select RacketRun.

This should leave the bottom pane showing…

DrRacket window

Check whether your language-setting succeeded. If it did, "R5RS" will be shown in the lower left corner, as in the picture above.

You don't want to see a mostly-black window without the two horizontal panes, without the menu, the language, etc., like…

wrong command: racket, not DrRacket

Windows like that result from the wrong start-up command:
     Racket  (without the "Dr"),
instead of the correct command:
    DrRacket
Here's a screen shot of the Windows Start menu, with the right and wrong selections identified:
Windows Start menu selections


2.  Try it! (estimated time: 7 min.) In the bottom pane of DrRacket's window, type
     (- 2 10)

The spaces matter. Press enter. Expect to see…
2 - 10 calculation

Try two more, after predicting their results.

(* 13 5)
(- 2 (* 13 5))

Make up an expression of your own, predict its result, then see its result.


3.  Submit the result (estimated time: 4 min.) 

  1. Use a mouse to highlight, and copy the text from DrRacket's bottom pane. Start with…

    Welcome to DrRacket, version something [3m].
    Language: R5RS; memory limit: 128 MB.
    > (- 2 10)
    -8

    Include the rest of your work, including the "expression of your own" and its result. Paste your copy into the hw server's "Comments to teacher".

  2. At the end of that comment, post how long this assignment took, in decimal hours rounded to the nearest tenth.


optional entertainment Randall Munroe's great, often-funny, usually-geeky work on xkcd sometimes requires education to appreciate. (I've learned plenty by working on understanding it.) But now that you know that reverse polish notation is another name for postfix notation, you might enjoy this classic and an explanation of it.



There is no homework due on Friday 2021-10-01, in keeping with school policy for exam days.

 face
— photo credit to Eugene of pd7


hw11:  optional reference sheet
due at the beginning of your class on Thursday, 2021-09-30


0.  review previous hw (estimated time: 7 min.) Compare your answers on hw10 ("practice for 0test") with answers…


Concepts to use:


1.  optional reference sheet If you want to use one during 0test, adhere to the rules on format and submission.


There is nothing to submit to the homework server for this assignment.


hw10:  practice for 0test
due at the beginning of your class on Wednesday, 2021-09-29

expected to take 0.5 hours. Record the time at which you start this assignment.


Concepts to use:


0.  Take the practice test (estimated time: 30 min.) 

  1. Prepare to time yourself, to gain insight into your pacing versus my estimates. But read the directions before starting your timer. Reading the directions 3 days ahead of the test constitutes the main advantage of doing this homework.

  2. Find the practice test in Piazza's "Resources" section, via the link in the blue bar at the top of Piazza's page.

  3. Read the test's directions, but try to avoid reading the problems.

  4. Set up your test-taking environment, including a piece of lined paper, your pencils, eraser, and timer.

  5. Start your timer.

  6. Answer the test questions, in legible writing on your paper.

  7. Stop the timer and compare your time to the 18 minutes I estimated for these questions.


1.  Submit extra information for this assignment: in "Comments to teacher" on the homework server, enter…

Bring your paper results to class.


optional: imitate preceding succeeders (optional extra education; estimated time: 0:08:14)  Two ace students formerly in this course volunteered to give people in your position their advice. Then there was the 'rona. These, however, are not the kind of people who are slowed by a global epidemic. So they spent many hours making this video.

It's even better with the closed captions turned on.


hw09:  towards 0test
due at the beginning of your class on Tuesday, 2021-09-28

expected to take 0.3 – 0.5 hours. Record the time at which you start this assignment.


Concepts to use:


0.  rules for reference sheets (estimated time: 6 min.)  You are encouraged to create a reference sheet for Friday's 0test. To be accepted, it must conform to the rules in today's class notes.


1.  What's on 0test? (estimated time: 10 min.)  Read and consider contributing to Piazza's thread on "topics and questions for Friday's 0test".


2.  Submit your time for this assignment in "Comments to teacher" on the homework server, in decimal hours rounded to the nearest tenth.


hw08:  boot; power; disks
due at the beginning of your class on Monday, 2021-09-27

expected to take 0.2 – 0.5 hours.


0.  review previous hw (estimated time: 5–20 min.) Compare your answers on hw07 ("boot; disks") with answers that will be contributed in Piazza@30 on Piazza by 8p.m.

For people who wrestled with hw07 and emerged with confusion or questions that they failed to post, this review step will be the most educational part of the homework. Get your questions answered!


1.  What use is a power supply (estimated time: 6 min.) 

Recall the purpose of a power supply. Today's class notes may help.

Understand the potential of wall power.


"Disks, Dissembled" (optional extra education; estimated time: 2 min.)  by Ariel Kahan. Various materials. Not for sale.

In Thursday's class we passed around two almost-whole hard drives. This picture shows similar drives, disassembled. A single-platter drive takes up the bottom third of the picture. Two identical two-platter drives are above it. The tools on the left helped, when wielded with skill and patience. Zoom in your browser to see details.

This is some nice work. For example, see those sets of screws on the left side of the picture? The upper set for each disk is in the pattern in which Ariel removed the cover from the disk, and the lower pattern reflects taking out the platters.

Thanks, Ariel.


There is nothing to submit to the homework server for this assignment.


hw07:  boot; disks
due at the beginning of your class on Friday, 2021-09-24

expected to take 0.4 – 0.6 hours. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 5 min.) Compare your answers on hw06 ("start application program") with answers that will be contributed in Piazza@25–21 on Piazza by 8p.m.


Concepts to use:


1.  Start a word-processed document (estimated time: 1 min.)  …in accordance with the standard instructions. Paste (or create) a table like this one:

boot the operating system
steps in the process supporting design elements
   
   
   
   
   
   
   


2.  designed for boot steps (estimated time: 12 min.) 

In the left-hand column describe the 5–7 steps that occur, (as discussed in class on Thursday) starting when a human turns on the computer, up through the point at which the CPU starts executing instructions from the operating system.

This required 6–steps for me, each with 3–15 words.

In the appropriately-corresponding rows of the right-hand column, describe the 2 or 3 concepts in the design of a pc (as discussed in class on Thursday) that allow it to perform the boot process.


3.  hard drive cleverness (estimated time for required part: 5 min.)  Watch the beginning of this video by Hammack, Ziech & Ryan on how hard drives work, at least up to the 4-minute mark.

The material after 4:00 is too non-specific for me to understand it clearly. But watching a minute or two of it will give you a decent example of how advances occur in the engineering world: significant, incremental advances result from applying a little more cleverness to existing solutions, rather than wholesale replacements of technology.


4.  hard drive operation (estimated time: 2 min.)  Watch TheSlowMoGuys have fun with a disk drive and a slow-motion camera,


5.  Submit a pdf of your file to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 2 min.)


hw06:  start application program
due at the beginning of your class on Thursday, 2021-09-23

expected to take 0.4 – 0.5 hours. Record the time at which you start this assignment.


0.  review previous hw (estimated time: 4 min.) Compare your answers on hw05 ("computer architecture") with answers that will be contributed in Piazza@14–16 on Piazza by 8p.m. Followup questions in those threads will be helpful.


Concepts to use: (estimated time to read: 3 min.)


1.  Start a word-processed document (estimated time: 1 min.)  …in accordance with the standard instructions.


2.  Understand the scenario. (estimated time: 2 min.) 

  1. Mr. Yu turns on his pc, and then rolls his chair back to where he can see the screen, but he can reach neither the mouse nor keyboard.

  2. Because the primary storage is volatile, it initially holds a meaningless pattern of ones and zeros. However, after two minutes, the operating system program has been loaded into primary storage, and the CPU has started running the instructions for the operating system.

    In the next couple days we will discuss the process (called booting) by which the operating system is loaded. It's clever, but we can temporarily ignore it and rely on "It's always worked before."

    So the following questions ask you to consider a time after the operating system has been loaded into primary storage.


3.  Which program’s instructions is the CPU following? (estimated time: 2 min.)  …and why can you be certain of that? Answer in a couple sentences, totaling less than 80 words.


4.  In Mr. Yu's next step (estimated time: 2 min.)  …he clicks on the FireFox icon, aiming to check the the new Comp Sci website. Which program responds to his click? How can you be certain of that? Answer in a couple sentences, totaling less than 80 words.


5.  Where are the instructions that tell the computer what FireFox does? (estimated time: 2 min.) 

Reread that bit about "the primary storage is volatile", and recall the meaning of volatile and non-volatile.


6.  Where must FireFox's instructions be for the CPU to run them? (estimated time: 2 min.)  …and why can you be certain of that? Answer in a couple sentences, totaling less than 80 words.


7.  So what steps are required (estimated time: 5 min.)  …for the CPU to start running FireFox's instructions? You can figure out the answer from the answers to the previous question and the computer block diagram; there is nothing to memorize here.

We discussed this in Wednesday's class, but it would be unsurprising if questions remain. Writing down your current understanding should illuminate the questions. Posting these on Piazza stands to help you, me, and others.


8.  Search for and eliminate "it" (estimated time: 2 min.)  …for the reasons described in theb"Concepts to use"


9.  Submit a pdf of your work to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. You need not bring a paper version to class. (estimated time: 1 min.)


hw05:  computer architecture
due at the beginning of your class on Wednesday, 2021-09-22

expected to take 0.4 – 0.5 hours. Record the time at which you start this assignment.


0.  Review the learning (estimated time: 7 min.)  …in today's class notes. Questions? Post them on Piazza!


1.  Start a word-processed document (estimated time: 1 min.)  …in accordance with the standard instructions.


2.  Define (estimated time: 4 min.)  …volatile and distinguish its meaning from non-volatile in the context of storage. Limit your answer to 40 words.


3.  primary storage vs. secondary storage (estimated time: 5–15 min., depending on your level of understanding during class)  Solidify your understanding of Tuesday's discussion of the differences between these, by copying the following table to your word-processing document and filling in the cells.

primary storage secondary storage
volatility
data capacity
speed of response
to requests for data
accessibility to the CPU
cost, for equivalent
amounts of memory

Short phrases — or even single comparative adjectives — suffice. For example, the "cost" cells don't need numbers. One costs more, the other less. Identify these.


4.  "Is an x a y?" (estimated time: 9 min.)  Enough people had problems with the format of these answers that another try may help.

  1. Is a rectangle a quadrilateral? Answer in good English, in fewer than 50 words. I used 33. (estimated time: 4 min.)

  2. Is a rectangle a square? Answer similarly. (estimated time: 4 min.)


5.  Submit a pdf of your document to the homework server. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. Bring your paper results to class. (estimated time: 1 min.)


hw04:  Piazza+
due at the beginning of your class on Tuesday, 2021-09-21

expected to take 0.3 – 0.5 hours. Record the time at which you start this assignment.


0.  Piazza party (estimated time: 20 min.) This course makes extensive use of an online forum called "Piazza". This task asks you to activate your account and make a first contribution.

Activate your Piazza account using the email that Piazza sent to your @stuy.edu account on Monday afternoon.

Set your profile to use the first and last names that you are known by in class, to aid communication and promote collegiality.

Read these notes on how Piazza is to be used in this course. As an incentive to students who are motivated by grades, part of the homework grade covers following the advice on this page.

Use good wiki etiquette to contribute 7 minutes of thought and writing on one of the existing discussions, or start a new one. This work ensures that you are ready to use Piazza, before you have a need for it.

This initial assignment always results in a flood of up to 60 emails, telling everyone about everyone else's contribution. You may be able to change your profile to prevent this, but I have never bothered. That is because the default settings have been appropriate after this first assignment, and deleting 60 emails seems easier than adjusting my profile twice.

optional extra education: Piazza founder Pooja Sankar writes about studying comp sci in college as a woman in India, and how Piazza can help. (estimated time: 2 minutes).


1.  sources of help (estimated time: 3 min.)  Know the sources of help for this course, as shown in the course notes. The classes on Monday were able to list 4 or 5 of them by crowdsourcing, but if you eventually decide that help might help, you need to know them yourself.


2.  Make up a new password (estimated time: 2 min.)  You will need it when we configure accounts on the StuyCS computers, as soon as class time permits. The easy way: review xkcd on "Password Strength". Tell no one.


No submission to the homework server is requested for this assignment.


hw03:  revise definitions
due at the beginning of your class on Monday, 2021-09-20

expected to take 0.3 – 0.4 hours. Record the time at which you start this assignment.


0.  Start a new word-processed document (estimated time: 2 min.)  …in accordance with the standard instructions.


1.  Improve your definitions (estimated time: 8 min. if you recorded notes during Friday's lesson)  …from the previous homework, to create versions in your new document that incorporate the discussion in class on Friday. Use…


2.  Is an operating system a computer program? (estimated time: 5 min.) 

  1. First, learn the requirement for answering questions of the form "Is an x a y?":

    The only form for an answer that seems compelling to me requires that you…

    1. define the attributes that every x shares; then…
    2. define the attributes that are required for an entity to be considered a y.
    3. Compare these sets of attributes.
  2. Use your definitions with this structure to answer the question "Is an operating system a computer program?" in your word-processing document.

  3. Understand / learn the structure well enough to to use it on similarly-structured questions in the future, for example, on a test.


3.  Print your results and attach them (estimated time: 3 min.)  …into your notebook on the page after Friday's notes. I will not collect this paper.


4.  Submit a pdf of the file to the new homework server slot that is named for this assignment, without overwriting the submission for the previous homework in its slot. In "Comments to teacher", tell me how long this assignment took, in decimal hours rounded to the nearest tenth. (estimated time: 1 min.)


hw02:  useful jargon
due at the beginning of your class on Friday, 2021-09-17

expected to take 0.5 hours. Record the time at which you start this assignment.


0.  Learn to bypass your browser's cache. (estimated time: 2 min.)  Some students failed to do hw01 on time because they saw only an old version of this page, showing hw00 but not hw01. Learn from their pain: everyone who browses web pages needs to understand how to avoid this issue.

Wikipedia helps, as so often. Read the first paragraph of Wikipedia:Bypass your cache and the "Simple instructions" appropriate for your choice of browser.

Whenever you return return to a page that is updated frequently, like this one, tell your browser to perform an uncached reload.


1.  finish hw01 …if you failed to record an estimate of your time. The homework server will show your submission as late. This assignment will not be graded for promptness.


Concepts to use:


2.  Start a word-processed document (estimated time: 5 min.)  in accordance with the standard instructions in this course.


3.  jargon for software (estimated time: 20 min.)  Understand each of the terms in the list below. Briefly define each, in two to four sentences (or equivalently, about 40-80 words in each definition). Write your answers in a word processor. Word processors can count words.

Capture the subtle and important distinctions between
     program versus algorithm
and between
     operating system versus application program.

Cite your sources, of course. If you learn from a source on the world-wide web, record the URL to allow readers (including yourself) to return to that source later, as well as to conform to standards for academic honesty. For informal work like homework, the URL suffices. That is, you are not required to format your citations the way you would for publications, such as APA style.

Save the document in a file.


3.  Have your word processor produce a .pdf file of your document. If this is your first experience with producing a .pdf from your word processor, you can find lots of advice on the web, tailored to your word processor.

Submit the .pdf of your document to the homework server, in the slot for this assignment.


hw01:  complete the organizing
due at the beginning of your class on Wednesday, 2021-09-15

expected to take 0.5 hours. Record the time at which you start this assignment.


0.  finish reading (estimated time: 25 min.)  Complete your understanding of the home page. Hw00 asked you to start reading it. Write down any questions that you need answered, and bring them to the next class. We can devote a little time to answering them.


1.  Submit your total time for assignments hw00 and hw01 in the "Comments to teacher" on the homework server for this assignment, represented in decimal hours rounded to the nearest tenth. I aim to check and grade whether the submission is done correctly. (estimated time: 1 min.)

optional background:
These estimates — which are requested for almost all assignments — provide me with feedback on whether assignments are of appropriate length. To that end, most assignments ask you to "Record the time at which you start." You will not be graded on the amount of time you spend, but rather on following the directions.


If you joined your current class after its first session read these notes to get yourself and me on track.


hw00:  get organized
partially due Monday, 2021-09-13  before 10pm

expected to take 4 minutes for the part due today, plus 55 minutes for the remainder.


0.  introduce yourself (estimated time: 2 min.) by filling out this form.


1.  change your password on the homework server (estimated time: 2 min.) Your password is initially your 9-digit OSIS.

Only the password fields need changing.
      profile page


The rest of the assignment is one more click away. The requested reading and thinking is large enough and important enough that it is to be started today, but will be due with the next assignment.

There is nothing to submit to the homework server for this assignment.