Choosing a programming language - physics

Click For Summary

Discussion Overview

The discussion revolves around selecting a programming language suitable for simulating complex theories in physics, particularly string theory. Participants explore various languages and tools, considering their applications in numerical simulations, real-time 3D graphics, and symbolic calculations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant suggests C++ for its capabilities but expresses a desire to learn a language that is specifically useful for physics simulations.
  • Another participant mentions that many in the physics community prefer MATLAB for simulations due to its ease of use, particularly for graphics.
  • Some participants recommend starting with high-level scripting in MATLAB or Mathematica before moving to lower-level programming with C++ or Fortran.
  • There is a discussion about the limitations of MATLAB for real-time 3D simulations, with suggestions to explore C++ and various APIs like OpenGL and DirectX for such applications.
  • One participant highlights the speed of classic FORTRAN for numerical calculations and its utility in distributed computing environments.
  • Python and VPython are proposed as user-friendly options for real-time 3D simulations, with mentions of scientific libraries available in Python.
  • Several participants discuss the potential for interfacing C++ with MATLAB and Mathematica, with requests for resources on how to achieve this.

Areas of Agreement / Disagreement

Participants express a range of opinions on the best programming language for physics simulations, with no clear consensus on a single preferred language. Different use cases and requirements lead to competing views on the suitability of MATLAB, C++, Python, and FORTRAN.

Contextual Notes

Participants note various limitations, such as the need for real-time capabilities, the complexity of interfacing different languages, and the specific requirements of numerical versus symbolic calculations.

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.
 

Similar threads

Replies
17
Views
2K
  • · Replies 44 ·
2
Replies
44
Views
6K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
86
Views
3K
  • · Replies 23 ·
Replies
23
Views
8K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
18
Views
10K