Is it possible to simulate gravitational waves using python?

Click For Summary

Discussion Overview

The discussion revolves around the feasibility of simulating gravitational waves using Python, particularly in the context of a master's project on General Relativity and Gravitational Waves. Participants explore various programming languages and tools that could be utilized for such simulations, including considerations of efficiency and ease of use.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about the possibility of simulating gravitational waves using Python, emphasizing their current learning in the language.
  • Another participant asserts that any programming language can accomplish the task, but notes that some languages may be more suited for specific tasks than others.
  • It is suggested that while Python can be used for simulations, it may not be efficient without specialized libraries, and references are made to packages like SciPy.
  • Some participants recommend considering Mathematica for its efficiency and ease of use, although there are differing opinions on its superiority compared to Python.
  • Concerns are raised about the efficiency of both Python and Mathematica, with suggestions to consider Fortran or C++ for better performance in computationally intensive tasks.
  • Participants mention the GNU Scientific Library (GSL) for those who might use C/C++ in their projects.
  • There is a discussion about the utility of various libraries in Python, such as NumPy and SciPy, and the potential for using MATLAB as an alternative.
  • One participant shares their experience with PYPY, claiming it significantly improves the speed of Python simulations.
  • A humorous off-topic question is posed about gravitational radiation produced by a reticulated python.

Areas of Agreement / Disagreement

Participants express a range of opinions on the efficiency and suitability of different programming languages and tools for simulating gravitational waves. There is no clear consensus on the best approach, with multiple competing views remaining on the effectiveness of Python, Mathematica, and other languages.

Contextual Notes

Participants highlight the importance of using appropriate libraries for Python to enhance performance, but there is uncertainty regarding the efficiency of various tools and languages for specific simulation tasks.

physicsfreak88
Messages
8
Reaction score
0
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!
 
Technology news on Phys.org
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.
 
  • Like
Likes   Reactions: Soukaina so
physicsfreak88 said:
Is it possible to simulate some kind of simple simulation using this programming language?
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/
 
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.
 
Haelfix said:
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.

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).
 
Look into the GNU Scientific Library (GSL) if you ever end up using C/C++ for these kinds of projects.
 
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].
 
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.
 
How much gravitational radiation is produced by a reticulated python?
 

Similar threads

Replies
6
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
Replies
5
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 43 ·
2
Replies
43
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K