I'm a Mathematica beginner and I'm and struggling with a problem concerning heat flow, not sure how to set it up with three variables. Any help with what I should input into Mathematica will be much appreciated.

Experiments show that in a temperature field, heat flows in the direction of maximum decrease of temperature $T$. Find this direction in general and at the point $(2, -1, 2)$ for $𝑇(𝑥, 𝑦, 𝑧) = 𝑥^2 + 𝑦^2 + 4𝑧^2$.

  • 2
    $\begingroup$ Try taking the gradient and flipping the sign: -D[x^2 + y^2 + 4 z^2, {{x, y, z}}] /. Thread[{x, y, z} -> {2, -1, 2}] or similarly -Grad[x^2 + y^2 + 4 z^2, {x, y, z}] /. Thread[{x, y, z} -> {2, -1, 2}]. For directional derivatives there is ResourceFunction["DirectionalD"] $\endgroup$
    – flinty
    Nov 23 '20 at 22:35
  • $\begingroup$ i tried this and mathematica won't recognize my function having three variables, z is still in blue unlike x and y $\endgroup$ Nov 23 '20 at 23:47
  • 3
    $\begingroup$ I'm guessing you wrote -D[x^2 + y^2 + 4 z^2, {x, y, z}] which is wrong. You need {{x,y,z}} with double braces, or just use Grad. Otherwise you need to post what you tried. If you are using a function: T[x_,y_,z_]:=x^2 + y^2 + 4 z^2; -Grad[T[x,y,z],{x,y,z}] $\endgroup$
    – flinty
    Nov 24 '20 at 0:05

Here we use Mathematica to verify that the -Grad satisfy the maximum decrease.

the result1 according to the definition of derivative along a vector v.

Now it is equal to result2 or result3 means that the direction derivative is equal to $\nabla T\bullet v$, the projection of the gradient of $T$ to $v$.

After that, we use Maximize to find the direction v which attain the maximum decrease of temperature T,and it is just equal to the normalize of -Grad.

Clear[T,p, p0, v];
T[x_, y_, z_] = x^2 + y^2 + 4 z^2;
p = {x, y, z};
p0 = {x0, y0, z0};
v = {α, β, γ};
result1 = 
  Limit[(T[Sequence @@ (p0 + t*v)] - T[Sequence @@ p0])/t, t -> 0, 
   Direction -> "FromAbove"];
result2 = Grad[T[Sequence @@ p], p].v /. Thread[p -> p0];
result3 = D[T[Sequence @@ p], {p}].v /. Thread[p -> p0];
result1 == result2 == result3
v /. Last@Maximize[{-result1, Total[v^2] == 1^2}, v] /. 
  Thread[p0 -> {2, -1, 2}] // Simplify


{-(2/Sqrt[69]), 1/Sqrt[69], -(8/Sqrt[69])}

  • $\begingroup$ thank you this was very helpful $\endgroup$ Nov 24 '20 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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