ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 12 Feb 2020 08:36:37 -0600AttributeError when defining a metric on a differentiable manifoldhttp://ask.sagemath.org/question/49889/attributeerror-when-defining-a-metric-on-a-differentiable-manifold/ 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
A.Wed, 12 Feb 2020 08:36:37 -0600http://ask.sagemath.org/question/49889/AttributeError using metric on differential manifoldhttp://ask.sagemath.org/question/49888/attributeerror-using-metric-on-differential-manifold/ 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
A.Wed, 12 Feb 2020 08:35:10 -0600http://ask.sagemath.org/question/49888/How to set a metric tensor inverse?http://ask.sagemath.org/question/47633/how-to-set-a-metric-tensor-inverse/ I have a complicated metric tensor. In order to compute the Laplacian in this metric, I need the metric tensor inverse. But this exceeds my memory capacity after ~36 hours of computing.
I would like instead to set the inverse with what I believe to be the correct entries. Is that possible? Reviewing the documentation and the source code, I see no indication of such an operation.
I wonder if `g.inverse().comp(XI.frame())[:] = Ginv[:] ` would work, where `g` denotes the metric tensor, and `Ginv` the matrix of expressions which should be correct.
BTW, I have the metric and its inverse in one frame. It is after mapping into a second frame [XI] that the problem arises.Richard_LTue, 27 Aug 2019 20:29:09 -0500http://ask.sagemath.org/question/47633/Error with metrichttp://ask.sagemath.org/question/35814/error-with-metric/ Hi,
I am learning Sage Math and Sage Manifolds. As in the reference manual, I just used the command:
**M = Manifold(4, 'M')**
**g = M.lorentz_metric('g')**
Running the second line gave me the following message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_10.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZyA9IE0ubG9yZW50el9tZXRyaWMoJ2cnKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/hw/dshmtl910nb4nk8_pc8f7ldr0000gn/T/tmptEzTup/___code___.py", line 2, in <module>
exec compile(u"g = M.lorentz_metric('g')" + '\n', '', 'single')
File "", line 1, in <module>
File "sage/structure/category_object.pyx", line 834, in sage.structure.category_object.CategoryObject.__getattr__ (/Applications/SageMath-7.4.app/Contents/Resources/sage/src/build/cythonized/sage/structure/category_object.c:7515)
File "sage/structure/category_object.pyx", line 849, in sage.structure.category_object.CategoryObject.getattr_from_category (/Applications/SageMath-7.4.app/Contents/Resources/sage/src/build/cythonized/sage/structure/category_object.c:7679)
File "sage/structure/misc.pyx", line 295, in sage.structure.misc.getattr_from_other_class (/Applications/SageMath-7.4.app/Contents/Resources/sage/src/build/cythonized/sage/structure/misc.c:1697)
AttributeError: 'DifferentiableManifold_with_category' object has no attribute 'lorentz_metric'
I appreciate it if somebody would give me some advice. Thanks.gucheutaWed, 30 Nov 2016 02:23:31 -0600http://ask.sagemath.org/question/35814/