Literature for Modern Fortran Lectures

Hi all

If the audience have some experience I would stick to Metcalf. I recommend you to make the students experiment with the compiler flags as well. Probably they come from python and most of them are not used to the process of compilation.

4 Likes

Start with your audience and use their existing knowledge as a platform.

Early on, give them a reason to learn Fortran - there are plenty but they may not know this yet.

Make it FUN. And fun for everyone = stretch the brightest but make sure they can all get something out of every exercise.

Unless you are taking a very experiential approach use the rule of 3 lots: tell them what you are about to tell them, tell it to them and then tell them what you told them.

Enthuse, it is always infectious

Invite and welcome questions, praise those brave enough to ask.

Be very careful about “requiring” access to books, University libraries rarely have the stocks they claim.

You will never forget your first lecture course, so enjoy it, and good luck.

5 Likes

My favorite problem from my undergraduate numerical methods class was problem #2 from this xkcd comic: xkcd: Substitute. I devoured that assignment!

In another class we had to optimize hitting a traveling object with a projectile. The professor was a MATLAB guy, and when I showed him my genetic algorithm in fortran that solved it in just a few milliseconds, he was astonished. :slight_smile:

6 Likes

Thank you all, for your suggestions, tips and support! I really appreciate it!

Since there was so much feedback, I’m going to sum it up:

  • 5 books were suggested, I reference them by author and year:
    • Markus12 gives practical infos for scientist and Clerman11 has good style advice. Since those are the oldest ones and seem to be better suited for experienced (Fortran) programmers, I will not buy them for my purpose.
    • Metcalf18 is good for referencing, therefore I’m going to buy it!
    • Both Curcic20 and Chapman18 seem to be best for teaching. I tend to buy Chapman18, but maybe I’ll end up buying both of them.
    • In case I misunderstood something, please let me know!
  • Many other tips and suggestions that reached me (in this thread or PM):
    • There might be not enough time to cover everything of modern Fortran
      → I think I will build a solid base and touch any other topic, so the students know what they can look at on their own
    • I definitely will show fpm (and hopefully some other projects, like LFortran etc.)
    • Maybe I will not use LaTeX. Instead I will maybe use sphinx with a similar configuration as the fpm-documentation. This should allow both HTML & PDF output, and we can add translations for other languages. I tend to start the project in English.
      • In case I decide to do it in LaTeX, there is a template on github for easier collaboration
    • I will link the project in the Fortran Wiki, fortran-lang.org and maybe publish a paper on it
    • There are many resources with Fortran courses (e.g. from/at Uni Bonn, HLRS, LRZ, etc.)
    • I need (and want!) to make the course fun and enthuse, give a good reason to learn Fortran (obviously because its by far the nicest community you will ever join :wink: )

Thank you again for your suggestions.
My next steps are to order and read the books. While reading I’ll start to create a structure for the course.
Meanwhile I will try to build a framework for the lecture notes.
If you have more ideas for the course/lecture notes/structure in general, I would be very pleased if you share them with me/us.
I will create more topics on this in the future!

3 Likes

I’m surprised no one mentioned the book by Walter Brainerd, Guide to Fortran 2008 Programming. It’s from Springer, so german students will likely have easy access. Personally, I prefer it over the Chapman’s book which I find too long and over-priced. Not many students enjoy looking at a > 1000 page PDF, when they could be learning by doing.

Another book I liked was Guide to Scientific Computing in C++. It took me 1 week to work my way through the book, back when I was an undergrad. It could be adapted quite well to be a Fortran book.

Originally, I learned Fortran in the context of a course on numerical methods without reference to any books. The first half of the course were simple exercises to get to know the language, and in the remaining half we wrote our own bisection and Newton solvers, golden-section search, cubic spline interpolation, Euler and Runge-Kutta methods, and finally Gaussian elimination. I enjoyed the exercises a lot, as they enabled me to solve a lot of problems in my other engineering courses.

1 Like

I have it on my bookshelf so I can confirm, it is just 408 pages. But some topics are really discussed very briefly. Derived types - 10 pages. OOP - 12 pages.

@Carltoffel You should also try to find a copy of “Fortran 90 Programming” by Ellis, Phillips, and Lahey. It’s out of print and only covers Fortran 90 but you might be able to find a copy in your university library or a used copy on-line. I recommend it for the example programs and problems. Many of the example programs are full working programs that cover things like Gaussian elimination etc and not just code fragments. It was my first F90 book and I still find its explainations of some topics to be clearer than more recent texts.

I disagree entirely though I can’t comment on the price. Among the references available with focus on Fortran 2008 and later, I find the book by Chapman to be structured most closely as a textbook intended for students at a university with rather good material and explanations to boot.

