Tensorial calculations - Best computational Language

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
33 replies · 4K views
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 definitely 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
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   Reactions: Arman777
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.
 
I manage to turn it into a class. I have also put a detalied description about how to run the code