I was trying to substitute the "strain" in an expression with "displacement", and hopes to make it as general as possible in any dimensions. The relationship between the two is:
e(i,j)=(du(i)/dx(j)+du(j)/dx(i))/2 where e(i,j) and u(i) are function of coordinates.
So I first created two lists, coor={x,y,z} and list={#1,#2,#3}, which are special case for 3D. This two lists can be generated by other function so it can be generalized to other dimensions.
Then, I try to substitute e(i,j) in some test expressions, like this one:
D[e[1,2][x, y, z], y]
But I don't know how to perform such a substitution, I have tried:
D[e[1,2][x, y, z], y] /.
e[i_ , j_] :> ((D[Evaluate[u[i] @@ list], coor[[j]]] +
D[Evaluate[u[j] @@ list], coor[[i]]])/2 &)
which doesn't work. But something like:
D[e[1,2][x, y, z], y] /. e[i_ , j_] :> (Evaluate[u[i] @@ list] &)
works fine. This is not what I want, though. I want to substitute the e(i,j) with derivative of u(i) instead. How can I achieve this?
Thanks in advance!
Edit: fix a mistake in the test expression.