- #1
Frion
- 30
- 0
Other than C++, which is obvious, and MATLAB, which is unavoidable.
hamsa0 said:Excuse me for asking, but why is C++ obvious? Or even fortran?
Frion said:I did sort-of forget Fortran. Is it still used much?
Also, two of you recommended Python. Why? Wouldn't Python be unsuited for numerical work because it's an interpreted language?
I mean 'obvious' in the sense that if there's serious programming to be done, C/C++ is just going to show up.
The big thing is not trying to compile python, but that python mixes well with C. Packages like NumPy provide convenient python objects that, when manipulated, invoke C functions.B-80 said:Python is really not that much slower than C, especially when it's compiled, it's more than sufficient for most purposes.
bcrowell said:Learning programming language A versus programming language B is the kind of thing you worry about if you're getting a certificate from a trade school.
Frion said:Other than C++, which is obvious, and MATLAB, which is unavoidable.
sfs01 said:For any numerical applications that really need a lot of performance, C/C++ is going to be the choice. But not because it is intrinsically faster (modern higher level languages such as Java, Python, C# etc. are just as fast for all practical purposes nowadays and are much easier to work with)
For most applications your normal PC is fast enough though, so something like Python is perfectly fine.
If you want to become good at programming though, I'd recommend also looking into at least one functional programming language (such as Scala, Erlang, Scheme, Haskell, Ocaml etc.) to familiarise yourself with the concept. They have a completely different (more mathematical, ironically) way of looking at programming that will also change the way you look at writing programs in imperative languages afterwards. Admittedly, they are currently only used for numerical applications in niche areas though, so are of limited direct use at present.
That's because it was (copyright 1996 - 1998)sfs01 said:... (the article comparing fortran vs. C above sounded like it was written 10+ years ago, in the meantime a lot has happened in the field of computing).
Ryker said:That's because it was (copyright 1996 - 1998)
fluidistic said:And so what?...
For a physics major I think Fortran is enough, i.e. will do the job you need to do and will do it great. Since it's simpler than C/C++, why bother learning these languages that might help you almost only if you physics related computing?
The OP asked for a physics major, not a computer science major in which case the answer would have been different. I'd still stick to Fortran for the mentioned reasons.
If I was on the route to be a statistician I'd learn R instead of C simply because it could do my job very well, despite "C being/getting more popular" in many areas including being used each time more by mathematicians.
fluidistic said:And so what?...
For a physics major I think Fortran is enough, i.e. will do the job you need to do and will do it great. Since it's simpler than C/C++, why bother learning these languages that might help you almost only if you physics related computing?
The OP asked for a physics major, not a computer science major in which case the answer would have been different.
anonymity said:How useful is java compared to c/c++, aside from the fact that java is based on c and would therefore make learning c very easy
zif. said:It's also something that only people that don't already know how to program worry about.
Once you get one language under your belt, you realize that they're pretty much all the same. That and that you can pick up enough of a new one to be useful over a weekend.
So basically Fortran wouldn't be a good choice because soon or later you'll be confronted to its limitations where C can do the job?twofish-quant said:Because any large scale physics code nowadays can contain 300K lines of code, and if you don't use modern OOP techniques, you end up with something that is unmaintainable. Also there are things that you can do with C++ that you just can't do with Fortran. Look at boost::math. Instead of hand coding the algorithms what you do is you use templates to set up a specification of the algorithm and then you let the compiler do metaprogramming magic.
If you are writing a 200 line routine, you can write it in any language. But modern computational physics involves maintain code that contains several hundred thousand lines of code.
Any non-trivial physics computational research involves lots of CS skills. That's why physicists get hired as programmers.
fluidistic said:So basically Fortran wouldn't be a good choice because soon or later you'll be confronted to its limitations where C can do the job?
Just curious if this overweight the fact that Fortran is simpler to learn than C.
That seems to be the way scientific programming has gone over the past decade. I see more programming mixing Python/C++/Fortran. On a recent project, we were told that the preference was for C++ over Fortran.twofish-quant said:You shouldn't choose. Any nontrivial code is going to have multiple languages, and for computational physics, you will have to be a competent programmer in C++/C/Fortran/Python, and know how to mix all of the code together.
It's not really. If you want to learn all of Fortran 95 including the object syntax, you will have do spend as much time as you would learning the same thing in C++ or Java,
The most commonly used programming language in physics is Python. It is a versatile language that is easy to learn and has a wide range of libraries and tools that are useful for scientific computing and data analysis.
Physics majors need to learn programming in order to perform complex calculations, analyze data, and create simulations. It is an essential tool for modern scientific research and allows for automation and increased efficiency in data analysis.
Yes, there are several other programming languages that are useful for physics majors. Some examples include C++, MATLAB, and Fortran. Each language has its own strengths and is used for different purposes in physics research.
Learning programming can benefit a physics major's career by making them more marketable to potential employers. It also allows for greater flexibility in the types of jobs they can pursue, such as data analysis or software development roles.
No, it is not necessary for a physics major to have prior programming experience before starting their degree. However, having some basic knowledge of programming can make it easier to learn more advanced concepts and apply them to physics problems.