# Confused about covariant derivatives and tensors in SageMath

I'm trying to calculate covariant derivatives of tensor fields in SageMath, I established the metric connection using g.connection(). But I cannot find any specific method to calculate the covariant derivatives unlike Lie derivative which is an inbuilt method. I looked up documentations and I found that I have to apply the connection (which is just the christoffel symbol) to the tensor field to calculate its covariant derivative. Is that the correct way or is there an inbuilt method that I'm missing? I tried diff() to calculate partial derivative of a tensor defined on a chart on a manifold but it is not working.

So ultimately I want to know the correct method to calculate partial and covariant derivatives of vector fields and tensors on a manifold.

On a related note, I want to know how to save a tensor quantity which I transformed from one coord to another using Tensor.display_comp(chart=differentOne). This method seems to take the original and just display the terms in a different coord system, how do I save the transformed one as a different tensor defined on the differentOnechart?

Please let me know. Thanks in advance for responding!

edit retag close merge delete

Sort by » oldest newest most voted

SageMath's covariant derivatives are documented at https://doc.sagemath.org/html/en/refe... and https://doc.sagemath.org/html/en/refe... . See also examples of use in cell 49 of this notebook: https://nbviewer.org/github/sagemanif... and in cell 37 of that one: https://nbviewer.org/github/sagemanif... .

As you can see, the covariant derivative of a tensor field T with respect to a given affine connection nabla is obtained by nabla(T). Note that the last index of the output is the derivative index, e.g. for a tensor field of type (1,1), nabla(T)[i,j,k] stands for $nabla_k T^i_{\ \ j}$.

The concept of partial derivative is relative to a given coordinate chart and therefore does not apply to tensor fields, which are independent of any chart. It is meaningful only for components of a tensor field w.r.t. a chart and it is then accessible via the method diff. Here is example involving both covariant and partial derivatives:

sage: M.<x,y> = EuclideanSpace()
sage: g = M.metric()
sage: nabla = g.connection()
sage: v = M.vector_field(-y, x, name='v')
sage: v.display()
v = -y e_x + x e_y
sage: Dv = nabla(v)   # covariant derivative
sage: Dv
Tensor field nabla_g(v) of type (1,1) on the Euclidean plane E^2
sage: Dv.display()
nabla_g(v) = -e_x⊗dy + e_y⊗dx
sage: vx = v[1]; vx
-y
sage: vx.diff(x)   # partial derivative of component vx w.r.t x
0
sage: vx.diff(y)  # partial derivative of component vx w.r.t y
-1
sage: diff(vx, y)  # equivalent to above
-1

more

Thanks a lot! This is very helpful. It would be great if you can also explain how to save a coord transformed tensor as a separate tensor. I tried saving it into a variable but Sage considers it to be a Formatted expansion and not a tensor in itself. Please let me know.

( 2024-02-29 09:41:15 +0200 )edit