Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

metric perturbations on Sagemanifolds

Hi there,

I would like to carry out some metric perturbations within Sagemanifolds

To that end, I have defined a 4-dimensional Lorentzian manifold N:

N = Manifold(4, 'N', latex_name=r'\mathcal{N}', structure='Lorentzian')

a global chart:

GC.<x0,x,y,z> = N.chart(r'x0:(-oo,+oo):x^0 x y z')

the corresponding frame eN:

eN = GC.frame()

the unperturbed metric g0:

g0 = N.metric('g0', latex_name=r'g_{(0)}')

the control parameter for the perturbation:

var('eps', latex_name=r'\epsilon', domain='real')

and the perturbation tensor field itself:

g1 = N.tensor_field(0, 2, name='g1', latex_name='g_{1}', sym=(0,1))

Up until here, everything seems to work fine and there are no errors or warnings. However, when I try to define the total perturbed metric, via:

g = g0 + eps*g1

the following error shows up:



ValueError Traceback (most recent call last) <ipython-input-10-e785f6693878> in <module>() ----> 1 g = g0 + epsplus*g1plus 2 g

/home/orca/SageMath/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10799)() 1229 cdef int cl = classify_elements(left, right) 1230 if HAVE_SAME_PARENT(cl): -> 1231 return (<element>left)._add_(right) 1232 # Left and right are Sage elements => use coercion model 1233 if BOTH_ARE_ELEMENT(cl):

/home/orca/SageMath/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.ModuleElement._add_ (build/cythonized/sage/structure/element.c:15170)() 2344 Generic element of a module. 2345 """ -> 2346 cpdef _add_(self, other): 2347 """ 2348 Abstract addition method

/home/orca/SageMath/local/lib/python3.7/site-packages/sage/tensor/modules/free_module_tensor.py in _add_(self, other) 2090 basis = self.common_basis(other) 2091 if basis is None: -> 2092 raise ValueError("no common basis for the addition") 2093 comp_result = self._components[basis] + other._components[basis] 2094 result = self._fmodule.tensor_from_comp(self._tensor_type, comp_result)

ValueError: no common basis for the addition

How is the correct way to define g as the sum of those 2 former tensor fields??? I have also tried

g[eN] = g0[eN] + epsplus*g1plus[eN]

but there is then: Type Error: unhashable type: 'VectorFieldFreeModule_with_category.element_class'

and also:

g[eN,:] = g0[eN,:] + epsplus*g1plus[eN,:]

but then the error is: ValueError: no basis could be found for computing the components in the Coordinate frame (N, (d/dx0,d/dx,d/dy,d/dz)).

Thanks in advance

metric perturbations on Sagemanifolds

Hi there,

I would like to carry out some metric perturbations within SagemanifoldsSageManifolds.

To that end, I have defined a 4-dimensional Lorentzian manifold N:

N = Manifold(4, 'N', latex_name=r'\mathcal{N}', structure='Lorentzian')

structure='Lorentzian')

a global chart:

GC.<x0,x,y,z> = N.chart(r'x0:(-oo,+oo):x^0 x y z')

z')

the corresponding frame eN:

eN = GC.frame()

GC.frame()

the unperturbed metric g0:

g0 = N.metric('g0', latex_name=r'g_{(0)}')

latex_name=r'g_{(0)}')

the control parameter for the perturbation:

var('eps', latex_name=r'\epsilon', domain='real')

domain='real')

and the perturbation tensor field itself:

g1 = N.tensor_field(0, 2, name='g1', latex_name='g_{1}', sym=(0,1))

sym=(0,1))

Up until here, everything seems to work fine and there are no errors or warnings. However, when I try to define the total perturbed metric, via:

g = g0 + eps*g1

eps*g1

the following error shows up:



---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-e785f6693878> in <module>()
----> 1 g = g0 + epsplus*g1plus
      2 g

g /home/orca/SageMath/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10799)() 1229 cdef int cl = classify_elements(left, right) 1230 if HAVE_SAME_PARENT(cl): -> 1231 return (<element>left)._add_(right) (<Element>left)._add_(right) 1232 # Left and right are Sage elements => use coercion model 1233 if BOTH_ARE_ELEMENT(cl):

BOTH_ARE_ELEMENT(cl): /home/orca/SageMath/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.ModuleElement._add_ (build/cythonized/sage/structure/element.c:15170)() 2344 Generic element of a module. 2345 """ -> 2346 cpdef _add_(self, other): 2347 """ 2348 Abstract addition method

method /home/orca/SageMath/local/lib/python3.7/site-packages/sage/tensor/modules/free_module_tensor.py in _add_(self, other) 2090 basis = self.common_basis(other) 2091 if basis is None: -> 2092 raise ValueError("no common basis for the addition") 2093 comp_result = self._components[basis] + other._components[basis] 2094 result = self._fmodule.tensor_from_comp(self._tensor_type, comp_result)

comp_result) ValueError: no common basis for the addition

addition

How is the correct way to define g as the sum of those 2 former tensor fields??? I have also tried

g[eN] = g0[eN] + epsplus*g1plus[eN]

epsplus*g1plus[eN]

but there is then:

Type Error: unhashable type: 'VectorFieldFreeModule_with_category.element_class'

'VectorFieldFreeModule_with_category.element_class'

and also:

g[eN,:] = g0[eN,:] + epsplus*g1plus[eN,:]

epsplus*g1plus[eN,:]

but then the error is:

ValueError: no basis could be found for computing the components in the Coordinate frame (N, (d/dx0,d/dx,d/dy,d/dz)).

Thanks in advance

(d/dx0,d/dx,d/dy,d/dz)).