Ask Your Question

Revision history [back]

SageMath's covariant derivatives are documented here: https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/differentiable/affine_connection.html . See also examples of use in cell 49 of this notebook: https://nbviewer.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_TOV.ipynb and in cell 37 of that one: https://nbviewer.org/github/sagemanifolds/SageManifolds/blob/master/Notebooks/SM_Kerr_Killing_tensor.ipynb .

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

SageMath's covariant derivatives are documented here: at https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/differentiable/affine_connection.html and https://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/differentiable/levi_civita_connection.html . See also examples of use in cell 49 of this notebook: https://nbviewer.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_TOV.ipynb and in cell 37 of that one: https://nbviewer.org/github/sagemanifolds/SageManifolds/blob/master/Notebooks/SM_Kerr_Killing_tensor.ipynb .

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