LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   FORTRAN? Any reason to learn it? (https://www.linuxquestions.org/questions/programming-9/fortran-any-reason-to-learn-it-4175608371/)

Laserbeak 06-22-2017 02:16 AM

FORTRAN? Any reason to learn it?
 
I already know C/C++/Obj-C pretty well, is there any compelling reason to try to learn FORTRAN? Is it really better at mathematics than the aforementioned languages?

hydrurga 06-22-2017 05:54 AM

If you're specifically going to be involved in programming for large-scale scientific or mathematical computations, then yes.

http://www.moreisdifferent.com/2015/...l-use-fortran/

It's fairly niche however. If you're wanting to learn something purely for interest's sake, then why not try something like Julia or Go which are both "up and coming".

I suppose the question has to be - for what purposes are you wanting to learn another language?

pan64 06-22-2017 06:07 AM

probably you will find these interesting, although you can look for other pages too:
https://www.cfd-online.com/Forums/ma...c-fortran.html (more than 10 years long discussion)
https://stackoverflow.com/questions/...-analysis-thes

wpeckham 06-22-2017 06:11 AM

Quote:

Originally Posted by Laserbeak (Post 5725490)
I already know C/C++/Obj-C pretty well, is there any compelling reason to try to learn FORTRAN? Is it really better at mathematics than the aforementioned languages?

In answer to the second question: how strong are your math skills? FORTRAN can do matrix mechanics better than anything, which gives it the power to solve problems that humans would resort to advanced calculus to solve. If you needs to solve massively complex sets of simultaneous equations to predict orbital trajectories, weather patterns, or solve some problems involving quantum mechanics then FORTRAN on a supercomputer is the way to go.

It was the first programming language I learned, and still makes the most sense to me (most other languages have a crippled test for 'if'). Where it applies well, nothing else can compare to the performance it provides. If, however, you really have no need of that kind of power it is wasted time. The market for FORTRAN skills is small and very specialized and it is unlikely to enhance your career. If you are learning for fun or to enhance your mental skills it is one good option. If you are looking at general computing, perhaps not.

Laserbeak 06-22-2017 08:05 AM

I've translated from FORTRAN to C before, but never actually wrote it. I probably don't need it, but I just installed the Sun Compiler Workshop and it includes FORTRAN so II was just really musing.

Does its built-in support for matrices make SSE programming easier?

syg00 06-22-2017 08:10 AM

I first learned FORTRAN in the seventies - even used it occasionally. Never used it since, certainly not in any commercially useful sense.
YMMV.

jailbait 06-22-2017 09:37 AM

Quote:

Originally Posted by Laserbeak (Post 5725490)
I already know C/C++/Obj-C pretty well, is there any compelling reason to try to learn FORTRAN? Is it really better at mathematics than the aforementioned languages?

FORTRAN is no better at mathematics than C. However FORTRAN was the first computer language to make mathematical notation easy to code. Over time scientific and mathematical programmers have built a large pool of FORTRAN subroutines which solve complex mathematical problems. If you are going to work on programs which solve complex mathematics problems and you have access to a good FORTRAN scientific subroutine pool then by all means learn FORTRAN and use the existing code.

If you are going to work on programs which solve complex mathematics problems and you have to do all of the work from scratch then use C. C is just as good as FORTRAN for mathematics. C is far superior to FORTRAN for I/O, entering data, and printing reports. Trying to print a readable report in FORTRAN will drive you up the wall.

-------------------
Steve Stites

syg00 06-22-2017 09:45 AM

Quote:

Originally Posted by jailbait (Post 5725714)
C is far superior to FORTRAN for I/O

???? - thems might be considered fighting words by some.
CERN f'instance maybe.

suicidaleggroll 06-22-2017 09:45 AM

FORTRAN is still used heavily in the scientific and modeling communities. Large atmospheric models were written in FORTRAN decades ago and are still being used/modified today. If you plan to go to NCAR/UCAR or work with any of their models or similar models, it's a valuable skill to have. I know it, I use it pretty regularly, but I'm more of hardware person rather than software so I prefer to let other people do that kind of work. It's hard to find capable people though.

ntubski 06-22-2017 10:24 AM

Quote:

Originally Posted by jailbait (Post 5725714)
C is just as good as FORTRAN for mathematics.

I've read that because of the way C allows aliasing and pointing to parts of arrays, C compilers are sometimes less able to optimize functions handling large matrices compared to FORTRAN compilers. (never used FORTRAN myself though)

Turbocapitalist 06-22-2017 10:27 AM

I was just asking someone about this last week as they have lots of experience with both C and FORTRAN, among others. Their answer was that FORTRAN is faster than C even, when well writen.

In addition to the other areas, it is used in physics.

dugan 06-22-2017 04:00 PM

No. The scientific community has largely moved to other languages such as Python.

!!! 06-22-2017 06:35 PM

https://docs.oracle.com/cd/E19205-01...vcv/index.html has many refs to SSE, fyi if that's the compiler you 'unearthed' :eek:
But +1 #12. Too bad your Solaris doesn't have APL :D R?

Beryllos 06-22-2017 10:52 PM

Quote:

Originally Posted by Laserbeak (Post 5725678)
I've translated from FORTRAN to C before, ...

I think that could be a good reason to learn a little FORTRAN. I use some old FORTRAN library functions that are reliable, simple, and compact. I translated them to C, GO TO statements and all.

By the way, I wouldn't mind getting rid of the GO TO statements, but how the heck do you do that with staggered loops, like this?
Code:

10  CONTINUE
    some code
20  CONTINUE
    more code
    GO TO 10
    still more code with a test: IF (condition) GO TO 30
    GO TO 20
30  CONTINUE

It must be possible, but I haven't figured it out

Quote:

Originally Posted by dugan (Post 5725838)
No. The scientific community has largely moved to other languages such as Python.

I like Python, with C extensions for speed (including those functions translated from FORTRAN).

Laserbeak 06-23-2017 12:25 AM

Quote:

Originally Posted by !!! (Post 5725890)
https://docs.oracle.com/cd/E19205-01...vcv/index.html has many refs to SSE, fyi if that's the compiler you 'unearthed' :eek:
But +1 #12. Too bad your Solaris doesn't have APL :D R?

I started using Sun Workshop for like almost 20 years now, we had it at the company I first worked for. For some reason the powers that be decided they'd rather spend 1000s of dollars for licenses for that than use gcc since they didn't trust it for mission critical proprietary applications. Of course back then they didn't even have SIMD vector programming and it was all SPARC and UltraSPARC.

I think around that time Intel first came out with MMX which isn't that great. AltiVec on the PowerPC G4 came later and was much better.


All times are GMT -5. The time now is 04:01 AM.