Monday, February 16, 2009

Homework 5, #7

By the way, here are a few code-based solutions that you submitted to homework 5 problem #7. Quite a variety - Fortran, C/C++, and Python are all represented.

My own (hastily-composed) version is here, in standard C. It should compile with vanilla gcc. It takes a command-line argument N, where N is how many terms of the harmonic series to evaluate. For "fun" I also included code (commented out) to calculate the same sum recursively.

For reference, here is the source of the problem (Car Talk), here is their answer, which employs the Euler–Mascheroni constant.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Regarded code will almost deliver you more things to be done right on time, also there are right piece of the considerations which will almost assist you in completing your assignments. optics homework

    ReplyDelete