Ask Your Question

Revision history [back]

Although the error message is not very informative, an error is expected here because when you write

K[1, 1] = 1

you are setting some component of K in the default frame of the manifold and no such frame has been defined yet (FM is a "bare" manifold). For instance, if you set up a chart on the manifold, by the command

 X.<x,y> = FM.chart()

prior to introducing K, then everything is OK because the manifold FM is then endowed with a default frame, namely the coordinate frame $\left( \frac{\partial}{\partial x}, \frac{\partial}{\partial y}\right)$ associated with the chart $(x, y)$.

To summarize, the following code works:

sage: FM = Manifold(2,'FM', structure='Riemannian', start_index=1)
sage: X.<x,y> = FM.chart()
sage: K = FM.metric('K')
sage: K[1,1] = 1
sage: K[2,2] = 3
sage: K.display()
K = dx*dx + 3 dy*dy