# Is there a program that can solve for Gaussian curvature of a Metric?

Sciencemaster
TL;DR Summary
I'm trying to solve for the Gaussian Curvature of a 4-D metric tensor. What program or library can do this?
I've been trying to find a way to calculate Gaussian curvature from a 4D metric tensor. I found a program that does this in Mathematica using the Brioschi formula. However, this only seems to work for a 2D metric or formula (I would need to use something with more dimensions). I've found abundant ways to do this for the Ricci scalar curvature, but for this I'm specifically trying to find the Gaussian curvature. Is there a program I can use that does this? Preferably in Python or Mathematica, as these are the languages I am familiar with.

Gold Member
2022 Award
There's a great Python Package for symbolic compuations of this kind

https://einsteinpy.org/

PeroK and Dale
Sciencemaster
There's a great Python Package for symbolic compuations of this kind

https://einsteinpy.org/
Yeah, einsteinpy is very useful, but unfortunately, I can't find any modules in it for Gaussian curvature (I just found a bunch on (Ricci) scalar curvature).

vanhees71
Sciencemaster
I believe it's called sectional curvature in dimensions higher than 2. Try https://physics.stackexchange.com/questions/699398/calculating-gaussian-curvature-in-4d
That worked, thank you! I was able to find a module for Mathematica that found sectional curvature of a metric tensor as a matrix! That's basically what I was looking for! Quick clarifying question, is the sectional curvature for a 4D metric tensor supposed to be a 4D symmetric matrix or just a scalar?

vanhees71
2022 Award
The Wikipedia article on sectional curvature notes that it completely characterises the curvature, so presumably it ought to be a matrix (probably a tensor, actually) with as many independent components as the Riemann tensor. Probably you can summarise it to a scalar as you can do with the Riemann to get the Ricci or Kretschman scalars.

vanhees71
Mentor
I've been trying to find a way to calculate Gaussian curvature from a 4D metric tensor.
"Gaussian curvature" in 4 dimensions is not a scalar. It's a tensor. Which tensor? As @Ibix has conjectured, it is the Riemann curvature tensor. Note that this is perfectly consistent with the 2D case, since in 2 dimensions the Riemann curvature tensor has only one independent component, which is equal to the Gaussian curvature (a scalar). But in more than 2 dimensions, the Riemann curvature tensor has more than one independent component (it has 6 independent components in 3 dimensions and 20 in 4 dimensions), so a single scalar cannot fully describe the "Gaussian curvature" of a manifold with 3 or more dimensions.

vanhees71
2022 Award
The wiki article on sectional curvature gives this as the definition of the sectional curvature:
$$K(u,v)=\frac{\langle R(u,v)v,u\rangle}{\langle u,u\rangle\langle v,v\rangle-\langle u,v\rangle^2}$$Even the "assume everything's orthonormal" form is given as ##K(u,v)=\langle R(u,v)v,u\rangle##. I'm struggling slightly with the function-like notation they use (either Wikipedia doesn’t use it consistently or I'm not understanding it completely; either is more than possible), but isn't that some kind of scaling of the Riemann rather than the Riemann directly?

vanhees71
Staff Emeritus
Homework Helper
Gold Member
The wiki article on sectional curvature gives this as the definition of the sectional curvature:
$$K(u,v)=\frac{\langle R(u,v)v,u\rangle}{\langle u,u\rangle\langle v,v\rangle-\langle u,v\rangle^2}$$Even the "assume everything's orthonormal" form is given as ##K(u,v)=\langle R(u,v)v,u\rangle##. I'm struggling slightly with the function-like notation they use (either Wikipedia doesn’t use it consistently or I'm not understanding it completely; either is more than possible), but isn't that some kind of scaling of the Riemann rather than the Riemann directly?
##\langle R(u,v)v,u\rangle## is directly the ##R^u_{vuv}## component of the Riemann tensor.

vanhees71 and Ibix
2022 Award
Anticipating "don't use Wikipedia as a source", I found this differential geometry specific wiki and this lecture notes pdf which implicitly define that Wikipedia uses ##\langle a,b\rangle## to mean the inner product of ##a## and ##b##. Thus I think the sectional curvature formula above defines the sectional curvature in the plane defined by two vectors ##u^a## and ##v^a## as$$\frac{R^a{}_{bcd}v^bu^cv^du_a}{u_au^av_bv^b-(u_av^a)^2}$$in the index notation I'm familiar with. That can't be right, though, because I only have four linearly independent vectors ##u## and ##v## leading to 4×3=12 independent sectional curvatures, and there are 20 independent components of the Riemann. And both Wiki and the pdf explicitly note that there's no information lost.

I think I'm having an "understanding the notation" issue here, more than anything else. I think I understand how ##g(u,v)## relates to index notation (##g_{ab}u^av^b##), but I also think ##R(u,v)w## means ##R^a{}_{bcd}u^cv^dw^b##, and then I run out of independent components. Any help appreciated.

Last edited:
vanhees71
2022 Award
##\langle R(u,v)v,u\rangle## is directly the ##R^u_{vuv}## component of the Riemann tensor.
Ok, but then I still don't have twenty outputs (edit: I'm assuming four dimensions here), unless I'm miscounting.

Staff Emeritus
Homework Helper
Gold Member
Ok, but then I still don't have twenty outputs (edit: I'm assuming four dimensions here), unless I'm miscounting.
No, you are correct. Defined as above you do not have any information on components such as ##R^0_{123}##. The information you do have is how vectors in a surface spanned by two vectors are affected by parallel transport around small loops in the same plane. This is missing information on how such a parallel transport affects vectors not in the plane.

vanhees71
Note, in a 4-d Riemannian manifold, 6 sectional curvatures specified per 6 independent basis pairs at each point, allow, in principle, complete determination of the Riemann curvature tensor.