import math
# Given Data
n = 4; # no of component
A = [120*80,120*60/2,math.pi*60*60/2,-math.pi*40*40]; #mm**2, Areas of Recmath.tangle, triangle, Semicircle, and Circle respectively
x = [60,40,60,60]; #mm, x components of centroids of Recmath.tangle, triangle, Semicircle, and Circle respectively
y = [40,-20,105.46,80]; #mm, y components of centroids of Recmath.tangle, triangle, Semicircle, and Circle respectively
sumA = 0;
sumxA = 0;
sumyA = 0;
# Calculations and Results
for i in range(n):
sumA = sumA+A[i];
sumxA = sumxA+x[i]*A[i];
sumyA = sumyA+y[i]*A[i];
# First Moment of area
Qx = sumyA; # About X axis
Qy = sumxA; #About Yaxis
print "First moments of the area are Qx = %.0f mm**3 and Qy = %.0f mm**3 "%(Qx,Qy);
#Location of centroid
X = sumxA/sumA; # X co-ordinate
Y = sumyA/sumA; # Y co = ordinate
print "Co-ordinates of centroid are X = %.1f mm and Y = %.1f mm "%(X,Y);
import math
# Given Data
n = 3; # no of segment
L = [600,650,250]; #mm, Lengths of segment AB , BC and CA respectively
x = [300,300,0]; #mm, x components of centroids of segment AB , BC and CA respectively
y = [0,125,125]; #mm, y components of centroids of segment AB , BC and CA respectively
sumL = 0;
sumxL = 0;
sumyL = 0;
# Calculations
for i in range(n):
sumL = sumL+L[i];
sumxL = sumxL+x[i]*L[i];
sumyL = sumyL+y[i]*L[i];
#Location of centre of gravity
X = sumxL/sumL; # X co-ordinate
Y = sumyL/sumL; # Y co = ordinate
# Results
print "Co-ordinates of centroid are X = %.0f mm and Y = %.0f mm "%(X,Y);
#There is variation because of roundoff
import math
# Given Data
p = 7850.; #kg/m**3, density of steel rim
n = 2; # no of component
A = [(20+60+20)*(30+20),-60*30]; #mm**2,Cross section Areas of recmath.tangle I and II
y = [375,365]; #mm, y components of centroids of Recmath.tangles I and II respectively
sumV = 0;
C = [0,0]
V = [0,0]
# Calculations
for i in range(n):
C[i] = 2*math.pi*y[i]; #mm, Dismath.tance travelled by C
V[i] = A[i]*C[i]; #mm**3, Volume of 1 component
sumV = sumV+V[i]; # mm**3, Total volume of rim
sumV = sumV*10**(-9); #Conversion into m**3
g = 9.81; #m/s**2, acceleration due to gravity
m = p*sumV; #kg, mass
W = m*g; #N, Weight
# Results
print "mass of steel is m = %.0f kg and Wight is W = %.0f N"%(m,W);
# Given Data
n = 2; # no of triangle
A = [4.5,13.5]; #kN, loads
x = [2.,4.]; #mm, dismath.tances of centroid from point A
# Calculations and Results
sumA = 0;
sumxA = 0;
for i in range(n):
sumA = sumA+A[i];
sumxA = sumxA+x[i]*A[i];
#Location of centroid
X = sumxA/sumA; # X co-ordinate
W = sumA; #kN, Concentrated load
print "The equivalent concentrated mass is W = %.0f kN and its line of action is located at a\
\n distance X = %.1f m to the right of A "%(W,X);
# Reactions
# Applying sum(F_x) = 0
Bx = 0.; #N
#Applying sum(M_A) = 0
By = W*X/6.; #kN, Reaction at B in Y direction
#Applying sum(M_B) = 0
A = W*(6-X)/6; #kN, Reaction at B in Y direction
print "The rection at A = %.1f kN, At Bx = %.1f kN and By = %.1f kN "%(A,Bx,By);
# Given Data
t = 0.3; #m thickness of dam
g = 9.81; # m/s**2, acceleration due to gravity
p1 = 2400.; #kg/m**3, density of concrete
p2 = 1000.; #kg/m**3, density of water
W1 = 0.5*2.7*6.6*t*p1*g/1000; #kN, Weight of concrete component 1
W2 = 1.5*6.6*t*p1*g/1000; #kN, Weight of concrete component 2
W3 = 1./3*3*5.4*t*p1*g/1000; #kN, Weight of concrete component 3
W4 = 2./3*3*5.4*t*p2*g/1000; #kN, Weight of water
P = 0.5*2.7*6.6*t*p1*g/1000; #kN, pressure force exerted by water
# Calculations and Results
# Applying sum(F_x) = 0
H = 42.9; #kN, Horizontal reation at A
#Applying sum(Fy) = 0
V = W1+W2+W3+W4; #kN, Vertical Reaction at A
print "The horizontal reaction is H = %.1f kN \
\nVertical rection at A V = %.1f kN "%(H,V);
#Applying sum(M_A) = 0
M = W1*1.8+W2*3.45+W3*5.1+W4*6-P*1.8; #kN.m, Moment at A
# We can replace force couple system by math.single force acting at dismath.tance right to A
d = M/V; # m Dismath.tance of resultant force from A
print "The moment about A is M = %.1f kN.m anticlockwise and \
\nif we replace it by force couple system resultant, s distance from A is d = %0.2f m "%(M,d);
#Difference is because of round off
import math
# Given Data
n = 3; # no of component
r = 60.; #mm, radius
l = 100.; #mm length of cylinder
V = [0.5*4./3*math.pi*(r)**3,math.pi*r*r*l,-math.pi/3*r*r*l]; #mm**3, Volumes of Hemisphere, cylinder and cone respectively
x = [-3./8*r,l/2.,3./4*l]; #mm, x components of centroids of Hemisphere, cylinder and cone respectively
sumV = 0;
sumxV = 0;
# Calculations
for i in range(n):
sumV = sumV+V[i];
sumxV = sumxV+x[i]*V[i];
#Location of centre of gravity
X = sumxV/sumV; # X co-ordinate
# Results
print "Co-ordinates of centroid are X = %.0f mm "%(X);
import math
# Given Data
l = 4.5; # in in
b = 2.; #in
h = .5; #in
a_I = l*b*h
a_II = ((1./4)*math.pi*b**2*h)
a_III = -math.pi*(h**2)*h
a_IV = -math.pi*(h**2)*h
V = [a_I, a_II, a_III, a_IV]
#print (V)
x = [.25,1.3488,.25,.25]; #in, x components of centroids of part I,II , III and IV respectively
y = [-1,-0.8488,-1,-1]; #in, y components of centroids of part I,II , III and IV respectively
z = [2.25,0.25,3.5,1.5]; #in, z components of centroids of part I,II , III and IV respectively
# Calculations and Results
y = [0,0,0,0]
for i in range(4):
temp = 0
sum_xV = 0
sum_xV = V[i]*x[i]
y[i] = sum_xV
x = sum(y)
print "The sum of x*V = %f in**4 "%(x)
for i in range(4):
temp = 0
sum_zV = 0
sum_zV = V[i]*z[i]
y[i] = sum_zV
z = sum(y)
print "The sum of z*V = %f in**4 "%(z)
for i in range(4):
temp = 0
sum_yV = 0
sum_yV = V[i]*y[i]
y[i] = sum_yV
s = sum(y)
print "The sum of y*V = %f in**4 "%(s)