PHYCS 3730/6720 Lab Exercise

Reading and references:

Exercise 1.

From the online notes, copy the code nr.cc. Look at it to see what it does. In your answer file lab07 make a table of all of the identifiers (variables) defined in the code and specify their datatypes. Here is a start:
    Identifier   Datatype
    ----------------------
      p           double

Exercise 2.

Write the Makefile for compiling nr.cc. (Follow the directions in the notes for including the math library. See the notes for compiling quadratic.cc for an explicit example.) Compile it with make and run a couple of examples. Copy your Makefile to the answer file.

Exercise 3.

Modify the code so it prints out the value of i, p, and pnew at each step of the loop, just after evaluating pnew.

Copy your modified code to the answer file.

Exercise 4

Starting from the result of Exercise 1, modify the code further, changing the for loop to an equivalent while loop. Use the listed intermediate values of i and p to verify that it does the same thing.

Copy your newly modified code to the same answer file lab07.