import math
# Variables
W = 3000. #lb
L = 10. #ft
Wf1 = 1200. #lb
Wf2 = 1500. #lb
angle = 30. #degrees
# Calculations
d1 = Wf1*math.cos(angle)*L/W
d2 = Wf2*L/W
xbc = d1/math.cos(angle)
xab = d2-xbc
y = xab/math.tan(math.radians(angle))
# Results
print 'x = %.2f ft'%(d2)
print 'y = %.2f ft'%(y)
# Variables
W4 = 3. #lb
W3 = 5. #lb
W2 = 2. #lb
W1 = 6. #lb
x1 = 10. #in
x2 = 4. #in
z = 5. #in
# Calculations
W = W1+W2+W3+W4
x = (W1*0+W2*0+W3*x2+W4*x1)/W
z = (W1*z+W2*0+W3*0+W4*0)/W
# Results
print 'x = %.2f in'%(x)
print 'z = %.2f in'%(z)
import math
# Variables
W1 = 3. #lb
W2 = 5. #lb
x1 = 8. #in
x2 = 7. #in
y1 = 2. #in
y2 = 5. #in
z1 = 6. #in
z2 = 4. #in
# Calculations
W = W1+W2
x = (W1*x1+W2*x2)/W
y = (W1*y1+W2*y2)/W
z = (W1*z1+W2*z2)/W
# Results
print 'x = %.2f in'%(x)
print 'y = %.2f in'%(y)
print 'z = %.2f in'%(z)
import math
# Variables
L = 9. #in
B = 16. #in
B1 = 6. #in
d = 2. #in
# Calculations
x = ((L*(B-B1)*(L/2)+(1./2)*L*B1*(L/3)-(math.pi/4)*d**2*(L/2)))/(L*(B-B1)+(1./2)*L*B1-(math.pi/4)*d**2)
y = ((L*(B-B1)*((B-B1)/2)+(1./2)*L*B1*(B1/3+(B-B1))-(math.pi/4)*d**2*((B-B1)/2)))/(L*(B-B1)+(1./2)*L*B1-(math.pi/4)*d**2)
# Results
print 'x = %.2f in to the right of y-axis'%(x)
print 'y = %.2f in above x axis'%(y)
# Variables
Gt = 0.25 #in
St = 0.25 #in
Gw = 3.5 #lb/sq ft
Sw = 10. #lb/sq ft
Sb = 36. #in
Sb1 = 18. #in
Sb2 = 12. #in
Sb3 = 6. #in
Sy1 = 6. #in
Sy2 = 12. #in
Sy3 = 6. #in
Gb = 1. #ft
Sh = 24. #in
Gh = 1. #ft
# Calculations
W = ((Sb*Sh)/(12*12)-(Gh*Gb))*Sw+(Gh*Gb)*Gw
x = ((Sb*Sh)*Sw*(Sb/24)/(12*12)-(Gh*Gb)*Sw*((Sb1+(Sb2/2))/12)+(Gh*Gb)*Gw*((Sb1+(Sb2/2))/12))/W
# Results
print 'centre of gravity = %.2f ft to the right of y-axis'%(x)