# How to create/use matrices valued in differential forms?

First, for context, I am working with holomorphic Hermitian vector bundles, and I need to compute the connection and curvature matrices, and compute some representatives for Chern classes and the Chern form.

Ultimately I want to have a matrix which is valued in differential forms, and when I multiply matrices, I want the component-wise multiplication to be the wedge product of forms.

When I naively try to build a matrix of forms 'by hand', or when I pre-define my matrix space to be valued in the module of differential forms, I get an error telling me that the space of differential forms is a not a ring.

For example,

import sys
import mpmath
sys.modules['sympy.mpmath'] = mpmath
M = Manifold(2, 'M', field='complex')
U = M.open_subset('U')
c_xy.<x,y> = U.chart()
e_xy = c_xy.frame()
a = M.diff_form(2, name='a')
a.parent()
eU = c_xy.frame()
a.degree()
a[eU,0,1] = x*y^2 + 2*x
a.display(eU)
A = matrix([[a, a], [a, a]])


prints out

Module Omega^2(M) of 2-forms on the 2-dimensional complex manifold M
2
a = (x*y^2 + 2*x) dx/\dy


and raises a type error:

TypeError: base_ring (=Module Omega^2(M) of 2-forms on the 2-dimensional complex manifold M) must be a ring

edit retag close merge delete

Hi

your post is in duplicate, maybe you can delete one of them?(but in fact I do not know if it is possible on the sagemath site !

( 2019-05-25 12:14:06 -0600 )edit

just for information: there is a button 101 which allows you to display code more readable.

( 2019-05-26 01:06:33 -0600 )edit

It seems that someone fixed it for me. How do I do it myself?

( 2019-05-30 09:25:09 -0600 )edit

To display blocks of code or error messages, skip a line above and below, and do one of the following (all give the same result):

• indent all code lines with 4 spaces
• select all code lines and click the "code" button (the icon with '101 010')
• select all code lines and hit ctrl-K

For instance, typing

If we define f by

def f(x, y, z):
return x * y * z

then f(2, 3, 5) returns 30 but f(2*3*5) gives:

TypeError: f() takes exactly 3 arguments (1 given)


produces:

If we define f by

def f(x, y, z):
return x * y * z


then f(2, 3, 5) returns 30 but f(2*3*5) gives:

TypeError: f() takes exactly 3 arguments (1 given)

( 2019-06-01 08:40:56 -0600 )edit

Sort by » oldest newest most voted

At the moment (SageMath 8.7), differential forms of degree $p$ on a manifold $M$ are considered to belong to (i.e. their parent is) the set $\Omega^p(M)$ of all differential forms of degree $p$, which is a $C^\infty(M)$-module and not a ring. Hence one cannot construct matrices from them. However, since SageMath 8.8.beta3 (see the ticket #27584 for details), it is possible to consider the graded algebra

$$\Omega^*(M) = \bigoplus^n_{p=0} \Omega^p(M),$$

where $n = \mathrm{dim}\ M$. The set $\Omega^* (M)$ is a ring, the multiplication of which is the wedge product. It is therefore possible to form matrices from its elements. The latter are called mixed differential forms, so that, continuing from your example, one may write

sage: aa = M.mixed_form(comp=[0, 0, a], name='aa')
sage: aa.parent()
Graded algebra Omega^*(M) of mixed differential forms
on the 2-dimensional complex manifold M
sage: aa.display(eU)
aa = [0] + [0] + [(x*y^2 + 2*x) dx/\dy]


It is now possible to form a matrix and use the standard matrix operations:

sage: A = matrix([[aa, aa], [aa, aa]])
sage: A
[Mixed differential form aa on the 2-dimensional complex manifold M
Mixed differential form aa on the 2-dimensional complex manifold M]
[Mixed differential form aa on the 2-dimensional complex manifold M
Mixed differential form aa on the 2-dimensional complex manifold M]
sage: A.base_ring()
Graded algebra Omega^*(M) of mixed differential forms
on the 2-dimensional complex manifold M
sage: A[0,1]
Mixed differential form aa on the 2-dimensional complex manifold M
sage: det(A)
Mixed differential form aa/\aa-aa/\aa on the 2-dimensional complex manifold M
sage: det(A).display(eU)
aa/\aa-aa/\aa = [0] + [0] + [0]


The above feature will be available in the next stable release of SageMath (8.8), which should appear in a few weeks. Meanwhile you can install the latest development version (8.8.beta6 as of today) to use it, see e.g. the section "1. Starting from the latest sources" in this page.

more