Choosing a programming language - physics

AI Thread Summary
For simulating complex theories like string theory, MATLAB and Mathematica are recommended for their ease of use and built-in graphics capabilities, allowing for quick prototyping without extensive programming. C++ is also a solid choice for serious software development, especially when combined with libraries and packages like LAPACK for numerical computations. For real-time 3D simulations, APIs such as OpenGL and DirectX are essential, along with game engines like Unreal or Ogre3D. Python, particularly with libraries like SciPy and VPython, offers a user-friendly option for physics simulations and can be used for prototyping before transitioning to C/C++ for performance. Classic FORTRAN remains a strong choice for numerical calculations due to its speed and efficiency, especially in academic settings. Resources for interfacing C++ with MATLAB can be found in the MATLAB external interfaces and compiler manuals on the MathWorks website.
cyberdeathreaper
Messages
46
Reaction score
0
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.
 
Computer science news on Phys.org
Many of the physics type people i know, like MATLAB for most simulations. The best thing abt it (according to them) being that you don't 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
 
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?
 
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.
 
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.
 
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).
 
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.
 
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.
 
Back
Top