# 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())
g=x0*M.gens()
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())
g=x0*M.gens()
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*U.frame()
g = U*U.frame()
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*ddx
g=x*ddx
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