The Artful Scientist

Communicating the greatest possible growth

  • Google Talk

  • Skype Me

    My status
  • Where are you?

    Welcome to theartfulscientist. Enjoy your stay as I talk about my life as a fire protection engineering student and one who studies fire dynamics. These posts range from day to day excitement to my developmental life and provide a window into my world.



    The about page tells more.
  • Want to read what I read?

    Visit my Google Reader shared items page. You can even subscribe to my favorite shared articles.
  • My Music Plays


  • My Visited US States

    Visited US States
  • Photo Albums

  • Search This Blog

  • Subscribe

      RSS Subscribe

    or subscribe to updates by email address:

  • Archives

  •  

    March 2008
    M T W T F S S
    « Feb   Apr »
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31  

Mac-Corrected Numerical Analysis Fortran Programs

Posted by Kris on March 10th, 2008

I am taking a numerical methods course and using the textbook Numerical Analysis 8th edition by Burden and Faires:

Numerical Analysis

The book is good and has nice pseudocode examples throughout. It also has a companion website with all of the algorithms programmed in C, FORTRAN, Pascal, Maple, MATLAB, and Mathematica. For our assignments, we can use any program that we want, and I have been using MATLAB, FORTRAN, and Python as those make the most sense to me thus far in my computing experiences and are the most useful for my work.

However, the FORTRAN 77 programs on the website are programmed in such a way that they only work when using a FORTRAN compiler in Windows. At this time, my primary machine is an Apple Macbook Pro laptop, and I am using the Intel Fortran Compiler version 10.1 on OS X Leopard. When I try to compile the programs from the textbook website, I get errors. So, I went ahead and fixed the files so that they would work on with the Intel compiler on the Mac, and hopefully Linux as well.

The two problems were that:

a) The programs were trying to read and write to ‘CON’, which is a Windows specific way of writing to the command window console.

b) The programs had an extra line at the end and would crash the Intel compiler.

So, I fixed these errors in all of the programs and you can download the corrected files in .zip format from me and follow the instructions below to compile.

The original files are freely available from the author’s website here

Step 1: Download the above linked zip file of the corrected FORTRAN 77 programs

Step 2: Unzip the FORTRAN files. You will find several files with the .FOR extension.

Step 3: Run the Intel FORTRAN compiler using the command: ifort -f77rtl -o <outputname> inputfilename.
For example, to compile example 12.1: ifort -f77rtl -o alg121 ALG121.FOR.

Step 4: Make the output file executable with: chmod +x alg121

Step 5: Run the file with ./alg121

Step 6: Be sure to answer the first Y/N question with the y or n character in quotes, such as “y” or “n”

Step 7: Have fun learning numerical methods and dissecting the FORTRAN programs!

Related posts:

  1. The Big Move to MA
  2. The clarity of Python vs. the cloud of Perl
  3. How to install PyObjC, pygame, and gasp on Mac OS X for Python tutorial
  4. Updates on welcomed unstability
  5. The Golden Resource List for Python Beginners

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>