% Declare any needed symbolic variables
syms A B C D x y L h q sig_y sig_x tau_xy
% Define the given stress function
phi = A*x^2 + B*x^2*y + C*y^3 + D*(5*x^2*y^3 – y^5);
% Check Eq. (2.9)
check = diff(phi,x,4) + 2*diff(diff(phi,x,2),y,2) þ diff(phi,y,4);
if double(check) == 0
disp(‘The stress function is valid’)
disp(‘ ’)
% Calculate expressions for sig_y, sig_x, and tau_xy
eqI = diff(phi,x,2) – sig_y;
eqII = diff(phi,y,2) – sig_x;
eqIII = diff(diff(phi,x),y) + tau_xy;
% From Fig. 2.3, sig_y=0 at y=h so that from eqI
eqIV = subs(subs(eqI,y,h),sig_y,0);
% From Fig. 2.3, sig_y=-q at y¼-h so that from eqI
eqV = subs(subs(eqI,y,-h),sig_y,-q);
% From Fig. 2.3, tau_xy=0 at y=+/-h so that from eqIII
eqVI = subs(subs(eqIII,y,h),tau_xy,0);
% Calculate the expression of the applied moment
M = int(solve(eqII,sig_x)*y, y, -h, h);
% From Fig. 2.3, M=0 at x=0
eqVII = subs(M,x,0);
% Solve eqIV, eqV, eqVI, and eqVII for A, B, C, and D
D_expr = solve(subs(eqIV-eqV,B,solve(eqVI,B)), D);
C_expr = solve(subs(eqVII,D,D_expr), C);
B_expr = solve(subs(eqVI,D,D_expr), B);
A_expr = solve(subs(subs(eqIV,D,D_expr),B,B_expr), A);
% Substitute the expressions for A, B, C, and D into phi
phi = subs(subs(subs(subs(phi,A,A_expr),B,B_expr),C,C_expr),D,D_expr);
% Output the expression for phi to the Command Window
phi = factor(phi)
else
disp(‘The stress function does not satisfy the biharmonic equation (Eq. (2.9))’)
disp(‘ ’)
end