# Create matrix of derivatives

Given the following definitions,

Clear["Global*"]
Remove["Global*"]
n = 4;
wb = Table[Sum[qw[i, j] x^j, {j, n}], {i, 2}]
ub = Table[Sum[qu[i, j] x^j, {j, n}], {i, 2}];

um = Sum[0.5*ub[[i]], {i, 2}]
wm = 1/h (wb[[1]] - wb[[2]])


can someone help construct the matrix in the image below?

I tried to do it with the following code:

nx = 4;
ny = 3;
u = Sum[{qx[i, j], qy[i, j]} x^i y^j, {i, 1, nx}, {j, 0, ny}]


but I couldn't get it to work.

mat = {{D[um, x], 0.5 D[um, x] + D[wm, x]}, {0.5 D[um, x] + D[wm, x], D[wm, x]}};
mat // FullSimplify


gives:

 {{
0.5 qu[1, 1] + 0.5 qu[2, 1] + x (1. qu[1, 2] +
1. qu[2, 2] + x (1.5 qu[1, 3] + 2. x qu[1, 4] +
1.5 qu[2, 3] + 2. x qu[2, 4])), 0.25 (qu[1, 1] +
x (2 qu[1, 2] + x (3 qu[1, 3] + 4 x qu[1, 4]))) +
0.25 (qu[2, 1] + x (2 qu[2, 2] + x (3 qu[2, 3] +
4 x qu[2, 4]))) + (1/h)(qw[1, 1] - qw[2, 1] + x
(2 qw[1, 2] - 2 qw[2, 2] + x (3 qw[1, 3] + 4 x
qw[1, 4] - 3 qw[2, 3] - 4 x qw[2, 4])))
},
{
0.25 (qu[1, 1] + x (2 qu[1, 2] + x (3 qu[1, 3] +
4 x qu[1, 4]))) + 0.25 (qu[2, 1] + x (2 qu[2, 2]
+ x (3 qu[2, 3] + 4 x qu[2, 4]))) + (1/h)(qw[1,
1] - qw[2, 1] + x (2 qw[1, 2] - 2 qw[2, 2] + x (3
qw[1, 3] + 4 x qw[1, 4] - 3 qw[2, 3] - 4 x qw[2,
4]))), (1/h)(qw[1, 1] - qw[2, 1] + x (2 qw[1, 2]
- 2 qw[2, 2] + x (3 qw[1, 3] + 4 x qw[1, 4] - 3
qw[2, 3] - 4 x qw[2, 4])))
}}


It not the best way but it works like that:

\[CurlyEpsilon] = ( {
{D[um, {x}], 0.5*(D[um, {x}] + D[wm, {x}])},
{0.5*(D[um, {x}] + D[wm, {x}]), D[wm, {x}]}
} );