# extract components from exterior derivative result

Given the following code:

R2 = Manifold(2, 'R2', latex_name=r'\mathbb{R}^2')
cartesian2d.<x,y> = R2.chart()
R1 = Manifold(1, 'R1', start_index=1, latex_name=r'\mathbb{R}')
cartesian1d.<t> = R1.chart()
omega = R2.diff_form(1, 'omega', latex_name=r'\omega')
omega[:] = (4*y^2+exp(x^2)*sin(x^3), 6*x*y+log(5+y))
print omega
omega.display()
domega = omega.exterior_derivative()
domega.set_name('domega', r'\mathrm{d}\omega')
print domega
domega.display()


I don't know how to extract the elements of domega, namely -2 y for further use, like an integration.

I tried:

domega.display_comp(coordinate_labels=True, only_nonzero=True, only_nonredundant=True)


But I don't get the value -2 y to be used in an integral.

There is no expr() method to domega

I tried domega[x,y], domega[x][y] with errors.

I tried domega.comp() and I get just a message, no components.

Daniel

edit retag close merge delete

Sort by ยป oldest newest most voted

It suffices to use square brackets filled with the indices (as integers, not as x or y) of the component you are interested in:

sage: domega[0,1]
-2*y


Notice that the result is a coordinate function. To get the underlying symbolic expression (to be used for instance in some integration) you have to apply the method expr() atop of it:

sage: domega[0,1].expr()
-2*y

more

Thanks, Eric

( 2018-03-15 03:33:00 -0600 )edit