Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is the best way to build a physics simulation

  1. Jan 24, 2015 #1

    I know a bit of programming, python, C and I tried once the processing language.
    I'd like to make, sometimes, some simulation on mechanics, with gravity, collisions, springs, ecc...

    But I have not very much time to spend in creating these things (supposing I could), so I would like to know if there some tool, software or library to quickly set up a simulation (I'm on Windows).

    Thank you.
  2. jcsd
  3. Jan 24, 2015 #2


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

  4. Jan 31, 2015 #3


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    If you can afford them, MATLAB and Simulink are widely used for simulations in Engineering. There is a forum here for those types of programs (see "Math and Science Software" under "Computing and Technology") MATLAB is a script language and Simulink is a diagramming tool to make signal-flow diagrams and run them in time simulations. Both have extensive libraries to support areas of application.
  5. Feb 2, 2015 #4
  6. Mar 2, 2015 #5
    Depends on your level of fidelity. If you want something somewhat accurate, you can try gaming physics engines. They run off of the same basic physics principles and they're often quick. The problem is that games only have to look and feel right, not be physically correct.

    Matlab and Simulink are good options as well, but they're not too fast and it's harder to do something freeform. Plus, if you're doing any kind of involved programming, you'll hate Matlab's language. It's a good script language, but not for libraries or any hard development.

    A good finite element analysis package will get all the forces and things right, but it's very expensive and time-consuming. As well, you'd probably find it hard to create an accurate model (although the solver is really good about getting the solution to the model).
  7. Mar 2, 2015 #6
    I am paying attention to this thread, its something I've been wondering too. The sagemath/scipy/numpy suit has a lot built in, but for custom stuff its so slow when you can't use the wrapped C libraries. What I have done with Open CL is fantastic in speed, but limited. I've actually seen some good stuff in webgl:
    But again, its really written for graphics. Writing for parallel execution is just hard for some things, but I don't have an nvidia card and I've heard really good things about their scientific computing library in Cuda.
    I've been messing with it for a long time though, and I seriously think the best advice I could give is to really delve what MATLAB and Wolfram's software have to offer, save up and buy what you need. Its just not there yet in the open source community: The good programmers didn't major in physics and the good physicists didn't major in programming.
  8. Mar 2, 2015 #7
    I like OpenCL's capabilities. I've been waiting for ArrayFire to catch up with what Accelereyes developed for Matlab's Parallel Computing Toolbox. I guess Mathworks bought all the "nice code" and now the community is going to have to rebuild it.

    It's true that there's not a great open-source community for scientific computing, but most of the time it's about money. There are very few people that study these hard subjects that have enough spare time and energy to want to develop cool libraries and NOT get paid for it.
  9. Mar 2, 2015 #8
    Yeah, good point. The other thing is its multi-disciplinary in a way other FOSS projects are not. If you have the programming skills, and you find something wrong in Firefox, you fix it, because you know how a browser should act. But I have found clear errors in Sagemath and watched them sit there for years, because its unclear if what appears to be a fix is truly mathematically correct, or if they integrate into the "Symbolic Ring" in the right way... I just don't have the math chops to know for sure. I'm sure its the same for physics software. Of course in a company you just ask the physicist/mathematician down the hall and work it out.

    Thanks for letting me know about ArrayFire, I hadn't seen that.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook