Fortran seems to be a better choice. Not only is Fortran designed for scientific programming but also it has many efficient 3rd party mathematical libs like LAPACK, PSBLAS etc. See this link: http://fortranwiki.org/fortran/show/Libraries
However, fortran is an old language which might not support some modern programming features such as object/class etc. For these new feature, C++ might have better experience. But as a new language, C++ is not intended for scientific programming. So you may not find so many C++ libs for basic mathematical coding. You might need to build up math lib/module by yourself, which certainty will be a tough work.
For example: Fortran could calculate complex variables directly. In C++ there is no complex valued variables available, you have to treat the real and imaginary part separately.
i think that's a highly arguable question and to get a more valuable answer fitting your purpose you should give some more information about your specific demands to the people. Therefore, you should probably mention if for example speed is more important (or you planing a hpc application for example) or the ease of programming or the expressiveness of the language etc...
In general I would agree with Nan Chu that Fortran has its special place in numerical computing applications, but there are also many scientific computing libraries (like GSL, openBlas, OpenFOAM, dealii, freefem++) that make heavy use of C/C++ and I bet they asked themselves the same question..
In my opinion and experience, Fortran (formula translator) is a pre-historic language decidedly unsuitable for modern scientific computing. I my lifetime I have used Algol (a Zuse computer in early 60's), wrote two fortran-like compilers of my own (soviet Minsk computers in mid 60's), Fortran on various western computers in late 60's and 70's, wrote a Fortran 77 compiler (for Bruker Aspect mini) in 1980, Basic and Quick Basic in 80's (Z80-based PC's and all the x86 Intel based PC when they appeared), several Assembly languages, C and finally C++ that I use intensly since from about 1997 and I would never go back.
It is fast, very readable, very modular, absolutely flexible and it supports via classes any data types. It is totally wrong to say that complex numbers are not supported; apart from a number of C++ libraries supporting full complex arithmetics (much beyond what Fortran offers), one can - and routinely does - easily write arithmetic support for any data types (I have my classes handling rational numbers, quaternions, 3d vector, space-time coordinates, spherical coordinates, spinors, spin operators for coupled spin systems, graphs, etc etc etc). Moreover, there are today certainly many more (>10 times) easily accessible ready-to-use libraries in C and C++ than in Fortran. The C/C++ development tools (IDE's, debuggers) are today also very good, many are completely free, and they are (in my opinion) better supported than for Fortran, basically because even Fortran development tools are actually written in C++. Nobody would write a Fortran compiler, debugger, and IDE in Fortran, and that feels! Last but not least, C++, being more recent and modern, is much better suited (and supported) for heavy-duty parallel computing.
Starting a new large project in Fortran would never even cross my mind today.
Yes, the main criteria today are readability, portability, modularity, flexibility, being parallelization-friendly (plus some more I have missed). In my opinion, Fortran shows its age on these points. This said, I do not claim at all that it is to be shredded; not yet, especially since there are so many working Fortran applications.
C++ is absolutely a better choice for modern coding. With recent great optimizations in C++ compilers, this language has become very fast, more intelligent, and easier to work with.
Sure, I mentioned Fortran 77 just to make it clear that I am not a-priori biased against Fortran (I lived ca 15 years with it). The fact that, despite this, I did eventually not switch over to Fortran 90 should mean something.
It is a bit frustrating that so much false information about Fortran is being presented here. Fortran is light-years ahead of C++ in the area of parallel programming. It includes classes and OOP. And it is a newer language - just standardized in 2018. There is a misconception that Fortran 77 and 90 still exist - they don't. All the previous versions have been cancelled by ISO. There is only one current version - Fortran 2018. It includes enough parallel structure as part of the syntax and semantics that MPI is no longer relevant. There are multiple, powerful loop constructs, pointers and array variables (part of the language syntax - not part of a class library), and a long list of intrinsic functions (200+).
C++ does have domains where it is a better language - system software and business applications, for example. But the original question was about math (and, by extension) scientific programming. For that question, Fortran wins hands-down.
As Bill Long points out, today's Fortran is not what you think it is. Just as C++ isn't what it was in 2003. Both remain backwards compatible with existing code bases. In this way, code written in Fortran77 or Fortran90 will still compile and execute.
New projects coding to the Fortran 2018 standard can leverage all the changes to the language that have occurred, but the existing base of HPC applications can still be enhanced w/o requiring any of the new features.
As a point of personal preference, I try to write modules in whatever language is most appropriate to solve the problem. I then count on the linker to handle the interlanguage calling vagaries.
As I try to digest the most recent set of changes/enhancements to C++ (2017), I find it simpler to just implement in Fortran.
Bill Long , I recommended your comment, two, for fair play. I was not even aware of Fortran 2018 (while I am using C++ 2017), so I apologise for any unfair comparison. In the end, maybe, it is all just a question of what one is used to. I certainly do much scientific computing with C++ (in fact, I do only that kind). And I come across mountains of Fortran code, too (some is mine, but not all), but that tends to be all like 20 years old. I do not know why, it is just what I happen to see. It may well be a personal statistical excursion and I do not want to be unfair. In the end, perhaps, the choice of language is not what really matters (as long as it is a decent one).
Jaydip Datta Why do you insist about using 24 year old version of Fortran where everyone could use a C++ compiler using C++14 if not C++17?
I don't know much about Fortran but I know that trying to still use C++98 or even older pre-standard versions that exists in 95 would be pointless, more error-prone and counterproductive...
Fortran is capable for basic scientific calculation, especially for mechanical engineering or other majors. While C is more flexible according to the program ability of the users. If you are actually good at computer programming, I recommend C.
Delphi detects bugs much better than C. Because Delphi does not have automatic variable type conversions (which are in C), Delphi detects many bugs at compile time which C would detect maybe after many months of testing at runtime, which would be a disaster.
I write all my apps in Delphi and I have a very small web site as a web app (in Polish) zagadki-informatyczne.pl
I now want to include linear programing with simplex algorithm as a sample app in my web site.
I agree that dynamically typed languages are generally more error prone that strongly typed languages. But there are several strongly typed languages, including Fortran which was the original topic of this thread.
The article referenced appears to mainly explain that the author is spectacularly uninformed. About compilers. Or whether the private sector is that relevant to anything. (And if the private sector is important, COBOL , Java, and (these days) Python are the key entry tickets.)
I do not know any language except Pascal that does not have automatic variable type conversions. In Pascal (Delphi) bugs of that kind are detected while compiling. In other languages, due to the bugs, you will not know for years that your application returns incorrect data. From 1970 to 2000 Pascal was the only language used to show listings in books. Due to incorrect political decision it was stopped and the powers that be try to eliminate Pascal from education systems. I just wrote within two days an app using genetic algorithm with Delphi starting from scratch with zero knowledge about the algorithm.
Let's assume the worst situation (which doesn't actually happen), that Pascal (Delphi) gives code that runs twice as slowly as for other languages.
Remember that it pays to optimize the application in terms of execution time only if two conditions are met 1) the application runs a long time before it returns the results, i.e. for several days and 2) we use the program often.
These situations are not common, so it does not pay to risk making difficult to detect errors in the program using a language other than Pascal. What language was the windows operating system written in? Is that why every few days there are issued patches to fix programming bugs? And there are hundreds of the patches.
If you are a conformist, you will use a programming language that is promoted, even if it has no justification and is a big difficulty for you. Whereas if you are a scientist and write your own software for the purpose of developing your scientific research, then you can use a programming language that is convenient for you.
My Delphi compiler gave me ten implicit expression conversions warnings that needed to be corrected. Sometimes it is just the lack of entering the conversion function and sometimes it indicates a logical error in the program that requires rewriting several lines of code. If I used a programming language that used automatic expressions type conversions, I wouldn't have realized even after a few years of using the program that the program returns incorrect results. Thanks to Delphi I was able to write in a few hours a program with 500 lines of source code implementing the evolutionary algorithm. I did not publish the article about it as the article is being sold.
Of course, any language has its specific application. C is great for devices and c# Java python are great for interface and configuration management. A PhD in programming is special, but a PhD in fluid mechanics, chemistry, process, molecular biology, astronomy, thermodynamics... Is better in c++
Well, C was designed for writing OS code and (along with C++) is good for that. Java and friends are for Web programming. Python replaces scripting languages like Perl, and is the most commonly taught to students. Professional computer scientists can endure the complexity of C++, but for actual scientists (chemistry, physics, astronomy, meteorology, ...) Fortran is much better suited to the task. And easier to learn than C++. And it has parallelism built in, which is handy for all the parallel systems normally used these days for scientific computing.
I did read the paper. It contains a lot of statements that are just plain false. Sorry, but whomever gave you information was not being honest. Besides, in the HPC domain (and Fortran is effectively a domain-specific language for HPC), the concept of 'private sector' is a lot less relevant. Most of the HPC users are government-funded research labs or weather forecasting and climate modeling agencies. (And, it's Fortran, not FORTRAN. The all caps version refers to versions from 1977 or earlier only. The one that's called Fortran was published just last year by ISO. )