Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is C really used for a lot of Scientific Computing?

I'm currently taking a math class in College called "Scientific Computing" and the professor told us that C is the most common language used for, well, scientific computing and am just wondering as to how accurate this professor is?

like image 206
Bobby Avatar asked Sep 13 '09 03:09

Bobby


People also ask

What is C mostly used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Is C++ Good for scientific computing?

C++ is an excellent programming language which is extremely well-suited for scientific computing.

Is C# good for scientific computing?

C# gives you a choice, which makes it even more attractive as a language to be used for scientific computing. C# supports three types of arrays: single-dimensional arrays, jagged arrays, and rectangular arrays.


8 Answers

In my business (particle physics) we pretty much moved from fortran 77 straight to c++ and python. Those of us who care about programming all know c, but it is only written for niche applications (embedded DAQ boards, special purpose drivers, ...).

But learning c will give you a firm foundation for programming, and it is rarely profitable to argue with professors.

like image 64
dmckee --- ex-moderator kitten Avatar answered Oct 02 '22 20:10

dmckee --- ex-moderator kitten


Is C really used for a lot of Scientific Computing?

Scientific computing encompasses many different things and, consequently, many different programming languages are used for scientific computing.

Traditionally, scientific computing meant high performance computing and was limited in scope to mostly linear algebra and some spectral methods (e.g. FFTs) and was mostly done in Fortran. Since then, the breadth of scientific computing has expanded enormously with many people now considering technical computing (e.g. massing data, graph plotting, prototyping) falling under the same heading and other people picking up new forms of high performance computing such as symbolic computations.

Languages like Python, R, Mathematica and MATLAB are commonly used for technical computing. Languages like C, C++ and Fortran are still used for number crunching. Languages like OCaml are used for large-scale symbolic computation.

like image 37
J D Avatar answered Oct 02 '22 18:10

J D


I don't think that your professor's answer is serving you well even if it is correct.

In my experience as a consultant for scientific computing and data systems C is certainly used a lot, but so are Fortran and C++. Python is by far the most commonly used scripting language.

I think that this is going to change. The big deal now is parallel computing and this is painful (MPI anyone?) in the traditional languages I've mentioned. My speculation is that a lot of the parallelization will (and should) be moved to virtual machines: Java or .NET; i.e., I think that parallelization should be the JIT's job. Whether that will be enabled with, say, Fortress, or one one of the traditional languages, I don't know. Intel is pushing parallel tools for C/C++, but I wonder if something like Terracotta might better in the long run (I haven't heard of anyone in the scientific community who's tried it---big finance has, but they are not so open).

If the question is what should you learn to get a job in scientific computing, then the first thing I'd say is that you're more likely to get hired for your scientific skills than your programming skills (which partially explains the sorry state of a lot of scientific code, for more on this see this SO topic). If you are going to be hired for your programming skills (probably HPC), then consider that in the opinion of this professor, those may be obsolete for newer projects in the not-so-distant future. It wouldn't hurt to know some Python, though, including NumPy.

like image 34
Glenn Avatar answered Oct 02 '22 19:10

Glenn


From what I have heard Fortran is very common for scientific purposes, but C is general purpose enough that for some it is a good solution for most any type of programming.

like image 36
Gavin H Avatar answered Oct 02 '22 18:10

Gavin H


For bioinformatics and computational biology, C is very popular.

like image 24
wespiserA Avatar answered Oct 02 '22 20:10

wespiserA


A lot of "scientific computing" is handled in Mathematica, Matlab and other similar tools.

Well... under the hood, Matlab is written in C or C++, I think, but many parts of Mathematica are written in Mathematica itself. To be sure, for historical reasons, and also because C's intrinsic characteristics, many scientific and hi-tech computing software libraries and such are written in C/C++.

I suspect C/C++ will continue to enjoy a favorable edge for many real-time and high performance applications, maybe not so much for the raw computing itself (which can not be expressed in higher level languages), but for local optimization of tight loops, and for interfacing with various components, be they physical pieces of equipement, or software elements such as for example parallel computing frameworks.

As dmckee pointed out, the study of c provides a good foundation for programming at large, at least procedural programming. It also has practical applications, so your professor's opinion has some strong backing at this time. But, do! continue to challenge, respectfully, the wisdom received from your professors and elders, understanding that sometimes like good zen masters, they put you on a path, not so much for the destination but for the travel/process.

like image 25
mjv Avatar answered Oct 02 '22 18:10

mjv


C is widely-used in programming. Most of us programmer ever coding in C especially when we're at college. It's just your professor preference I guess :-)

like image 45
Ferry Meidianto Avatar answered Oct 02 '22 18:10

Ferry Meidianto


As a professional programmer building software for scientists and engineers I can say that nearly all our numerical methodologies are written in C. So in our case it certainly is true. We have pockets of C++ and Fortran. In terms of performance it is hard to beat well coded C and a good compiler. Very, very occasionally we might dip into assembly.

But the world has changed a lot. Python is a wonderful language - the nicest language IMHO and can call native libraries. Then there is R again a source interpreted language but with a massive library of numerical methods all compiled C or C++. Then add all the new hardware accelerated methods such as openCL and the many bindings... C or Fortran is no longer the only answer. But for traditional CPU number crunching C and ASM is the best in class.

like image 28
cdcdcd Avatar answered Oct 02 '22 18:10

cdcdcd