Ask Your Question
0

AttributeError when defining a metric on a differentiable manifold

asked 2020-02-12 15:36:37 +0100

A. gravatar image

Hello everyone,

I am getting started with SageMath and try to define a metric on a differential manifold. Despite tutorials, search online and asking questions to colleagues, I cannot understand the following error.

Here is the code, with Kernel SageMath 9.0

FM = Manifold(2,'FM', structure='Riemannian', start_index=1)

K = FM.metric('K')

K[1,1]=1

which generates the following error AttributeError Traceback (most recent call last) <ipython-input-17-f83570b8b1cf> in <module>() 1 K = FM.metric('K') ----> 2 K[Integer(1),Integer(1)]=Integer(1)

/ext/sage/sage-9.0/local/lib/python3.7/site-packages/sage/tensor/modules/free_module_tensor.py in __setitem__(self, args, value) 1629 else: 1630 basis = self._fmodule._def_basis -> 1631 self.set_comp(basis)[args] = value 1632 1633 def copy_from(self, other): /ext/sage/sage-9.0/local/lib/python3.7/site-packages/sage/manifolds/differentiable/tensorfield_paral.py in set_comp(self, basis) 883 self._is_zero = False # a priori 884 --> 885 if basis._domain == self._domain: 886 # Setting components on the tensor field domain: 887 return FreeModuleTensor.set_comp(self, basis=basis) AttributeError: 'One' object has no attribute '_domain'

It seems that the index type in the metric is wrong. Is that the problem? Have you some ideas to solve the problem?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-02-13 10:25:04 +0100

eric_g gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-02-12 15:36:37 +0100

Seen: 220 times

Last updated: Feb 13 '20