I have an expression for $div$ with Lame coefficients. I want to look at the $div$ in different coordinate systems. So I want to substitute the Lame coefficients not letting Mathematica to actually differentiate, thats why I am using hold. So I need a valid combination of hold and substution to get what I need. Here is my code

divA = Hold[(1/(H1*H2*H3))*(D[Ax*H2*H3, x] + D[Ay*H3*H1, y] + D[Az*H1*H2, z])]

Hold[(D[Ax*H2*H3, x] + D[Ay*H3*H1, y] + D[Az*H1*H2, z])/(H1*H2*H3)]

divA /. {H1, H2, H3} -> {1, 1, 1}

Hold[(D[Ax*H2*H3, x] + D[Ay*H3*H1, y] + D[Az*H1*H2, z])/(H1*H2*H3)]

It is just dont substitute. Could u please help me get what I want?

  • $\begingroup$ Is is not replacing because there is no {H1, H2, H3} to replace... Try divA /. Thread[{H1, H2, H3} -> {1, 1, 1}], it has nothing to do with Hold. $\endgroup$
    – Kuba
    Jun 8, 2016 at 8:58
  • $\begingroup$ @Kuba it helped but not really, cause I got the next expression Hold[(D[Ax*1*1, x] + D[Ay*1*1, y] + D[Az*1*1, z])/(1*1*1)] It didn't do multiplication. I want multiplication to be done but not differentiation. $\endgroup$ Jun 8, 2016 at 9:04
  • $\begingroup$ There are topics about injecting into held expression but the shortest way is to use Inactivate on D. $\endgroup$
    – Kuba
    Jun 8, 2016 at 9:08
  • $\begingroup$ @Kuba ty, very much. That is exactly what I wanted. It helped! $\endgroup$ Jun 8, 2016 at 9:13

1 Answer 1


May be, like this:

A = {H2*H3*Ax[x, y, z], H1*H3*Ay[x, y, z], H1*H2*Az[x, y, z]};


    expr = 1/(H1*H2*H3)*Inactive[Div][A, {x, y, z}]

(*    Inactive[Div][{H2 H3 Ax[x, y, z], H1 H3 Ay[x, y, z], 
  H1 H2 Az[x, y, z]}, {x, y, z}]/(H1 H2 H3)   *)

And you may substitute:

expr1=expr /. Thread[{H1, H2, H3} -> {1, 1, 1}]

(* Inactive[Div][{Ax[x, y, z], Ay[x, y, z], Az[x, y, z]}, {x, y, z}]  *)

and then activate, if necessary:

expr1 // Activate

enter image description here

Have fun!

  • $\begingroup$ Thank you for the answer. @Kuba has already lit the light on Inactivate[] for me. $\endgroup$ Jun 8, 2016 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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