GTRPy - A python package for General Relativity Related Calculations

Click For Summary

Discussion Overview

The discussion centers around GTRPy, a Python package designed for calculations related to General Relativity (GR). Participants explore its features, limitations, and potential improvements, focusing on its user interface, functionality, and comparison with other tools like Einsteinpy.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Arman introduces GTRPy as a user-friendly GUI application for calculating tensors in GR without coding, compatible with Linux and macOS.
  • Some participants inquire about the underlying technology, specifically whether GTRPy uses SymPy, and request examples of how to specify metrics and solve Einstein's equations.
  • Arman confirms that GTRPy uses SymPy but notes that it currently cannot handle variables in metrics as anything other than constants.
  • Participants express concerns about the limitations of GTRPy regarding the handling of nontrivial expressions and the need for symbolic differentiation.
  • Some participants compare GTRPy with Einsteinpy, suggesting that GTRPy may be more user-friendly and capable of performing field operations.
  • Arman acknowledges the feedback and expresses a willingness to consider adding features to improve functionality in future updates.

Areas of Agreement / Disagreement

Participants generally agree on the limitations of GTRPy regarding variable handling in metrics and the need for improvements. However, there is no consensus on the effectiveness of GTRPy compared to Einsteinpy, as some participants believe GTRPy has advantages while others may prefer Einsteinpy.

Contextual Notes

Limitations include the inability of GTRPy to interpret variables in the metric tensor as anything other than constants, which affects the calculation of solutions involving variable functions. The discussion also highlights the ongoing development of GTRPy and the potential for future enhancements.

Arman777
Insights Author
Gold Member
Messages
2,163
Reaction score
191
Hello, everyone

I am now working on this project quite a while now and I just wanted to share it with this forum, which I was a member for a long time. I am working on a python application about GR and I believe I managed to create a very user-friendly layout.

It's called GTRPy, and it allows you to calculate the well-known tensors in General Theory of Relativity without writing a single line of code. Furthermore, you can apply many operations to 6 different type of fields, in both 3D and 4D. It's a GUI application and works in Linux and macOS. If you want to try it out please check my signature or here is the link:

https://github.com/seVenVo1d/GTRPy

If you would like to contribute or make suggestion please feel free to do so.

Thanks,
Arman

PS: If this is not a good place to post this thread moderators can move my post...
 
  • Like
Likes   Reactions: haushofer, vanhees71 and Dale
Technology news on Phys.org
Arman777 said:
It's called GTRPy, and it allows you to calculate the well-known tensors in General Theory of Relativity without writing a single line of code. Furthermore, you can apply many operations to 6 different type of fields, in both 3D and 4D. It's a GUI application and works in Linux and macOS. If you want to try it out please check my signature or here is the link:

https://github.com/seVenVo1d/GTRPy
From a quick look at your github page, I'm guessing you use SymPy under the hood? Do you have any examples of how one could specify, say, the generic components of a spherically symmetric metric, and then solve the Einstein equations so that the Schwarzschild solution pops? What about other more complicated metrics?

I ask this because I've previously tried to use SymPy for GR-like tasks. It was ok for simple things, but choked when it encountered a seriously nontrivial expression. The "simplify" capabilities of all the symbolic math packages seem limited in this regard, alas, though I'd love to find one that would prove me wrong. :oldfrown:
 
  • Like
Likes   Reactions: Arman777 and vanhees71
strangerep said:
From a quick look at your github page, I'm guessing you use SymPy under the hood?
Yes indeed that is the case.

strangerep said:
Do you have any examples of how one could specify, say, the generic components of a spherically symmetric metric, and then solve the Einstein equations so that the Schwarzschild solution pops? What about other more complicated metrics?
The program sadly cannot perform that operation. The extra variables (variables other than the coordinate system) put in the metric is taken as constants and not as variables. This means that if you put any symbol other than the coordinate system, it will considered as a constant...Maybe I can change that in the future but currently that is the state.

However, if you give me the Schwarzschild Metric or any type of metric, that has constant parameters in it, it will calculate the Einstein Tensor correctly.

strangerep said:
I ask this because I've previously tried to use SymPy for GR-like tasks. It was ok for simple things, but choked when it encountered a seriously nontrivial expression. The "simplify" capabilities of all the symbolic math packages seem limited in this regard, alas, though I'd love to find one that would prove me wrong.
That was also a problem for me at the begining but I think I have managed to solve it by using simplify(nsimplify(xobject))

If you have an example that contains constant variables in the metric, and of course complex enough, I can show you the result and you can determine if the simplification process is good enough or not ?

PS: However, if you know somehow what that function is w.r.t ##(t, r, \theta, \phi)##, then you can put it inside the GTRPy and it will calculate the result correctly.

PS2: I will try to add that functionality to the GTRPy...Thanks for the feedback.
 
Last edited:
vanhees71 said:
How about Einsteinpy?
That is also a great tool. However, I think GTRPy is better in some regards w.r.t einsteinpy

1) GTRPy is GUI based and more user-friendly than einsteinpy
2) GTRPy can also perform field operations
 
Last edited:
  • Like
Likes   Reactions: vanhees71
Arman777 said:
The program sadly cannot perform that operation. The extra variables (variables other than the coordinate system) put in the metric is taken as constants and not as variables. This means that if you put any symbol other than the coordinate system, it will considered as a constant...Maybe I can change that in the future but currently that is the state.

However, if you give me the Schwarzschild Metric or any type of metric, that has constant parameters in it, it will calculate the Einstein Tensor correctly.
Let me clarify this statement a bit more...

The one important point in GTRPy is that the variables defined in the metric tensor **must be constant**. For example, you can write the Schwarzschild Coordinates System as


g = diag[-(1-r_s/r), (1-r_s/r)**(-1), r^2, r^2sin^2(theta)]

and that is totally fine for GTRPy, since ##r_s = 2GM/c^2## and that is a constant.
Let us suppose you have another variable called ##F(r)## which is a function of ##r##. And the metric is given as

g = diag[-1, F, r^2, r^2sin^2(theta)]

Sadly, the GTRPy will interpret this ##F## as a constant and not as a function of ##r##. So the result will be wrong. On the other hand, if you know what that function is, for instance if ##F(r) = r^3##, then you should write ##r^3## instead of ##F## and use the GTRPy in that way. So you should write the metric as


g = diag[-1, r^3, r^2, r^2sin^2(theta)]

and now, the GTRPy will work perfectly fine.
 
Arman777 said:
Sadly, the GTRPy will interpret this ##F## as a constant and not as a function of ##r##. So the result will be wrong. On the other hand, if you know what that function is, for instance if ##F(r) = r^3##, then you should write ##r^3## instead of ##F## and use the GTRPy in that way. So you should write the metric as
g = diag[-1, r^3, r^2, r^2sin^2(theta)]
and now, the GTRPy will work perfectly fine.
This is not much good if one wants to find solutions. I.e., write the function as ##F(r)## and have the system do the symbolic (partial!) derivatives correctly, then solve the coupled PDEs...
 
  • Like
Likes   Reactions: vanhees71, Arman777 and PeterDonis
strangerep said:
This is not much good if one wants to find solutions. I.e., write the function as ##F(r)## and have the system do the symbolic (partial!) derivatives correctly, then solve the coupled PDEs...
Fair enough :approve:

Indeed that Is the case. However, the program is still in the development process. I can probably implement a custom function support but I am not sure I can add solving coupled PDE’s. Maybe I can…

Feedback is very important for me and thanks for your sharing your thoughts.

PS: If I add such feature(s) I‘ll post an update.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 36 ·
2
Replies
36
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K