Arnold answers your questions about programs #6

  1. Q: I heard a rumor that Program #6 isn't due until Wednesday.

    A: Yes, it is still useful to go to lecture. Glinert spent 1/2 hour on Monday's lecture going over Program #6 and finally ended with an extension for everyone until Wednesday.

    Furthermore, if you hand it on Monday, you will get the bonus points.


  2. Q: For program #6... how does this whole thing work? I don't understand Glinert's explanation. DOH!

    A:Consider zis puny example:
    Let's say you are working on the following equation:

    2x^3 + 4x^2 - 20x + 24 = 0

    And you choose V to equal 100.
    Then A = -100 and B = 100
    For the first time through, C = 0 (because C = (A+B)/2.0 )
    But that is alright. P(C) will just equal 24
    Since 24 is positive, you will have to check if P(A) or P(B) is positive. If P(A) is positive then A = C otherwise B = C.
    Since, in this case, the value is positive, we will replace the B.
    So now you run through the whole thing again with A = -100 and B = 0
    Do this until you get really precise numbers for A and B. Like A=-4.6827435 and B = -4.6827438.
    Then choose one, say A, and that will be the approximated root.

    Your output should show all of these iterations and run through all 6 equations Glinert gave you.


  3. Q: How do you use redirection?

    A: Here me now and believe me later, redirecting a file will make your life much easier.

    First just make your program as usual, with the normal cin statements. Then create a file, called data, that looks like so:

              2  4 -20  24
             -6  1   3 -40
              1 20  30  40
              4 13   0 -13
            100 13 -13   0
             -3  1 -20  25
              0
    
    Where each of the numbers corresponds to a, b, c, and d. The final 0 in the a slot will tell the program to end.

    Now run your program with the UNIX command:
    cubicRoot < data

    This way you can run your program quickly without having to type in all those numbers over and over again.


  4. Q: Do we have to find all 3 roots for each problem?

    A: Only equations #4 and #5 (from the standard data) have 3 roots, all the others only have one root. But for #4 and #5 I will accept any one of the 3 roots as being the correct solution.


  5. Q: I am running out of space on my account. I don't want my homepage anymore and it is taking up space. Are we going to be graded on it again or can I remove it? Mmmmm, disk space...

    A: Zee homepage may be terminated.


<---- Comp Sci 1 Homepage