Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran Old timer's question

  1. Mar 25, 2016 #1
    When I was in college back in the early 80s, I took a numerical methods course. We used fortran as the language for our programs. What kind of fortran was that, is fortran still a viable language, and if it is, where can you access compilers? Has it changed much over the years? TIA for your input.

    Regards, Kevin
  2. jcsd
  3. Mar 25, 2016 #2


    Staff: Mentor

    I too took a class in Fortran back in the early 80's. I'm pretty sure that the Fortran we used was Fortran 77.

    Based on the number of questions about Fortran that we get here, it seems to be in use a fair amount, particularly in scientific programming. There have been many changes through the years, with significant versions being Fortran 90, Fortran 95, as well as versions newer than that.

    There are several compilers around. gfortran is one that you can download for free. If you do a web search for gfortran, you should be able to find a download site.

    For information, see https://en.wikipedia.org/wiki/Fortran.
  4. Mar 25, 2016 #3


    Staff: Mentor

    Fortran iv was the standard in the 70's and for Gcos 6000 systems it was Fortran-Y an extended version of iv.
  5. Mar 25, 2016 #4


    User Avatar

    Staff: Mentor

    There were major additions to the language in Fortran 90, including modules and new ways to declare data types. Later versions of the Fortran standard made further additions. See the wikipedia page that Mark44 linked to.

    The programming world is now very fragmented in terms of languages for different purposes, compared to c. 1980 when "programming" still mostly meant Fortran in science and COBOL and RPG in business. If you want to "re-learn" programming, you should probably consider what kind of programming you want to do, and choose a language accordingly. I've never heard of a smartphone app written in Fortran. o0)
  6. Mar 25, 2016 #5
    Mark, that link confused the heck out of me. Where is the link to download the compiler? I am using Windows Vista.
  7. Mar 25, 2016 #6
    JT, I just want to play around with it. I always enjoyed writing programs to solve mathematical problems. I was thinking I would like to solve the four particle system,H2, energy as a function of internuclear distance.
  8. Mar 25, 2016 #7
  9. Mar 25, 2016 #8
  10. Mar 25, 2016 #9


    Staff: Mentor

    If you want to be more modern theres julia a language very similar to matlab. Having programmed in both over the years i think would be more interesting to use.

  11. Mar 25, 2016 #10


    User Avatar
    Science Advisor
    Gold Member

    Whenever I need to pick up a little bit of a new programming language, I try to knock out a few of the problems at this site: https://projecteuler.net/archives

  12. Mar 25, 2016 #11


    Staff: Mentor

    Thanks for the site reference. It looks quite interesting.

    then you might like the www.rosettacode.org site where a variety of problems are solved in a bigger variety of programming languages,
  13. Mar 25, 2016 #12


    User Avatar

    Staff: Mentor

    Drilling down from gsal's link, here is the section on Windows binaries for gfortran:


    I don't use Windows myself, except very occasionally under Parallels Desktop on my Mac, and have never tried to install a Windows compiler for any language. I've used gfortran a bit under both Mac OS and Linux.
  14. Mar 26, 2016 #13
    OK, I have downloaded the compiler for 32 bit windows. Now, how do I get to the page where I can write a simple program to test the compiler? God, I feel so old and out of touch.
  15. Mar 26, 2016 #14
    Well, first, you are also going to need a decent text editor like Notepad++; go ahead and install that too.

    Then, just follow the typical Windows way to a working directory via the file manager, create a text file, open it with Notepad++ and start typing your Fortran program.

    Then, you open a DOS terminal and change directories 'til you get to the same working directory where your program is; now, you can compile your program and run it.

    This will work if you installed your compiler correctly and it added itself to your PATH environment variable; if not, you need to add the location of your compiler to the PATH manually.
  16. Mar 26, 2016 #15
    Here is a complete list of instructions to get this working very quickly.
    1. uninstall everything you have already installed today
    2. go to http://www.codeblocks.org/ click on "download", "Download the binary release", "Windows XP / Vista / 7 / 8.x / 10" and then "codeblocks-16.01mingw_fortran-setup.exe"
    3. run the installer, keep clicking next until it's finished
    4. run CodeBlocks, choose the "GNU Fortran Compiler", click "Set as default" and then "OK"
    5. click on File/New/Project/Fortran Application
    6. click Next, set the project title to whatever you want, set the projects folder to e.g. "My Documents"
    7. click Next, make sure GNU Fortran Compiler is selected and then click Finish
    8. on the left side you can now see your new project. Click on "Fortran Sources/main.f95"

    Now you can modify the code and then click on "Build and run" or press F9.
    btw. all your Fortran files should end with .f95 or .f90 to make sure the compiler recognizes them correctly

    There are different tutorials out there to help you get started. e.g.

    You can also find tutorial videos on Youtube
  17. Mar 27, 2016 #16
    Thank you Dr Zoidberg, you're the man.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted