0
$\begingroup$

Consider this code defining the "fields" field and their "derivatives" dfield for some list partlist:

partlist = {"part1", "part2", "part3"}; Do[ field[p, x_, a_] = Symbol[p][x, a]; dfield[p, x_, a_, b_] = Symbol["d" <> ToString[p]][x, a, b] , {p, Drop[partlist, -1]}] field["part3", x_, a_] = PART3[x, a]; dfield["part3", x_, a_, b_] = dPART3[x, a, b]; 

For each of the "fields" $f$ and their derivatives $df$, I would like to define the "functional derivative" $$ \delta f(x,\mu)/\delta f(x,\nu) = \delta_{\mu\nu}, \delta df(x,\mu,\nu)/\delta f(x,\alpha) = \pm i p^{\mu}_{f}\delta_{\nu \alpha} $$

This is my working attempt for one of the "fields":

part1 /: D[part1[x_, a_], part1[x_, b_], OptionsPattern[]] := If[MemberQ[OptionValue[NonConstants], part1], kd[a, b], 0] dpart1 /: D[dpart1[x_, a_, b_], part1[x_, c_], OptionsPattern[]] := If[MemberQ[OptionValue[NonConstants], dpart1], I*p["part1", a]* kd[b, c], 0] FuncDerFieldTemp[expression_, part_, in_, indexlist_] := Block[{}, expr10 = D[expression, field[part, x, indexlist[[1]]], NonConstants -> {field[part, x, a][[0]], dfield[part, x, a, b][[0]]}] /. {p[part, a_] :> in*p[part, a]}(*; expr10//.e_*kd[x_,y_]:>(e/. y->x)*) ] (*\[Delta]f/Subscript[\[Delta]part1, \[Nu]]*) FuncDerFieldTemp[ part1[x, \[Mu]]*dpart1[x, \[Mu], \[Nu]]* part2[x, \[Nu]], "part1", 1, {"b"}] 

I would like to extrapolate this definition onto all the fields from the list partlist. This is my failed attempt:

Scan[ Function[theParticle, Module[{fs = field[theParticle, x, a][[0]], dfs = dfield[theParticle, x, a, b][[0]]}, Print[Row[{fs, ", ", dfs}]]; fs /: HoldPattern[ D[fs[x_, \[Alpha]_], fs[x_, \[Beta]_], opts___?OptionQ]] := If[MemberQ[OptionValue[NonConstants], fs], kd[\[Alpha], \[Beta]], 0]; dfs /: HoldPattern[ D[dfs[x_, \[Alpha]_, \[Beta]_], fs[x_, \[Gamma]_], opts___?OptionQ]] := If[MemberQ[OptionValue[NonConstants], dfs], I*p[theParticle, \[Alpha]]*kd[\[Beta], \[Gamma]], 0]; ] ], partlist]; 

It leaves the derivatives of part2 and part3 unevaluated:

Table[{f, D[field[f, x, x2], field[f, x, \[Kappa]3], NonConstants -> {field[f, x, a][[0]], dfield[f, x, a, b][[0]]}], D[dfield[f, x, c2, c4], field[f, x, \[Kappa]3], NonConstants -> {field[f, x, a][[0]], dfield[f, x, a, b][[0]]}]}, {f, partlist}] 

enter image description here

Could you please tell me how to modify it so that it works?

$\endgroup$

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.