import math
# Variables
f1 = 20. #lb
f2 = 40. #lb
alpha = 30. #degrees
# Calculations
R = math.sqrt(f1**2+f2**2+2*f1*f2*math.cos(math.radians(alpha)))
angle = math.degrees(math.asin((f2*math.sin(math.radians(180-alpha)))/(R)))
# Results
print 'R = %.1f lb'%(R)
print 'angle = %.1f degrees'%(angle)
import math
# Variables
fx = 100. #lb
f1 = 200. #lb
f2 = 100. #lb
f3 = 50. #lb
a1 = 30. #degrees
a2 = 45. #degrees
a3 = 60. #degrees
# Calculations
Rx = fx+f1*math.cos(math.radians(a1))-f2*math.cos(math.radians(a2))-f3*math.cos(math.radians(a3))
Ry = f1*math.sin(math.radians(a1))+f2*math.sin(math.radians(a2))-f3*math.sin(math.radians(a3))
R = math.sqrt(Rx**2+Ry**2)
angle = math.degrees(math.atan(Ry/Rx))
# Results
print 'R = %.f lb'%(R)
print 'angle = %.1f degrees'%(angle)
import math
# Variables
f1 = 100. #lb
f2 = 200. #lb
x1 = 2.
x2 = -3.
y1 = 3.
y2 = 5.
z1 = 4.
z2 = -2.
# Calculations
d1 = math.sqrt(x1**2+y1**2+z1**2)
d2 = math.sqrt(x2**2+y2**2+z2**2)
f1x = f1*x1/d1
f1y = f1*y1/d1
f1z = f1*z1/d1
f2x = f2*x2/d2
f2y = f2*y2/d2
f2z = f2*z2/d2
Rx = f1x+f2x
Ry = f1y+f2y
Rz = f1z+f2z
R = math.sqrt(Rx**2+Ry**2+Rz**3)
I1 = Rx/R
I2 = Ry/R
I3 = Rz/R
# Results
print 'R = %d lb'%(R)
print 'I1 = %.3f '%(I1)
print 'I2 = %.3f '%(I2)
print 'I3 = %.3f '%(I3)
# note : rounding off error would be there for R.
import math
# Variables
F = 100. #lb
x1 = 6. #in
x2 = 8. #in
x3 = 2. #in
# Calculations
xab = math.sqrt(x1**2+x2**2)
d = x3*x1/xab
M1 = F*d
Fx = F*x2/xab
Fy = F*x1/xab
M2 = Fy*xab-Fx*x1
M3 = Fy*x3
# Results
print 'M1 = %.f lb.in'%(M1)
print 'M2 = %.f lb.in'%(M2)
print 'M3 = %.f lb.in'%(M3)
import math
# Variables
Fy1 = 2. #kips
Fy2 = 5. #kips
Fy3 = 10. #kips
Fy4 = 3. #kips
L = 5. #ft
# Calculations
Ry = Fy1+Fy2+Fy3+Fy4
x = (Fy1*L+Fy2*2*L+Fy3*3*L+Fy4*4*L)/Ry
# Results
print 'Ry = %.2f kips'%(Ry)
print 'x = %.1f ft to the right of O'%(x)
import math
# Variables
Fx1 = -15. #lb
Fx2 = 55. #lb
Fy1 = 70. #lb
Fy2 = -40. #lb
x1 = 4. #in
x2 = 3. #in
x3 = 5. #in
y1 = 4. #in
y2 = 2. #in
# Calculations
Rx = Fx1+Fx2
Ry = Fy1+Fy2
R = math.sqrt(Rx**2+Ry**2)
angle = math.degrees(math.atan(Ry/Rx))
# Results
print 'R = %.2f lb'%(R)
print 'angle = %.1f degrees'%(angle)
import math
# Variables
Fy = 200. #lb
Fx = 100. #lb
y = 3. #in
x = 6. #in
# Calculations
M = Fy*x-Fx*y
# Results
print 'Moment = %.2f lb in'%(M)