Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to calculate the derivatives of the function K defined in the code:

<< VectorAnalysis`
K = δ[t]*Exp[-(r/L)]/r;
SetCoordinates[Cartesian[x, y, z]];

r = Sqrt[(x - x0)^2 + (y - y0)^2 + (z - z0)^2];
Hes = D[K, {{x, y, z}, 2}];
der = Grad[K];
FullSimplify[Hes[[1, 2]]]
FullSimplify[Hes[[1, 1]]]

This is part the output just for FullSimplify[der[[1]]]:

-((E^(-(Sqrt[(x - x0)^2 + (y - y0)^2 + (z - z0)^2]/ L)) (x - x0) (L + 
    Sqrt[(x - x0)^2 + (y - y0)^2 + (z - z0)^2]) δ[t])/( L ((x - x0)^2 + (y - y0)^2 + 
  (z - z0)^2)^(3/2)))

I would like the function K to appear in the result instead of that "mess": is it possible to do it?

share|improve this question
up vote 1 down vote accepted

I'm not sure what's your goal since you've expressed K and switched coordinates.

Maybe this could be what you're after?

Simplify[(der /. r^2 -> rad^2), rad > 0] /. E^(-(rad/L)) -> newK rad/δ[t]

enter image description here

share|improve this answer
Yes it is. I thought it was more complicated... thank you! – mattiav27 Apr 23 '14 at 10:31
@mattiav27 I'm glad you like it. It is good to hold on with an accept a day or two, there are better ways of workng with vector analisys and someone may provide an answer :) Let's do not discourage them :) You can still upvote this answer if you want. – Kuba Apr 23 '14 at 10:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.