Choosing a programming language - physics

If I'm going to attempt creating computer programs for simulating theories as complicated as string theory, what language should I be looking at? I have some experience with C++, but if I'm going to devote a large part of my free time to learning a language, I'd like to learn something that will be specifically useful for what I need. I'm sure this question has probably been asked before, but I didn't find any search results. Thanks in advance.
 
644
1
Many of the physics type people i know, like matlab for most simulations. The best thing abt it (according to them) being that you dont have to waste time writing graphics packages. ( Otherwise ofcourse any general software development language like C/C++ or Java should help you, ofcourse the amount of effort will the relatively too much )

-- AI
 

PerennialII

Science Advisor
Gold Member
898
0
I concur with that, first do as much as possible scripting in packages such as Matlab, Mathematica - "next level" could be to use subroutine libraries and programming languages in conjunction with general packages such as those 2 above (it's pretty ease to interface stuff), before going all the way and writing from scratch with C++ or any other related language (and in this case picking code from libraries etc. is highly recommendable IMHO, for getting things done as much as getting them working properly - quite a bit of the really "serious software" seems to be written in C++, in "rough" computing fortran still prospers, but would recommend you'd just go deeper with C++ if you've a handle on it).
 
Thanks for the recommendations. I didn't realize C++ could be used in conjuction with Matlab/Mathematica - do you know of any sources out there that describe how to do it?
 
1,349
2
depends on what you want to do...if youw ant to simulate in Realtime 3D i don't think matlab can support that...I've been looking for a port from matlab to C++ and vice versa if you've found one can i have it...Matlab utilizes its interface to run doesn't it? How can you export an exe?

As for C/C++ it depends on what you want to do ..again if you want to do REALTIME 3D there are APIs out there for you to use OpenGL/Directx being the standards...also look into GLUT and SDL to maintain the active window...you could also use 3D (game) engines like Quakes/Unreal/Torque/Irrlicht/Ogre3D and it also depends on the methods you want to use for you scene management like BSPs/OCtrees/Particle mesh methods.

There are also numerical packages out there LAPACK(think this was for fortran) but there are others NIM i think was the acronym of one...but you shouhld still learn the basic techniques in numerical methods before moving onto the pacakges.
 

robphy

Science Advisor
Homework Helper
Insights Author
Gold Member
5,381
661
For symbolic and some numerical calculations, Maple and Mathematica are good.


If want a physics-friendly real-time 3D, with a minimal learning curve [and minimal programming overhead], try http://www.vpython.org.

Certainly, if you need higher-performance, you can prototype in python, then port to C/C++. (Python does have some scientific library packages [e.g. SciPy, Numerical Python] and some ways to interface to C/C++ [e.g. Boost Python].)

Oh, yeah.... Python and VPython are free and run on numerous platforms.
 
138
4
If you're doing stuff that requires a lot of numerical calculations, I suggest using classic FORTRAN (i.e. FORTRAN 70). It's not really good for more than basic math computation, but it works very fast and has some neat built-in distributive computing functions (to make use of those university clusters).
 
1,675
3
Use matlab to prototype. If you still need more speed or need to cross a platform,
FORTRAN and C are still the fastest. For numerical work with complex vairables
FORTRAN is better than C unless you prefer programming to physics.
 

PerennialII

Science Advisor
Gold Member
898
0
cyberdeathreaper said:
Thanks for the recommendations. I didn't realize C++ could be used in conjuction with Matlab/Mathematica - do you know of any sources out there that describe how to do it?
The Matlab external interfaces & compiler manuals are good sources (can view at mathwork site), containing the principles of interfacing with fortran, C and Java.
 

Related Threads for: Choosing a programming language - physics

  • Posted
Replies
11
Views
1K
  • Posted
Replies
7
Views
3K
  • Posted
Replies
22
Views
4K
Replies
10
Views
2K
Replies
18
Views
6K
  • Posted
Replies
2
Views
7K
  • Posted
2
Replies
33
Views
3K
  • Posted
Replies
2
Views
3K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top