2
$\begingroup$

I am trying to define in the simplest possible way (only one coordinate system, no checking that variables are vectors, etc.) the Lie bracket of two vector fields in 3-space.

What is wrong with the following code ? It seems that Lie[a,b] is not understood by Mathematica as an expression of the same kind as a and b.

coo := {{x, y, z}}
Jac[v_] := D[v, coo]
Lie[v_, w_] := Jac[w[x, y, z]].v[x, y, z] - Jac[v[x, y, z]].w[x, y, z]
a[x_, y_, z_] := {1, 0, 0}; b[x_, y_, z_] := {0, 1, x^2}
Lie[a, b]
Lie[a, Lie[a, b]]
$\endgroup$
  • $\begingroup$ If you try the code, you will see that Lie[a,b] gives the correct answer, but Lie[a, Lie[a, b]] doesn't work. $\endgroup$ – André Bellaïche Nov 1 '17 at 16:06
2
$\begingroup$

Try

coo := {{x, y, z}}
Jac[v_] := D[v, coo]
Lie[v_, w_] := Jac[w].v - Jac[v].w
a := {1, 0, 0}
b := {0, 1, x^2}

Lie[a, b]

{0, 0, 2 x}

Lie[a, Lie[a, b]]

{0, 0, 2}
$\endgroup$
2
$\begingroup$

One way to do it:

a = {1, 0, 0};
b = {0, 1, x^2};

Jac[v_] := D[v, {{x, y, z}}];
Lie[v_, w_] := Jac[w].v - Jac[v].w;

Lie[a, b] (* {0, 0, 2x} *)
Lie[a, Lie[a, b]] (* {0, 0, 2} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.