Hot answers tagged

6

Everything you want in the question can be done by defining the derivative of the Norm: Derivative[1][Norm][z_] := z/Norm[z] D[Norm[x - y], {x}] (* ==> (x - y)/Norm[x - y] *) Simplify[D[Norm[x - y], {y}]] (* ==> (-x + y)/Norm[x - y] *) Here, the syntax I used for the derivatives is such that it would remain valid if x or y were replaced by vectors ...


5

You can do something like this: Simplify[Sqrt[x^2]] (* Sqrt[x^2] *) $Assumptions = _ ∈ Reals (* _ ∈ Reals *) Simplify[Sqrt[x^2]] (* Abs[x] *) This tells those functions that have an Assumptions option that any expression is considered real. Caveat: This refers to any expression, not just any variable! So you get this now: Simplify[Sqrt[x] ∈ Reals] (* ...


2

To some extent (and with some care) this can be done with FeynCalc. At least I used it several times when I needed to compute gradients and divergences of Cartesian vectors. The trick is to work with D-dimensional 4-vectors and take the limit $D \to 3$ at the end. Since FeynCalc doesn't distinguish between upper and lower indices, the results are the same as ...



Only top voted, non community-wiki answers of a minimum length are eligible