0
$\begingroup$

I need to use the partial derivative operator in Wolfram Mathematica within a summation, specifically to define the D'Alembertian operator of scalar fields. I am having trouble summing over the D operator.

This is how I have defined the function currently and this is giving me an error.

enter image description here

(*Defining D'alembertian of a 2nd rank tensor H*)
    DALembert[H_, g_, xx_] := Block[{n, ig, det, detg, res},
      n = 4; det = Det[g]; detg = Sqrt[-det]; ig = InverseMetric[g];
      res = Table[1/detg Sum[\!\(
    \*SubscriptBox[\(\[PartialD]\), \(k\)]\([detg*ig[k, l]*\ \((
    \*SubscriptBox[\(\[PartialD]\), \(l\)]H[i, j])\)]\)\), {k, 1, n}, {l, 
           1, n}], {i, 1, n}, {j, 1, n}];
      Simplify[res]]

Please help.

$\endgroup$
  • 3
    $\begingroup$ You're using square brackets ([...]) after the partial derivative operator instead of parentheses ((...)). In Mathematica, expressions can only be grouped using parentheses. Square brackets are reserved for function calls $\endgroup$ – Lukas Lang Jan 9 at 14:43
  • $\begingroup$ See The Four Kinds of Bracketing in the Wolfram Language $\endgroup$ – Bob Hanlon Jan 9 at 16:57
  • $\begingroup$ @LukasLang, using parentheses instead of square brackets has helped me obtain an output. Thank you! But I realize that my approach of summing over k and l is not giving me the intended result. What I intended is to take partial derivatives with respect to 3 space coordinates and 1 time coordinate. I used k and l hoping to run over these 4 coordinates, but that is not happening. Please give some suggestions on how to do this! $\endgroup$ – mv1996 Jan 9 at 18:06
  • $\begingroup$ @BobHanlon I appreciate the info, since I am just beginning to use Mathematica. Thank you :) $\endgroup$ – mv1996 Jan 9 at 18:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.