Define tensor as a derivative - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-19T15:48:49Z https://mathematica.stackexchange.com/feeds/question/187819 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/187819 2 Define tensor as a derivative Ilya Bryukhanov https://mathematica.stackexchange.com/users/61887 2018-12-13T11:48:07Z 2019-05-12T14:02:46Z <p>I have the tensor which is expressed in terms of coordinate vector. I want to define tensor which is the derivative of the former tensor with respect to the coordinate axis: <span class="math-container">$$X = (x_1, x_2, x_3) \\ TD_{\alpha \beta \gamma} = \frac{\partial T_{\alpha \beta}}{\partial x_\gamma}$$</span> However, I want to get the result in terms of general expressions of tensors, for example: <span class="math-container">$$T_{\alpha \beta} = x_\alpha x_\beta \\ TD_{\alpha \beta \gamma} = \delta_{\alpha \gamma} x_\beta + x_\alpha \delta_{\beta \gamma}$$</span> And also I want if that's possible to evaluate certain components of the tensor at given <span class="math-container">$x_\alpha$</span> in code.</p> <p>What I have now in Wolfram <em>Mathematica</em> is the following:</p> <pre><code>X = {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]}; r := Sqrt[Sum[(X[[i]]^2, {i, 3}]]; T[i_, j_] :=KroneckerDelta[i, j]/r + X[[i]] X[[j]] / r^3 TD[i_, j_, k_] := D[T[i, j], X[[k]]]; </code></pre> <p>However, that does not allow me to see the whole tensor TD. The program evaluates it as zero:</p> <pre><code>TD[i, j, k] 0 </code></pre> https://mathematica.stackexchange.com/questions/187819/-/187821#187821 1 Answer by Αλέξανδρος Ζεγγ for Define tensor as a derivative Αλέξανδρος Ζεγγ https://mathematica.stackexchange.com/users/12924 2018-12-13T12:02:03Z 2018-12-13T12:02:03Z <p>How about this</p> <pre><code>X = Array[Subscript[x, #] &amp;, 3]; T = Outer[Times, X, X]; TD = D[T, {X}]; TD2 = Array[KroneckerDelta[#, #3] Subscript[x, #2] + Subscript[x, #] KroneckerDelta[##2] &amp;, {3, 3, 3}]; TD == TD2 </code></pre> <blockquote> <pre><code>True </code></pre> </blockquote>