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

Is it possible to simulate gravitational waves using python?

  1. Oct 15, 2014 #1
    Hello all,

    Well, I am on my master project named 'General Relativity & Gravitational Waves'. My supervisor asked me if you can simulate gravitational waves by programming it would be a plus. But only programming language I am currently learning is python. Is it possible to simulate some kind of simple simulation using this programming language?

    Thanks in advance!
     
  2. jcsd
  3. Oct 15, 2014 #2

    phinds

    User Avatar
    Gold Member
    2016 Award

    Any programming language can do anything that any other programming language can do so it is not a question of whether or not it can be done in Python, assuming it can be done in any computer language, it is just a matter of how difficult it might be. Some languages are more suited to particular tasks than others. All languages can do all things that others can do but not necessarily as well or as easily.
     
  4. Oct 15, 2014 #3

    A.T.

    User Avatar
    Science Advisor
    Gold Member

    It's possible. But it won't be efficient if you do it all in python code. For faster computing you should look into specialized python packages, like those bundled here:
    http://www.scipy.org/
     
  5. Oct 15, 2014 #4

    Haelfix

    User Avatar
    Science Advisor

    Might I suggest that you take the plunge, and use this opportunity to learn Mathematica.

    You will actually save time, you will need to learn how to use a package like this eventually anyway and you won't have to rewrite the wheel so it will probably be faster anyway.

    Having said that, if you really want to Python is perfectly capable of simulating almost anything you want to do. It's not terribly efficient, but laptop computers are so fast nowdays that unless you are really writing a graduate level program with lots of moving parts and where accuracy is tantamount, it just won't make a difference what language you code in.
     
  6. Oct 16, 2014 #5

    e.bar.goum

    User Avatar
    Science Advisor
    Education Advisor

    Mathematica is great, I love it unreasonably, but I wouldn't say it was better than python for simulations like this.

    If you're worried about efficiency, Mathematica isn't really the way to go. Neither is python, to be frank, but Mathematica is way slower than python is. If you're worried about speed, go for fortran or C++. If you keep going with physics, it's likely you'll have to learn one or the other anyway (over learning Mathematica).
     
  7. Oct 16, 2014 #6

    bapowell

    User Avatar
    Science Advisor

    Look into the GNU Scientific Library (GSL) if you ever end up using C/C++ for these kinds of projects.
     
  8. Oct 16, 2014 #7

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    As others have mentioned, although pure Python isn't very fast, there are libraries (like NumPy, SciPy, etc...) that should be used. (I like VPython for simple real-time visualization.)

    If you are comfortable with Python and you want to try something similar, you might find MATLAB a good alternative. [NumPy has features modeled after MATLAB.] (Like Mathematica, MATLAB isn't free... although your school might have a site license.. and student versions are relatively-inexpensive compared to the full "professional" versions.)

    If you need symbolic calculations, Mathematica and Maple would be my choice.

    In my experience, one might need a variety of tools... symbolic, fast calculation, good presentation graphics, real-time animation, [and ease of use]... You could learn to interface the different tools. Python (or Perl), as a scripting language, could be a good glue to do this interfacing, as well as being a computational tool [when supplied with appropriate libraries].
     
  9. Oct 17, 2014 #8
    You might want to look at PYPY http://pypy.org/
    I have used it in n-body and black hole orbit simulations. It takes Python from 1/20th the speed of Java to about the same in my experience.
     
  10. Oct 17, 2014 #9

    PAllen

    User Avatar
    Science Advisor
    Gold Member

    How much gravitational radiation is produced by a reticulated python?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Is it possible to simulate gravitational waves using python?
  1. Gravitational waves (Replies: 2)

  2. Gravitational waves (Replies: 3)

  3. Gravitational Waves (Replies: 15)

Loading...