SageManifolds: Equations of motion for scalar field
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)