A Tensorial calculations - Best computational Language

Click For Summary
The discussion focuses on the best computational language for performing tensorial calculations, particularly for deriving the Riemann/Ricci Tensor and Ricci Scalar from a given metric in spherical coordinates. Users recommend various tools, with Maxima and Python's SymPy library being highlighted for their capabilities in symbolic mathematics, though concerns about Python's base functionality are noted. Jupyter Lab is suggested as the preferred environment for using SymPy due to its enhanced features over Jupyter Notebook. Participants share their experiences with these tools, emphasizing the importance of investing time to learn their functionalities. Ultimately, the conversation underscores the need for effective tools to facilitate tensor calculations in a limited timeframe.
  • #31
strangerep said:
.g., suppose you didn't know the Schwarzschild metric and are trying to find it. Can you make the Einstein equations reduce down to a set of differential equations that's fairly easy to solve?
Well, for simple equations, maybe the computer can solve some problems...or I can pre-upload some solutions and metrics, etc.
strangerep said:
If so, then improve your code to handle non-diagonal metrics (you'll need to use a matrix inverse function somehow to get the inverse metric). Can you set up the Einstein equations for a general axi-symmetric metric, and simplify it down to a set of DEs that can be solved to find the Kerr metric?
strangerep said:
like simplifying the Einstein equations to get a mangeable set of DEs)
I have never tried that thing, but maybe it's due to problems of the sympy. Sadly it seems that the sympy does not have enough power to simplify expressions as Mathematica. So even simple terms remain complicated due to this issue, which I have encountered.

I updated my code (https://github.com/seVenVo1d/General-Relativity-Tensor-Calculations/blob/main/GR_tensorial_cal_v2.ipynb) and add Weyl Tensor Einstein Tensor, and also two forms of the Riemannian Tensor (##R^{\alpha}_{\beta \gamma \nu}, R_{\alpha \beta \gamma \nu}##).

I was thinking of including index lowering and raising function and maybe improving the style of the code.
strangerep said:
I suggest keeping different capabilities in distinct packages (maybe using a common set of library code if applicable). I.e., avoid the mega-tar-baby approach to coding.
I definately need to do that. Either I am going to create a class which I need to do at this point. In that case it would be easy to treat matrices as objects but I am kind of new to creating classes s that would take some time. After creating the classes it would be easy to work with the code I guess. Even in this case I could create another .py file and just use the functions but I'll keep this way for now.
 
Physics news on Phys.org
  • #32
Arman777 said:
...or I can pre-upload some solutions and metrics, etc.
I don't see much point in that.

Arman777 said:
I have never tried that thing, but maybe it's due to problems of the sympy. Sadly it seems that the sympy does not have enough power to simplify expressions as Mathematica. So even simple terms remain complicated due to this issue, which I have encountered.
It might be interesting to try a particular simplification task in SymPy, Maple and Mathematica and see which one can progress furthest without human assistance. And then,... with a little bit of human assistance...

Arman777 said:
I was thinking of including index lowering and raising function and maybe improving the style of the code.
I think you need to clarify in your own mind what real-world problem(s) you are really trying to solve by creating this software. If you produce some nicely structured, well-written code that's not actually useful in the real world, then what's the point?
 
  • Like
Likes Arman777
  • #33
strangerep said:
I think you need to clarify in your own mind what real-world problem(s) you are really trying to solve by creating this software. If you produce some nicely structured, well-written code that's not actually useful in the real world, then what's the point?
I thought a user would enter or type the metric components, and then it will have access to Riemann Tensor, Ricci Tensor, Einstein Tensor, etc. Then, he/she can raise or lower the indices of these tensors at any level. This was my purpose. Solutions of the GR equations only can be possible after these steps, I guess. To do these things, I need to write a class and separate the function in one .py file and maybe try to write a user-friendly interface instead of typing the code by hand.
strangerep said:
It might be interesting to try a particular simplification task in SymPy, Maple and Mathematica and see which one can progress furthest without human assistance. And then,... with a little bit of human assistance...
I believe it's Mathematica...I just need to add some of the simplifaction functions so that the code gets simplified. And sometimes simplification makes things worse in sympy.

strangerep said:
I don't see much point in that.
Well, maybe not much but just a little ... I am doing/want to do things done by Einsteinpy, but I am focusing on the curvature tensors rather than solving tensor equations.
 
  • #34
I manage to turn it into a class. I have also put a detalied description about how to run the code
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
3K
Replies
20
Views
2K
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
585
  • · Replies 18 ·
Replies
18
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 8 ·
Replies
8
Views
1K