# How to grab the 'function' part of a differential form?

Basically, as the title reads, I want a differential form fdx, and I want to just get the f, and do something to it (take it's derivative) and put this f' into a new differential form. This requires me to call upon the f part of the form.
For some background, I'm trying to write some code to define the Dolbeault operator \bar{d}.
That is, I want to be able to take an exterior derivative of a differential form, but only taking the derivative with respect to conjugate variables (and of course wedging with such variables).

As far as I'm aware, sage does not have this feature built in. So I was thinking of writing the equations I'm interested in, and calling the conjugate variables different names. Then, defining my own function which would act like the Dolbeault operator, by having it grab the function part of the form, taking the derivatives with respect to just the variables corresponding to the usual ones or just the variables corresponding to the conjugates, and then wedging with the appropriate symbol.

edit retag close merge delete

Contract with a vector field ?

( 2019-05-31 18:42:52 +0100 )edit

How do I do that? Didn't see it in the basic vector fields manual. EDIT: Nevermind, I found it in the multivector fields manual, and in the differential forms manual.

( 2019-05-31 21:53:24 +0100 )edit

Sort by » oldest newest most voted

There are many ways to achieve what you want. For instance, let us consider a differential form $F$ of degree 1 on a 2-dimensional manifold:

sage: M = Manifold(2, 'M')
sage: X.<x,y> = M.chart()
sage: X.coframe()
Coordinate coframe (M, (dx,dy))
sage: dx, dy = X.coframe()[:]
sage: F = x*sin(y^2)*dx + (x-y)*dy
sage: F
1-form on the 2-dimensional differentiable manifold M
sage: F.display()
x*sin(y^2) dx + (x - y) dy


To get the coefficient of $dx$, we can use one of the following methods:

1) use F[0]

The easiest way is the square bracket operator, which gives access to components of a tensor field:

sage: F[0]
x*sin(y^2)


Note that F[0] is not a Sage symbolic expression but a higher level object: a ChartFunction:

sage: type(F[0])
<class 'sage.manifolds.chart_func.ChartFunctionRing_with_category.element_class'>


If you want a Sage symbolic expression, apply expr() on it:

sage: F[0].expr()
x*sin(y^2)
sage: type(F[0].expr())
<type 'sage.symbolic.expression.Expression'>


Actually, chart functions allow for various internal symbolic representations. The default one is Expression, but SymPy representations are also possible:

sage: F[0].expr('sympy')
x*sin(y**2)
sage: type(F[0].expr('sympy'))
<class 'sympy.core.mul.Mul'>


2) use F[[0]]

The double square bracket operator returns a scalar field:

sage: F[[0]]
Scalar field on the 2-dimensional differentiable manifold M
sage: F[[0]].display()
M --> R
(x, y) |--> x*sin(y^2)


Again, if you want a Sage symbolic expression, apply expr():

sage: F[[0]].expr()
x*sin(y^2)


The chart function F[0] is actually the coordinate representation of the scalar field F[[0]] in the chart X:

sage: F[0] is F[[0]].coord_function(X)
True


3) Apply $F$ to $\frac{\partial}{\partial x}$

Being a form, $F$ sends vector fields to scalar fields. Applying it to the vector field $\partial/\partial x$, which is dual to the 1-form $dx$, we get the component of $F$ along $dx$:

sage: e_x = X.frame()[0]  # d/dx
sage: e_x
Vector field d/dx on the 2-dimensional differentiable manifold M
sage: F(e_x)
Scalar field on the 2-dimensional differentiable manifold M
sage: F(e_x).expr()
x*sin(y^2)


4) Apply $\frac{\partial}{\partial x}$ to $F$

By duality, we have

sage: e_x(F)
Scalar field on the 2-dimensional differentiable manifold M
sage: e_x(F).expr()
x*sin(y^2)


5) Take the interior product with $\frac{\partial}{\partial x}$

sage: F.interior_product(e_x)
Scalar field on the 2-dimensional differentiable manifold M
sage: F.interior_product(e_x).expr()
x*sin(y^2)


Equivalently, we may write

sage: e_x.interior_product(F).expr()
x*sin(y^2)


6) Contract with $\frac{\partial}{\partial x}$

As suggested by @FrédéricC:

sage: F.contract(e_x)
Scalar field on the 2-dimensional differentiable manifold M
sage: F.contract(e_x).expr()
x*sin(y^2)


Equivalently:

sage: e_x.contract(F).expr()
x*sin(y^2)


Note that, instead of contract(), you can use index notations (with LaTeX syntax) to perform the contraction (assuming summation on repeated indices):

sage: F['_a']*e_x['^a']
Scalar field on the 2-dimensional differentiable manifold M
sage: (F['_a']*e_x['^a']).expr()
x*sin(y^2)

more