PHYS 252

Always hand in:
  1. written solutions to any questions
  2. a paper print-out of well-commented code. Include a multiline comment at the top of your code with (i) the assignment name, (ii) your name, and (iii) the date you handed in all elements of the assignment
  3. paper print-out of output (graph or text)
  4. also, e-mail me (y-lithwick@northwestern.edu) the code with your name and the exercise number in the subject line

Assignment #1 [5 points, due 2pm, April 3]

  1. Write a code that outputs f(n) = n2-n-1, for n = 0,1,2,...30. The output should be integers.
  2. Plot f(x)= x2-x-1 vs. x, where x is real (actually double), and hand in plot. From the plot, what are the solutions of f(x)=0? Compare with the analytical solutions.
  3. [This question is not for credit:] Write a code that outputs the following triangle, where the number of rows should be arbitrary:
    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********
  4. [This question is not for credit:] Work through the online C tutorial up to c_027b.html, i.e. up to (but not including) switch/case.