Question: Using Physics inside a procedure

Hello!

I can't seem to figure out how to use the Physics package within a procedure. In particular, I can't get tensors to be recognized within the body of the proc.

As an example, here's a short program that works correctly when not in a procedure:

with(Physics):
Coordinates(X,quiet):
d_[mu](X[~mu]);
# Returns 4; Correct

However, placing this code inside a proc causes the tensor X to not be recognized as a tensor:

Test := proc()
  uses Physics:

  Coordinates(X,quiet):
  d_[mu](X[~mu]);
end proc:
Test();
# Returns 0; Wrong

Apparently, Physics:-Coordinates still defines the tensor X (as can be checked by calling Physics:-Define()). However, the derivative d_[mu] (X[~mu]) seems to be treating X as a standard symbol. Any idea how I would go about correcting this?

Thanks!

Please Wait...