Ask Your Question
2

metric perturbations on Sagemanifolds

asked 2020-04-26 23:59:37 +0100

mocalvao gravatar image

updated 2020-04-27 15:06:45 +0100

slelievre gravatar image

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)).
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-04-27 16:03:55 +0100

eric_g gravatar image

The error is due to the fact that neither g0 nor g1 are initialized. They have simply been declared as a metric and a type (0,2) tensor field, but you should initialize their components in some vector frame, in order to fully define them.

Regarding perturbation of tensor fields, note that tensor series expansion have been introduced in Sage 8.8, see the changelog for details, in particular cell [25] of this notebook for a concrete example of use.

edit flag offensive delete link more

Comments

Dear Eric,

I get the difference between a plain declaration and an initialization; thanks. However, I would like to use, until a certain time, completely general expressions for the components (in the default frame, for instance), that is, arbitrary functions of all the coordinates. Is this feasible? If so, how?

mocalvao gravatar imagemocalvao ( 2020-04-27 17:06:32 +0100 )edit

You can use function('A')(x0,x,y,z) to initialize some tensor components with an arbitrary function of the coordinates. NB: if you do this for all components, some computations, like the Riemann tensor, will become huge.

eric_g gravatar imageeric_g ( 2020-04-27 18:00:54 +0100 )edit

I was thinking something along the lines of the package xPert (xAct) from Mathematica

mocalvao gravatar imagemocalvao ( 2020-04-27 20:28:02 +0100 )edit

The currrent implementation of tensor calculus in SageMath does not deal with "abstract" tensors, as xAct does, i.e. tensor fields have to be defined by their components in a given frame (usually a coordinate frame). Adding abstract tensor calculus in SageMath could be a nice project, if there are volunteers...

eric_g gravatar imageeric_g ( 2020-05-01 10:10:28 +0100 )edit

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-04-26 23:59:37 +0100

Seen: 899 times

Last updated: Apr 27 '20