The lengthy coverage of topics too is rather ideal for university learning (as opposed to high school or lower) in that it allows lecturers to choose what they want to cover from a vast menu while allowing the lecturer to give interesting and challenging assignments where the students are enticed to read and explore first within the prescribed material and attempt the exercises rather than immediately go online and cut corners and follow the herd and so forth.

By the way, I had found that C++ book passé; it’s biased somewhat with its computing approach as informed by C++98 and earlier versions that was not really all that conducive to scientific programming. C++ standard started to turn a corner with C++14; and with C++20 and soon C++23, I expect it to become rather powerful and perfomant for scientific and technical computing. Books focused strongly on current and the next revision of the C++ standard will likely be far more valuable for scientists and engineers.

That’s a fair criticism of the C++ book. Although I still think it doesn’t do a bad job as an introductory book, especially if you already have some previous programming knowledge.

Regarding Chapman, I don’t mean to say the book is bad by any means. Indeed it’s a perfect book for self-study or even as a first introduction to computer programming. I’d love if we had that.

But for me personally the price was always the prohibitive factor. At 223 €, one can buy Milan’s book (47 €), Arjen’s book (60 €), Brainerd’s book (56 €), and MRC (47 €) instead and still have money left for a beer. I just don’t think it’s worth the investment, especially when students can find a way to learn the same concepts from a YouTube video (potentially on a different programming language). Edit: prices shown are for paperback, taken from Amazon DE.

In fact I borrowed Chapman’s book when I was at university back in 2016, however the only version available from the library was the 1997-issued Fortran 90/95 (the one with a blue cover). I guess no lecturer ever bothered to convince the library to order newer versions. Can you imagine finding an exercise about building your own ASCII line plotter, when you’ve already been using matplotlib? I returned the book the day after, figuring it’s not worth my time. A few years later I noticed Julia hipsters make UnicodePlots.jl a thing with nice colored terminal plots. Apparently, I was wrong about line plots being old fashioned.

2 Likes

@ivanpribec, current Amazon prices in U.S. for the Chapman book are.

Ebooks
$67.00 to buy - $55.00 to rent

Paperback

$127.00 to buy new - $43 to rent

Not sure what it would be in the E.U.

1 Like

That would be about 116 €, so about half the price of what it costs at Amazon DE.

Outside of US you can try to purchase International Student Edition, paperback, pretty cheaper.

Well, the Chapman book is a little bit to expensive for me…
I just asked my work mates if they know how to get a cheaper copy, but anyway I will order Milan’s book and Metcalf’s book.

I found a site, which is selling the Chapman 4th edition for 40 Euro (new) which is much cheaper than their cheapest “used book” offer (118 Euro). To me this sounds very suspicious… does anybody has experience with alibris.com? (I didn’t check the shipping yet, but they claim to ship to Germany).

As you can see, all “cheap” offers are for International Edition.

1 Like

Whats the difference? Just another price or what else?

Different cover, maybe ISBN number.
For you as a lecturer, there is another possibility - getting free instructor’s copy. I have never tried but who knows, maybe it works. If you go to the publisher’s book page, you’ll see

Instructors: get your free exam copy. Choose eBook for fast
access or receive a print copy.

and a Get my free copy button

Didn’t know a different cover can make such a huge difference…
Thank you very much for the tip with the free copy. I already tried to sign up and get it, but it didn’t work. Maybe because I’m not directly hired at the university, they didn’t accept my Forschungszentrum (research centre) Jülich email address.
Anyway, I found the international edition for 60 Euro incl. shipping. Still the most expensive of all three books, though. In total my basket is now at 153 Euro (~168 USD), which is more than I hoped for but its still okay.

Regarding my book, Manning often runs sales for days at a time when you can get books for 40-50% off. And outside of these sales windows, you can search online for Manning discount codes that are always active. Also, compare the prices between Manning and Amazon. Sometimes the shipping cost from Manning can outweigh the non-discounted price on Amazon, assuming that on Amazon you can get cheap or free shipping.

1 Like

Yes, some publishers offer some books as free “instructors’ copies” but beware, salespersons start turning up, and on one occasion I got on a repeat order list and a new copy turned up every year, to the point where I ran my own little library.
My advice, do not fret about textbooks, a few students will consult a few but they are really just a comfort blanket, students like to know they exist. I am sure your lecture notes will be much better for your new learners, than any book out there, even with all due respect to the excellent books on the market.

5 Likes

Reinhold Bader, who has served on the standards committee and taught courses on Fortran, has classified Fortran features into beginner’s, intermediate, advanced content, and community-targeted and domain-specific content. This may help you decide what to cover. He has also written or co-written

An introduction to the Fortran programming language

Fortran code modernization

Object-Oriented Features in Fortran 2003

Additional Parallel Features in Fortran: An Overview of ISO/IEC TS 18508

7 Likes