Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 2.43 KB

hw1.md

File metadata and controls

68 lines (48 loc) · 2.43 KB

 

home | copyright ©2019, tjmenzie@ncsu.edu

syllabus | src | submit | chat

Homework 1

Due 4pm Thursday.

This one's not hard. What we are really doing here is to

  • set up some basics
  • practice how groups worth together
  • show how you can submit homeworks.

Set up

Form groups (pairs for 591, singletons for 791).

Create a github repo (in public github) and make a directory hw/1.

Each group pick your favorite programming language. Something with high-level scripting facilities i (python, ruby, javascript, java, coffeescript, whatever). Note that if you use Python, you can get coding help from lecturer/tutor. Otherwise, you are on your own.

  • Pick something that you are productive together.

What to Hand in

  • Place your code in the hw/1 directory.
  • Place a text file hw/1/out.txt in that same directory, showing a transcript of it work.
  • Place a link to that code in http://tiny.cc/ase19give

What to do

Write a class called Col with subclass Num, Sym, and Some

In Num, write code that read a number one at a time, and incrementally update mean and standard deviation. For pseudocode on how to do that, see Num.

  • you'll only need down to code line 35.

Test your code:

  • build a list of 100 random numbers
  • add the list, one at a time to a Num
    • every ten numbers, cache the mean and standard deviation
    • i.e. that cache is two lists of means and standard deviations seen at "i" = 10,20,30, etc
  • now delete those numbers, one at a time, from that Num.
    • every ten numbers check that you are getting the same thing as the cache
  • For a sample of that code, in another language, see _num

Caution:

  • There is a known bug in the NumLess function of Num. Those sums go wrong when the sample is small and sum is small (due to some deep issues with the representation of reals... we won't be able to fix that).
  • So when deleting the numbers, run from 100 down to 10 then stop.