- #1

- 223

- 2

Anybody able to help me out one way or the other?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter StatMechGuy
- Start date

- #1

- 223

- 2

Anybody able to help me out one way or the other?

- #2

- 1,629

- 1

I've never used Python but I also heard its great for scientific computing

- #3

- 1,250

- 2

There are two cases, either speed and memory are important, or not. If you care about speed, then consider FORTRAN 77. This is the fastest 'high-level language', and although it has been supplanted by C, this is only because C traded performance for readibility, viz. the programming industry realized the enormity of the task of using old code, and suddenly readibility became a priority.

C was designed as a systems programming language (UNIX), but FORTRAN was designed as a scientific language. The only reason C is more readable (on an industrial scale) than FORTRAN is because it supports abstraction at a higher level. For the individual who is not designing a massive end-user program, FORTRAN is easier and faster to write then C.

In my work it is almost always the case that human time is more important than machine time, which is why I use and recomend Mathematica. Mathematica is a universal programming language, just like C or Python (although Mathematica is proprietary). The difference is that it contains, in an integrated way, the world's largest library for scientific computing, containing all the best of known algorithms as well as some that are not known outside of Wolfram Research. The other difference is that is 1000 times slower than C (not as bad as it sounds, because in fact the limiting factor always has to do with the size of the problem and multiplication by even such a large constant is not too terrible in most cases).

Unless your intended tasks are very basic to program (for example solving a particular differential equation for a variety of conditions using the same method ). If instead your work involves considerable variety, and in addition you want to consider visualizations of the data, Mathematica would be an excellent choice.

- #4

Dr Transport

Science Advisor

Gold Member

- 2,485

- 608

- #5

- 905

- 4

Anybody able to help me out one way or the other?

Perhaps you could go with C, because more people like me (i.e. undergrad and grad students) know it.

- #6

- 14

- 0

That being said, C is the standard for most purposes so it should be learned first. In addition, FORTRAN would be useful as there are many tasks for which it is better suited (ie formula translation ). I would also advise avoiding C++ as it introduced the object oriented paradigm, which is just another way to write code that is slow { for example, I was trying to find a solid random number generator for a stochastic simulator over the summer. I ran accross the Mersenne twister in c++ and gave it a shot. With the number of random numbers I was generating (on the order of millions) the object oriented inheritance garbage was two orders of magnitude slower than the Miller-Parks bit shifting algorithm in straight C }.

I'm not sure of the specifics on Python, but I believe you should first learn to program in C, and then once you know how to

- #7

- 14

- 0

- #8

- 333

- 0

Programs like Maple, Mathematica, and Matlab are great at solving integrals, but I think learning to use a stand alone language like C or Java to do the same, will further your knowledge of those math skills, and it will be a great skill for almost any career in science

- #9

- 344

- 3

Are you going to be numerically solving equations? Will you end up working with large matrices? Are you performing simulations? Monte carlo work? The computing needs of your research will dictate the best programming language for you to use. All of the suggestions provided are good choices, but some work better for particular types of problems than others.

And remember, speed doesn't come just from the language. Proper coding and good algorithms play a huge role in how fast a program will run. Sloppy coding can make a compiled C program run god-awfully slow.

- #10

Dr Transport

Science Advisor

Gold Member

- 2,485

- 608

I have to strongly urge you to avoid programming in MATLAB. It is interpreted, and therefore by its very nature slow. The notation is clunky and difficult to use and my experience has been that matlab is not worth the hassle. Moreover, if you ever have the need to program in parallel, MATLAB is utter garbage as the licensing is such that you would need one copy of matlab for each processor... yeah try to get 128 licences of matlab to run a monster program on a cluster - RIGHT.

Running Matlab on a parallel cluster is a mess, I will agree. Now, if the program is garbage then why are there many, mant users in academia, industry and the govt using it??? You can compile the code to run faster and I have seen Matlab code run faster than compiled C code because you do not have to run loops, it is already optimized to run in matrix and vector form.

This thread asked what one could use to program and I now almost as many peole who used Matlab for their dissertation work as Fortran or C and Matlab has built-in library functions whereas C and Fortran these routines either need to be imported, written from scratch or purchased which makes it a viable option.

- #11

Hurkyl

Staff Emeritus

Science Advisor

Gold Member

- 14,916

- 19

If your program is doing "normal" things, such as thousands of saxpys on large matrices and vectors, then your program spends almost all of its time in the highly-optimized saxpy routine and almost no time in the interpreter... so the interpreter vs. compiled distinction is irrelevant.

But if you are doing something "abnormal" and have to explicitly do an operation for every entry in your vector, then you need to use a compiled language, because otherwise you have to go back to the interpreter after every little operation and your program slows to a crawl.

On C++:

C++ is actually an excellent language for numerics, if you are using a (good) library written for numeric computation. (Blitz++, for example) The template mechanism is an

- #12

- 1,629

- 1

- #13

- 261

- 1

- #14

- 727

- 1

Otherwise, C is excellent.

- #15

- 52

- 0

Although, not the best for your needs or for learning, I use LISP for just about everything now. Plus, it makes a nifty and quick calculator when writing a paper in emacs. Sorry, I just have to promote LISP when I can. If I was in your position I would probably go with C or PYTHON.

- #16

- 1,250

- 2

In the 1970s, when scientists abandoned FORTRAN for C, their primary motivation was to go with open source (C) vs proprietary (FORTRAN, owned by IBM, comparable to working in microsoft's C# these days).

Speed => FORTRAN

Anything else => Mathematica

The problem with Maple and Matlab is that they really are just watered down C with libraries and pretty printing. Mathematica is, as a language, mile,s ahead of C, Lisp, Python etc. Mathematica is a functional language, in a more complete way then LISP (which was always too decentralized), and it is such a beautiful paradigm for programming: Everything is composition of functions! Given the input, you apply a sequence of functions to produce the output.

Share: