I have an expression from a continuum model,which looks somewhat like this excluding a few constants. enter image description here

Here epsilon is the 3x3 strain tensor and sigma is 3x3 stress tensor. I wish to compute the derivative of sigma with respect to epsilon. As you may see, it is an implicit relation and it is posing some challenges which I am unable to work around.

I have tried using the ImplicitD function, which works well for computing the derivative of implicit scalar functions. For instance, if y = sin(y)+x , then the derivative of y with respect to x is 1/(1-cos(y)). This is correctly computed by the ImplicitD function in Mathematica.

ImplicitD[y, Sin[y] + x - y == 0, y, x]


1/(1 - Cos[y])

as expected. However, when I tried using ImplicitD for the same for the matrix expression mentioned above,

ImplicitD[sig, -1/(1 - Tr[eps])*Tr[sig]*IdentityMatrix[3] + 1/(1 - Tr[eps])*sig - eps == 0, eps]

I get the following error: enter image description here

Please help. I am new to this forum, and please pardon the difficulties caused earlier.

  • 1
    $\begingroup$ You have probably posted this question on the wrong site. This site is about Wolfram Mathematica Software, while your question is about mathematics, and should be posted on Mathematics StackExchange. $\endgroup$
    – Domen
    Jan 16, 2023 at 14:57
  • 1
    $\begingroup$ No, I know to compute the derivative by hand. I want to know how to do the same operation, specifically in Mathematica. $\endgroup$
    – Goutham
    Jan 16, 2023 at 15:03
  • 2
    $\begingroup$ Then please include all relevant information: (1) how to compute the derivative by hand, and (2) Mathematica code for your tensors or whatever you have tried so far. $\endgroup$
    – Domen
    Jan 16, 2023 at 15:04
  • 1
    $\begingroup$ The community expects the following from you: ✅: A clear description of an on-topic problem or goal. ❌: A minimal working Wolfram Language code example, formatted, easy to copy&paste, in Raw InputForm,not images. ❌. An example of what you expect as output. ❌. Some proof of minimal Mathematica knowledge. ❌. Minimum due diligence: Share how you have searched the site and documentation, your attempts and reasons to believe an answer exists. $\endgroup$
    – rhermans
    Jan 16, 2023 at 15:17
  • 1
    $\begingroup$ If you are unable to do all the things that @rhermans thoroughly explained, at least give a PROPER mathematical description of the problem. $\endgroup$
    – bmf
    Jan 16, 2023 at 15:27

1 Answer 1


It is not clear what the derivative relative to a matrix means. I assume that you mean the derivative relative to each matrix element. This can be done with "D".

For simplicity to get you started, here is a 2D example: To get the derivative of matrix ms relative to matrix me, we must write the matrix elements of ms as functions of the elements of me:

n = 2;
me = Array[e, {n, n}];
vars = Flatten[me]
ms = Array[(StringJoin["s", ToString[#1], ToString[#2]] @@ 
     vars) &, {n, n}]

enter image description here

Now, for your problem, we first solve the implicit equation for the elements of matrix sigma, then we replace the elements of sigma by the solutions and do the derivative:

sig = Array[
  Symbol@StringJoin["s", ToString[#1], ToString[#2]] &, {n, n}]
sol = Solve[-1/(1 - Tr[eps])*Tr[sig]*IdentityMatrix[2] + 
    1/(1 - Tr[eps])*sig - eps == 0, Flatten[sig]]

![enter image description here

sig1 = sig /. sol[[1]]

![enter image description here

D[sig1, {{Flatten[eps]}}]

![enter image description here

  • $\begingroup$ Thank you for the precise answer sir! This is exactly what I was looking for. $\endgroup$
    – Goutham
    Jan 16, 2023 at 19:53

Your Answer

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

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