Ask Your Question

SageManifolds: Equations of motion for scalar field

asked 2019-06-19 22:37:17 +0200

thethinker gravatar image

updated 2019-06-20 15:30:24 +0200

The following code illustrates the problem I'm having:

phi = M.scalar_field(function('phi')(*coord), name='phi')
V = function('V')(phi)


Scalar field phi on the 4-dimensional differentiable manifold R^4

TypeError                                 Traceback (most recent call last)
<ipython-input-61-7de84076176e> in <module>()
      1 phi = M.scalar_field(function('phi')(*coord), name='phi')
      2 print(phi)
----> 3 V = function('V')(phi)

/home/cduston/Programs/SageMath/local/lib/python2.7/site-packages/sage/symbolic/function.pyx in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6664)()
    473                     if callable(method):
    474                         return method()
--> 475                 raise TypeError("cannot coerce arguments: %s" % (err))
    477         else: # coerce == False

TypeError: cannot coerce arguments: no canonical coercion from Algebra of differentiable scalar fields on the 4-dimensional differentiable manifold R^4 to Symbolic Ring

I want to determine the equations of motion for a scalar field $\phi$ on a 4-manifold with potential $V(\phi)$. However, Sage can't seem to associate an algebra with those objects. This is a pretty standard thing to do in field theory / GR - study the inflaton field, or dark energy, for example.

Is there a correct way to write to get the behavior we expect?

EDIT: Eventually, this function needs to be added to other scalar quantities, constructed from tensors:

T3=dphi*dphi + 1/2*g*(T2 - V)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-06-20 11:23:23 +0200

eric_g gravatar image

Symbolic functions, as created via function('V')(phi), accept only symbolic expressions (i.e. elements of the Symbolic Ring) for their arguments. Hence the error message that you get. To derive the equations of motion, I would advise to introduce, in addition to the scalar field phi, a symbolic expression, phi0 say, that will represent the scalar field as the argument of the potential V:

phi0 = var('phi0', latex_name=r'\phi')
V_phi = function('V')(phi0)
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


Asked: 2019-06-19 22:37:17 +0200

Seen: 421 times

Last updated: Jun 20 '19