Is there a "standard" python package used to aid in physical simulations? What is the most popular?

edit: perhaps I should have worded this question differently. Something more to the effect:

Could someone provide an introduction to the common python related tools used in visualizing, stochastically, various motions that one might find in a mechanics course?


closed as primarily opinion-based by tpg2114, Kyle Kanos, John Rennie, Danu, Emilio Pisanty Oct 1 '14 at 10:35

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ There's way too many options to make this answerable depending on what kind of problem and how much you want to write on your own vs. use somebody elses code. $\endgroup$ – tpg2114 Sep 30 '14 at 23:39
  • 1
    $\begingroup$ Python is more used as a scripting language than a proper simulation language $\endgroup$ – Hydro Guy Sep 30 '14 at 23:40
  • 1
    $\begingroup$ @CuriousOne Not all implementations link against BLAS/LAPACK so they may not be using underlying-Fortran routines found in those libraries. I want to say that under certain matrix sizes, it always does those "in NumPy", ie. in Python, but for larger sizes, if the implementation was linked against BLAS/LAPACK, it will farm it out to those libraries. So I think it all depends on whose installation you use and on what systems. $\endgroup$ – tpg2114 Oct 1 '14 at 0:44
  • 1
    $\begingroup$ @CuriousOne FWIW, we've found the same kind of issue with BLAS and Fortran (using the built-in functions and writing our own): stackoverflow.com/questions/12924573/… $\endgroup$ – tpg2114 Oct 1 '14 at 0:46
  • 1
    $\begingroup$ @user3465201 - That's still very vague. What level mechanics class -- introductory, upper level undergraduate, or the graduate level? Presumably it's not the introductory level class; those problems are designed to be solved by hand. That means your question encompasses everything from finite element analysis to a model of a supernova to N-body simulations, both large and small, both colliding and non-colliding, plus a whole lot more. $\endgroup$ – David Hammen Oct 1 '14 at 3:57

Almost all of the comments are valuable.

I think that a consensus is building (probably better: has been built) that the standard base system for science use is the numpy/scipy/matplotlib stack. But there are packages that don't build on that stack. I'm afraid you'll have to do some digging to see which packages will work for you.

There are many many many packages that build on the numpy/scipy/matplotlib stack. There are also many packages for more specialized tasks, such as dealing with large data sets, or inhomogeneous data sets. And packages for specific scientific fields, astronomy for example.

So you see it's hard to give a straightforward answer.

But one very important package that is extremely useful for adding visualization to a simulation is VPython ("3D Programming for Ordinary Mortals"). I would strongly encourage you to take a serious look at it.

There are also several "batteries included" meta-packages that greatly simplify the installation of python for scientists. One is Anaconda, another is PythonXY, another is Enthought Canopy. And, again, there are others.

I think you will have to take a look at what's out there, choose things that looks sensible to you, and start working with them. My apologies to the many many packages that I haven't mentioned.

  • $\begingroup$ I just visualize using MayaVi or ParaView if I need something more complicated than MatplotLib. Those are really easy to use if you are already using VTK to store data, but it's pretty easy to use regular NumPy with it too. $\endgroup$ – tpg2114 Oct 1 '14 at 3:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.