x = sym('x', [3 1], 'real');
syms rho g real
sig = [x(2) x(3) 0;
x(3) x(1) 0;
0 0 rho*g*x(3)];
b = [0; 0; -rho*g];
% primo quesito
divergence(sig(1,1:3), x) + b(1)
divergence(sig(2,1:3), x) + b(2)
divergence(sig(3,1:3), x) + b(3)
% secondo quesito
t1 = subs(sig, x(1), 1)*[1; 0; 0]
t2 = subs(sig, x(2), 1)*[0; 1; 0]
t3 = subs(sig, x(3), 1)*[0; 0; 1]
t1_ = subs(sig, x(1), 0)*[-1; 0; 0]
t2_ = subs(sig, x(2), 0)*[0; -1; 0]
t3_ = subs(sig, x(3), 0)*[0; 0; -1]
% terzo quesito
T1 = int(int(t1, x(2), 0, 1), x(3), 0, 1)
T2 = int(int(t2, x(1), 0, 1), x(3), 0, 1)
T3 = int(int(t3, x(1), 0, 1), x(2), 0, 1)
T1_ = int(int(t1_, x(2), 0, 1), x(3), 0, 1)
T2_ = int(int(t2_, x(1), 0, 1), x(3), 0, 1)
T3_ = int(int(t3_, x(1), 0, 1), x(2), 0, 1)
B = int(int(int(b, x(1), 0, 1), x(2), 0, 1), x(3), 0, 1)
R = T1 + T2 + T3 + T1_ + T2_ + T3_ + B