Skip to content

Instantly share code, notes, and snippets.

@Jason-S-Ross
Last active September 14, 2021 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jason-S-Ross/f33ea4aa80cc2577be0bff3dbe19c765 to your computer and use it in GitHub Desktop.
Save Jason-S-Ross/f33ea4aa80cc2577be0bff3dbe19c765 to your computer and use it in GitHub Desktop.
Demonstration of covariant derivatives in sympy branch
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Upabjojr
Copy link

Interesting. Do you plan on merging your changes back to SymPy?

@Jason-S-Ross
Copy link
Author

I would need some help to get this merged. I don't have a strong enough grasp of tensor calculus to know if all the assumptions I'm making are correct.

@Upabjojr
Copy link

sympy.tensor.tensor was originally meant to only support the Penrose abstract index notation (which is independent of coordinate systems). Unfortunately that was too restrictive as partial derivatives cannot be represented. Adding support for indices with coordinate systems is quite complicated OTOH.

Another great shortcoming of sympy.tensor.tensor is that it is complicated to use, and its applications are quite limited (physics and Riemannian geometry only).

I have since switched to the development of sympy.tensor.array.expressions, which is meant to be more general as possible (it's just N-dimensional arrays, not even tensors, but it's probably useful to many more users of SymPy).

@Upabjojr
Copy link

Also have a look at sympy.diffgeom, that's a quite robust implementation of Riemannian geometry.

@Jason-S-Ross
Copy link
Author

sympy.tensor.tensor was originally meant to only support the Penrose abstract index notation (which is independent of coordinate systems). Unfortunately that was too restrictive as partial derivatives cannot be represented. Adding support for indices with coordinate systems is quite complicated OTOH.

To my understanding this does add support for indices with coordinate systems, but probably not in a rigorous way.

Another great shortcoming of sympy.tensor.tensor is that it is complicated to use, and its applications are quite limited (physics and Riemannian geometry only).

I see. To me as an engineering student, physics and Riemannian geometry are basically the entire universe. I didn't find the tensor module to be overly complicated to use, for what it's worth.

Also have a look at sympy.diffgeom, that's a quite robust implementation of Riemannian geometry.

I tried that module first, but I don't have any background in differential geometry and I didn't understand how I could use it to solve problems like this. I asked the mailing list and didn't get much help, so I wrote this.


Unfortunately I am ignorant of the extent of my own ignorance of this subject, so I'm not qualified to speculate on whether or not this would be good for SymPy. I assume I have made some crucial mistakes in my assumptions that would not be appropriate for the level of generality desired for the tensor module. If not, I would be happy to submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment