Orthonormal frame in SageManifolds without specifying coordinates

asked 2026-07-02 21:32:15 +0200

Hello,

In SageManifolds, I am trying to do computations in an arbitrary orthonormal frame (we may assume the manifold is parallelizable, so the frame can be global without worrying about locality or anything) without specifying coordinates.

It seems that the objects work symbolically fine, but things do not print well, as it seems the library assumes there must be a default chart. I am running SageMath version 10.9.

Example code:

M = Manifold(7, 'M', start_index=1)
e = M.vector_frame('e')
M.set_default_frame(e)
g = M.riemannian_metric('g')
g[e, :] = diagonal_matrix([1, 1, 1, 1, 1, 1, 1])
coe = e.coframe()
print(sum(coe[i] * coe[i] for i in range(1, 8)) == g) # outputs True, so g exists properly
print(g.display())

with the final line outputting the error

    ValueError                                Traceback (most recent call last)
Cell In[10], line 1
----> 1 print(g.display())

File ~/miniforge3/envs/sage/lib/python3.12/site-packages/sage/tensor/modules/free_module_tensor.py:690, in FreeModuleTensor.display(self, basis, format_spec)
    688 for ind in comp.index_generator():
    689     ind_arg = ind + (format_spec,)
--> 690     coef = comp[ind_arg]
    691     # Check whether the coefficient is zero, preferably via
    692     # the fast method is_trivial_zero():
    693     if hasattr(coef, 'is_trivial_zero'):

File ~/miniforge3/envs/sage/lib/python3.12/site-packages/sage/tensor/modules/comp.py:4828, in CompFullySym.__getitem__(self, args)
   4826         return self._comp[ind]
   4827     if format_type is None:
-> 4828         return self._output_formatter(self._comp[ind])
   4829     return self._output_formatter(self._comp[ind], format_type)
   4831 # the value is zero

File ~/miniforge3/envs/sage/lib/python3.12/site-packages/sage/manifolds/scalarfield.py:1782, in ScalarField.coord_function(self, chart, from_chart)
   1780             break
   1781     if not found:
-> 1782         raise ValueError("no starting chart could be found to " +
   1783                          "compute the expression in the {}".format(chart))
   1784 change = self._domain._coord_changes[(chart, from_chart)]
   1785 # old coordinates expressed in terms of the new ones:

ValueError: no starting chart could be found to compute the expression in the None
enter code here

If there is no way around it, I would be happy if someone pointed me to the relevant source in the library for me to write a fix, as being able to only work in a frame and not a chart is critical for my project.

edit retag flag offensive close merge delete