# 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
```

Hi

maybe you can give your code, so someone might be more easily able to help you.

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 !

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

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

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):

For instance, typing

produces: