Ask Your Question
1

SageManifolds: Equations of motion for scalar field

asked 2019-06-19 15:37:17 -0600

thethinker gravatar image

updated 2019-06-20 08:30:24 -0600

The following code illustrates the problem I'm having:

phi = M.scalar_field(function('phi')(*coord), name='phi')
print(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))
    476 
    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:

dphi=nab(phi)
T1=dphi['_a']*dphi['_b'] 
T2=g.inverse()['^ab']*T1['_ab']
T3=dphi*dphi + 1/2*g*(T2 - V)
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2019-06-20 04:23:23 -0600

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

Stats

Asked: 2019-06-19 15:37:17 -0600

Seen: 65 times

Last updated: Jun 20