# Table with two indices does not work properly

I am a beginner in computational mathematics so apologies in advance for my probably poor code writing skills. I am using the package << matrixEDC.m to do some exterior algebra computations.

After defining:

DeclareForms[{1, v[_], w[_]}];


and several elementary functions:

bar[x_ + y_] := bar[x] + bar[y];
bar[x_*y_] := bar[x]*bar[y];
bar[x_\[Wedge]y_] := bar[x]\[Wedge]bar[y];
bar[x_] := Conjugate[x] /; NumericQ[x];
bar[v[i_]] := w[i]; bar[w[i_]] := v[i];

j[x_ + y_] := j[x] + j[y];
j[x_\[Wedge]y_] := j[x]\[Wedge]j[y];
j[v[i_]] := -I*v[i]; j[w[i_]] := +I*w[i];
j[x_] := x /; NumericQ[x];

d[w[i_]] := bar[d[bar[w[i]]]];

dc[x_] := (-1)^FormDegree[x] j[d[j[x]]];

d1[x_] := 1/2*(d[x] + I*dc[x]);

d2[x_] := 1/2*(d[x] - I*dc[x]);


Then I define how the exterior derivative works:

differentials = {d[v[1]] = I*v[1]\[Wedge](v[3] + w[3]),
d[v[2]] = -I*v[2]\[Wedge](v[3] + w[3]),
d[v[3]] = v[1]\[Wedge]w[1] - v[2]\[Wedge]w[2]};


For the command "Coefficient" to work properly in this context of exterior forms I have found useful to do:

Unprotect[Coefficient];
Coefficient[a_, x_*b_] := 1/x*Coefficient[a, b] /; NumericQ[x];
Protect[Coefficient];


My question is the following. I am trying to evaluate correctly:

In[108]:= Table[
Coefficient[d2[v[3]], v[j]\[Wedge]w[k]], {j, 3}, {k, 3}]

Out[108]= {{1/2, 0, 0}, {0, -(1/2), 0}, {0, 0, 0}}


which seems to be false. Indeed, the slightly different code:

In[109]:=
Table[Coefficient[#, v[j]\[Wedge]w[k]], {j, 3}, {k, 3}] &@(d2[v[3]])

Out[109]= {{1, 0, 0}, {0, -1, 0}, {0, 0, 0}}


gives the correct result, but I am unable to see what am I failing at in the former computation.

• Table[...,{j,3},...] temporarily changes the (global) def. of j -- that is, it overwrites your prior def. of j. Rename one of them. Aug 3, 2021 at 14:15
• Absolutely. I keep forgetting... Aug 3, 2021 at 14:23