ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 04 Jul 2021 22:32:34 +0200Problem with Metric Tensor coordinate change.https://ask.sagemath.org/question/57867/problem-with-metric-tensor-coordinate-change/ I define a M manifold with three charts, I then define a metric on one of the charts MH. I then want to see the metric components in one of the other charts BL. I have defined differential maps between the charts.
gMann(MH) works and I can display the components but,
gMann(BL) gives the error:
ValueError: the provided domain is not a subset of the field's domain
print(subdomain,self._restrictions) gives 'Open subset MBL of the 4-dimensional Lorentzian manifold M {}' .
How do I make this work please?
I will post the code in comments below.AlanTStaffordSun, 04 Jul 2021 22:32:34 +0200https://ask.sagemath.org/question/57867/Metric of EuclideanSpace(3) in spherical framehttps://ask.sagemath.org/question/52348/metric-of-euclideanspace3-in-spherical-frame/ I may have some conceptual misunderstandings, but here is the code
E=EuclideanSpace(3)
c_spher.<r,th,ph>=E.spherical_coordinates()
f_spher=E.spherical_frame()
E.set_default_chart(c_spher)
E.set_default_frame(f_spher)
g=E.metric()
show(g[:])
I was expecting the diagonal elements of the metric to be `[1,r^2,r^4*sin(th)^2]`, but I get `[1,1,1]`
What I am doing wrong?curios_mindSun, 05 Jul 2020 22:47:56 +0200https://ask.sagemath.org/question/52348/AttributeError when defining a metric on a differentiable manifoldhttps://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 15:36:37 +0100https://ask.sagemath.org/question/49889/AttributeError using metric on differential manifoldhttps://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 15:35:10 +0100https://ask.sagemath.org/question/49888/How to set a metric tensor inverse?https://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_LWed, 28 Aug 2019 03:29:09 +0200https://ask.sagemath.org/question/47633/Error with metrichttps://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 09:23:31 +0100https://ask.sagemath.org/question/35814/