# Revision history [back]

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