# Lie bracket of derivations over polynomial ring

I want to take the Lie bracket of derivations defined for an arbitrary polynomial ring. Using the notation for injecting variables into the global scope:

E.<x0,x1> = QQ[]
M = E.derivation_module()
f=(x1*M.gens()[0])
g=x0*M.gens()[1]
f.bracket(g)


gives -x0*d/dx0 + x1*d/dx. But I want to be able to construct vector fields programmatically for an arbitrary number of x0, x1, x2, ..., xn so I tried the following:

E = QQ[['x%i'%i for i in range(2)]]
E.inject_variables()
M = E.derivation_module()
f=(x1*M.gens()[0])
g=x0*M.gens()[1]
f.bracket(g)


which fails to take the Lie bracket with TypeError: unable to convert x1 to a rational (which causes another error TypeError: Unable to coerce into background ring.) ... which looks a bit like something is not right? or is this just not a permissible way to construct derivations in sagemath? or is the only way to do this using SageManifolds?

E = EuclideanSpace(2, coordinates='Cartesian', symbols='x0 x1')
U = E.default_chart()
f = U[2]*U.frame()[1]
g = U[1]*U.frame()[2]
f.bracket(g).display()


gives -x0 e_x0 + x1 e_x1

edit retag close merge delete

Sort by » oldest newest most voted

You can do it like this:

E = PolynomialRing(QQ, 2, names='x')
x = E.gens()
M = E.derivation_module()
ddx = M.gens()
f=x[1]*ddx[0]
g=x[0]*ddx[1]
f.bracket(g)


Output:

-x0*d/dx0 + x1*d/dx1


You can pass names a list if you want to be more picky (and then you can omit the number of variables, 2 above, because it will be the length of the list).

more