Programming and Physics. How do I start?

In summary: Get into a project and start coding. Don't worry about what language it is in, or what tools are available. Just start coding and see what comes out. That is the best way to learn.
  • #1
zsk786
7
0
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.

Thanks for any help you guys can give.
 
Last edited:
Technology news on Phys.org
  • #2
zsk786 said:
I have been programming for quite awhile, but never got 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.

Thanks for any help you guys can give.

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 your questions about tools (and your other questions), the above question will help you answer that.

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
zsk786 said:
I want to be a physicist. So I was wondering what tools should I use or what language I should focus on.

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.

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

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

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

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.

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

Whatever you like.

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

matplotlib.

Thanks for any help you guys can give.

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
chiro said:
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 your questions about tools (and your other questions), the above question will help you answer that.

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.

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
zsk786 said:
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?

Start here

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

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:
  • #6
zsk786 said:
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?

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
zsk786 said:
Also I may need software to make graphical representation of my data (assumption)

and any other tools you guys can think of.

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
Thank you for replies, they really helped me a great deal
 

Related to Programming and Physics. How do I start?

1. What is the relationship between programming and physics?

The relationship between programming and physics is that programming can be used to simulate and model physical phenomena. Programming allows us to create algorithms and equations that can be used to predict and analyze the behavior of physical systems. In addition, programming is also used to control and collect data from experiments in physics.

2. How can I apply programming to physics?

There are many ways to apply programming to physics. Some examples include creating simulations of physical systems, analyzing data from experiments, and developing algorithms to solve complex equations. Programming can also be used to create visualizations and animations to help understand and visualize physical concepts.

3. Do I need to be an expert in both programming and physics to use programming in physics?

No, you do not need to be an expert in both programming and physics to use programming in physics. However, having a basic understanding of both can be helpful. It is more important to have a strong foundation in either programming or physics and be willing to learn and apply concepts from the other field.

4. What programming languages are commonly used in physics?

There are a few programming languages that are commonly used in physics, such as Python, MATLAB, and C++. These languages are popular because they have libraries and tools specifically designed for scientific and numerical computing. However, any programming language can be used in physics as long as it has the necessary capabilities and libraries.

5. How do I get started with programming in physics?

The best way to get started with programming in physics is to first have a basic understanding of programming concepts and then start applying them to physics problems. You can also find online resources and tutorials that specifically focus on programming in physics. It is also helpful to have a specific project or goal in mind to guide your learning and practice.

Similar threads

  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
12
Replies
397
Views
14K
  • Programming and Computer Science
Replies
1
Views
759
  • Programming and Computer Science
Replies
8
Views
943
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
7
Views
726
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
4
Views
748
Back
Top