I ran into a problem with the physics package that I subsequently solved. But I am wondering whether this would be a candidate for an SCR and/or be considered a bug.
The calculation I am trying is actually (so far) very simple.
I define a Hamiltonian H:
H := sqrt(p_^2*c^2+m^2*c^4); # note the square of vector p_
So far so good. Now I want to take the differentials of H against the components of p:
diff(H,p1) assuming c::real;
Hmm... I am not sure why the p2 and p3 still show up; but then, the product between the unit vectors should be 0 for different ones and one for equal unit vectors so maybe this is ok.
But H behaves weird: I can simplify it:
but if I try to do anything with it, it barfs:
Error, (in Physics:-Vectors:-+) invalid operation * between vectors _i and _j
As it turns out the issue is the square of the vector p_. Maple (or rather, Physics) does not recognize that it needs to expand p_^2 as p_.p_ and seems to treat is like p_*p_.
I would like Edgardo---& others more experienced with the Physics package than I am---to look at this. I do not understand the Physics package well enough to judge whether overloading the exponentiation operator to make this work is the right thing.
The example works once I replace p_^2 by p_.p_. But the ^2 notation is fairly standard usage so it feels slightly awkward.