# Solve function returns expression in terms of z

21 views (last 30 days)
Ashmika Gupta on 2 Mar 2021
Edited: David Goodmanson on 2 Mar 2021
I am trying to solve for a function but I keep getting an answer in terms of z. I don't know what this means or how to fix it so that I get an answer that makes sense. I do not want to use vpa solve because I want a symbolic answer. Please advise.
EA=30000;
alpha=30;
beta=30;
gamma=180-(alpha+beta);
a=20;
n=6;
L_ab=a;
L_bc=(a*sind(alpha))/(sind(beta));
L_ac=(a*sind(alpha+beta))/(sind(beta));
hmax=L_bc*cosd(180-(90+(180-gamma)));
syms r h phi
U=((n*EA)/2)*(L_ab*((2*(r/L_ab)*sin(pi/n)-1)^2)+L_bc*(((sind(beta)/sind(alpha))*sqrt(((h/L_ab)^2)...
-(2*((r/L_ab)^2)*cos(phi))+2*((r/L_ab)^2)))-1)^2+L_ac*((sind(beta)/sind(alpha+beta))*sqrt(((h/L_ab)^2)...
-(2*((r/L_ab)^2)*cos(phi+(2*pi/n)))+(2*((r/L_ab)^2)))-1)^2);
dphi=diff(U,phi)
dr=diff(U,r)
sol=solve(dphi==0, h)
I am getting the following solution
sol1 =
(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 1)^2 - 2*r^2)^(1/2)
(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 2)^2 - 2*r^2)^(1/2)
(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 3)^2 - 2*r^2)^(1/2)
(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 4)^2 - 2*r^2)^(1/2)
-(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 1)^2 - 2*r^2)^(1/2)
-(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 2)^2 - 2*r^2)^(1/2)
-(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 3)^2 - 2*r^2)^(1/2)
-(2*r^2*cos(phi + pi/3) + root(z^4 - (z^3*(6*sin(phi + pi/3)^3 + 18*sin(phi)^2*sin(phi + pi/3) + 12*3^(1/2)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z^2*(3*3^(1/2)*sin(phi + pi/3)^3 - 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi)*sin(phi)^3 + 18*r^2*cos(phi + pi/3)*sin(phi)^3 - 3*3^(1/2)*sin(phi)^2*sin(phi + pi/3) - 18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 + 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 - 2*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 + 2*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 - 18*3^(1/2)*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) + 18*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3)))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) + (z*(12*r^2*cos(phi)*sin(phi + pi/3)^3 - 12*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3 + 36*r^2*cos(phi)*sin(phi)^2*sin(phi + pi/3) - 36*r^2*cos(phi + pi/3)*sin(phi)^2*sin(phi + pi/3) + 24*3^(1/2)*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 24*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2))/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)) - (18*r^2*cos(phi)*sin(phi)*sin(phi + pi/3)^2 - 18*r^2*cos(phi + pi/3)*sin(phi)*sin(phi + pi/3)^2 + 6*3^(1/2)*r^2*cos(phi)*sin(phi + pi/3)^3 - 6*3^(1/2)*r^2*cos(phi + pi/3)*sin(phi + pi/3)^3)/(3^(1/2)*sin(phi + pi/3)^3 + 9*sin(phi)^3 + 9*sin(phi)*sin(phi + pi/3)^2 + 9*3^(1/2)*sin(phi)^2*sin(phi + pi/3)), z, 4)^2 - 2*r^2)^(1/2)
Ashmika Gupta on 2 Mar 2021
For example, I dphi==0 which yields this
[(1407374883553280*r^2*sin(phi + pi/3)*((3^(1/2)*(h^2 - 2*r^2*cos(phi + pi/3) + 2*r^2)^(1/2))/3 - 1))/(5252394570717173*(h^2 - 2*r^2*cos(phi + pi/3) ...
+ 2*r^2)^(1/2)) + (1407374883553280*r^2*sin(phi)*((h^2 - 2*r^2*cos(phi) + 2*r^2)^(1/2) - 1))/(5252394570717173*(h^2 - 2*r^2*cos(phi) + 2*r^2)^(1/2)) == 0
I just want this in terms of h

David Goodmanson on 2 Mar 2021
Edited: David Goodmanson on 2 Mar 2021
Hello Ashmika,
You do have a symbolic solution for h, which goes to show that symbolic solutions are not always the ideal.
There are eight solutions in all. Each one contains, among other things, a roots function, the roots of a 4th degree polynomial in z
roots(z^4 + z^3*A(r,phi) + z^2*B(r,phi) +... D(r,phi), z, k)
where the coefficents A(r,phi) etc are complicated functions of r and phi. Here z is just a dummy variable, and the roots are determined by the coefficients A,B,C,D. Four distinct roots are indicated by cycling k through 1,2,3,4 as you can see at the end of each of the first four very long lines of code.
That's four solutions. The other four solutions have the same values for the roots, the only difference being that the expression at the beginning of each line
2*r^2*cos(phi + pi/3)
has positive sign for the first four solutions and negative sign for the last four solutions.
The four roots are merely indicated by the index k. Since this is a polynomial of degree four, it is possible to write each of the four roots explicitly in terms of A,B,C,D but if you think you have long expressions now, those expressions might be several times longer.
A symblic expression that takes up a page of text begins to lose its effectiveness. You can still do calculaton by plugging values or even more symbolic epressions into them, but at some point one might consider just doing a numerical calculation from the beginning.
Walter Roberson on 2 Mar 2021
EA=30000;
alpha=30;
beta=30;
gamma=180-(alpha+beta);
a=20;
n=6;
L_ab=a;
L_bc=(a*sind(alpha))/(sind(beta));
L_ac=(a*sind(alpha+beta))/(sind(beta));
hmax=L_bc*cosd(180-(90+(180-gamma)));
syms r h phi
U=((n*EA)/2)*(L_ab*((2*(r/L_ab)*sin(pi/n)-1)^2)+L_bc*(((sind(beta)/sind(alpha))*sqrt(((h/L_ab)^2)...
-(2*((r/L_ab)^2)*cos(phi))+2*((r/L_ab)^2)))-1)^2+L_ac*((sind(beta)/sind(alpha+beta))*sqrt(((h/L_ab)^2)...
-(2*((r/L_ab)^2)*cos(phi+(2*pi/n)))+(2*((r/L_ab)^2)))-1)^2);
dphi=diff(U,phi)
dphi =
dr=diff(U,r)
dr =
sol=solve(dphi==0, h)
sol =
rootexprs = findSymType(sol, 'root');
ch1 = children(rootexprs(1));
syms z
detailed_roots = solve(ch1{1}, z, 'MaxDegree', 4);
detailed_sols = subs(sol, rootexprs, detailed_roots.');
detailed_sols(1)
ans =
... Now what?