Programming and Physics. How do I start?

1. Aug 11, 2011

zsk786

I have been programming for quite awhile, but never extensively studied it. I took a AP Computer Science course that was taught in Java (Passed with a 5). I have known Java since 9th grade (4 years as of now). I learned Fortran 90 at Governors School for computational physics. I did a little C programming for a Best Robotics competition. And I have played around with python. I had a job doing so some basic Android Programming and iOS Programming.

So I know the basics of programming, but I am not well versed in any language. And my knowledge is basically in writing code. I am not very good at programming. I have not done anything different or worth notice.

I want to be a physicist. So I was wondering what tools should I use or what language I should focus on.

I contacted a professor in the college I will be going to in a few days and he said that I can join his research group. He told me to research Ising Models and start writing basic code to model ferrofluids (2-d mostly, 3-d if i can get to it).

I was thinking of either python or fortran, but not sure what version of the languages to go with. (Fortran 95? Python 3?)

So tools wise, I was wondering what compilers to use (especially if fortran is the option)

Also what text editor is considered to be the must have (I have been looking at notepad++)

I have a copy ITT's IDL, but have yet to use it.

Also I may need software to make graphical representation of my data (assumption)

and any other tools you guys can think of.

Last edited: Aug 11, 2011
2. Aug 11, 2011

chiro

Hey zsk786 and welcome to the forums.

From your post you have written code in a variety of environments which is very good.

In terms of things like compilers, IDE's, and so on, that is often a personal thing that is different among different groups of people. Some people still like using old DOS/Unix/Linux style terminal windows (command prompts/shells) and setup batch files/scripts/etc to do the compilation, whereas others like an integrated IDE to do everything (compile/debug/syntax highlight/etc). In terms of this, my opinion is that "it doesn't matter". As long as there is not a noticeable difference in getting stuff done, then why should it matter?

One question I have for you to help answer your question is, what platform/environment is used for your current problems?

The thing is most code starts from a few routines and then ends up becoming a library and slowly, a platform. You always have a platform. The way I define platform is basically all the tools, libraries, existing code, and development environments that are used. It might something as simple as QBASIC, or it might be thousands of lines of code in FORTRAN/C/C++ integrated with some kind of JIT (Just in time) systems complete with script execution and other fancy stuff.

In terms of becoming a better programmer, just do what you do in other fields: get your hands dirty, keep up with developments in the field, and see what is out there.

One piece of advice I would also give is to see how complex platforms are structured and how code is written in them. Obviously open source projects can be your friend, but if you ever get a chance to see some really complex commercial type platforms, then take the opportunity to learn them. I have done some work in the past with repositories including the "Unreal Engine" for games, and it was a great learning experience working with that code base.

3. Aug 11, 2011

twofish-quant

Usually you should use whatever is available. If you want a job in industry, you'll have to be proficient with C++, but that shouldn't be too bad if you have fortran/java experience.

Fortran 95 is pretty standard. Python 3 is probably a bad idea since a lot of libraries haven't been ported over.

I prefer gfortran since it is free-ware. I've been told that intel fortran is faster, but gfortran is "good enough." Also if your fortran program depends on a compiler, you need to rewrite.

Whatever you like.

matplotlib.

On other thing. Try to avoid writing original code. For your ising model problem google first to see if someone else has already written code under a freeware license and use that. One problem that physicists have is that invariably they are used to writing things from scratch when in most industrial situations, you are modifying/debugging/changing someone else's code.

It turns out to be *harder* in a lot of situations to use someone else's code than to do a clean rewrite, because you spend your time trying to figure out what the @#$@#$@ is going on, but that's educational. One thing that will teach you to be a good programmer is to read bad programming.

4. Aug 11, 2011

zsk786

To answer your question at the moment I run windows 7 and user eclipse for my Java programming. For python I use their software. Every now and then I will use notepad++ when I am editing several files at once. I haven't programmed in Fortran in awhile, but when I had I did so on Ubuntu, don't remember what compiler I used.

I really appreciate what you wrote. It got me pumped up :) . Thank you for the advice, I feel like it was exactly what I need to here.

I know that this may be a very hard question to answer since you don't exactly know what I want to do. But, do you have any suggestions on open source software that I should look at, any thing that you have found that is worth looking over?

It is really amazing that you have developed with the Unreal Engine. You must really know your stuff :)

5. Aug 11, 2011

twofish-quant

Start here

http://light.asiaa.sinica.edu.tw/~tseng/astronomical_simulation.html [Broken]

The good thing about a lot of the software on that list and a lot of software that exists on the internet is that these are real live production code that is being used to write papers with.

One thing that I like about computational science is that if you spend a decade building a particle accelerator, you have a particle accelerator. If you spend a decade building a production grade hydrodynamic code, you can just put it on the internet and let anyone copy it.

http://www.netpurgatory.com/zeusmp.html

Last edited by a moderator: May 5, 2017
6. Aug 11, 2011

chiro

With regards to this, this is one area where I can't give advice.

I am familiar with certain domains, like game development and certain simulation platforms. I am not a physicist or engineer so I have no idea what kind of platforms are out there to address these applications.

It's probably best if you ask other physicists and engineers for specific platforms.

One thing I should advise you is if you ever get a platform that is fairly complex and has been in development for a fairly long time, take some time to look at the overall design and how components connect to other components.

For example the problem of creating a system where you can create extensions in both the code and data without having to re-engineer the base executable is a common one. I've found the best way to solve this kind of thing is to have something like XML, where you can create any data element with any name (or id) and along with that create a piece of code that handles processing of data for that specific element. So with the right architecture you have created a data processing pipeline that doesn't need to be modified and external (or otherwise) developers can simply create DLL's or other executable objects that implement processing for new token types. The advantages are that the base executable stays the same, new additions through the use of new tokens don't affect old implementations of data definitions, since the pipeline just ignores the new definitions, and through this you can implement other features like using policies on data objects (example you have to add token types to a trusted list so that you don't get extensions that don't work or do bad things to your computer), and with a few other nifty things you can create a whole plugin system. So as you can see, one architectural implementation allows you to create scalable software where it is easy to extend, and also where its easy to control things like security.

There are tonnes of examples like this that end up making their way into large, reliable, and professional code repositories. They are somewhat necessary as the complexity of the code grows, and creating the right extensions outside of the code base becomes more important.

7. Aug 11, 2011

Lavabug

Python with some extra library does very well for some of my classmates (I'm fairly ignorant of programming as of today). I like the program Origin. Its about straightforward to use as Excel for basic data plotting and fitting, and it can do a whole lot more stuff as well. Its very easy to make pro-looking graphs with it.

8. Aug 12, 2011

zsk786

Thank you for replies, they really helped me a great deal