I am new user in Mathematica. I am working with liquid crystal theory, and one of the notation there is the tensor:

$ \Pi_{ij} = \frac {\partial {F_{el}}} { \partial ( \partial {n_i} / \partial { x_j})}$

Where numerator is scalar, denominator is tensor (matrix).

In order to calculate it in Mathematica, I introduce:

nd[x_, y_, z_] = {n1[x, y], n2[x, y], 0}
Fel = ***Some expression (nd) ***
g = D[nd[x, y, z], {r}]

After that I need to take a derivative of Fel over a tensor g. But as long as I am restricted to a 2D space {x,y}, my tensor g looks like:

g= (n1^(1,0)(x,y)   n1^(0,1)(x,y)   0
    n2^(1,0)(x,y)   n2^(0,1)(x,y)   0
    0               0               0)

It is not allowed to differentiate over zero. Mathematically, zero values must be omitted (the corresponding term must be set to zero).



1 Answer 1


In five days no one gave an answer, so I will post what I developed, although it is a poor solution:

You can fill zeros of the tensor with variables that are not used, like z1,z2,z3,.... Now the derivative over this variables is zero, so I got desired result


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.