#Given
ep_x = 500 #Normal Strain
ep_y = -300 #Normal Strain
gamma_xy = 200 #Shear Strain
#Calculation
import math
theta = 30*(math.pi/180)
theta = theta*-1
ep_x_new = ((ep_x+ep_y)/2) + ((ep_x - ep_y)/2)*math.cos(2*theta) + (gamma_xy/2)*math.sin(2*theta)
gamma_xy_new = -((ep_x - ep_y)/2)*math.sin(2*theta) + (gamma_xy/2)*math.cos(2*theta)
gamma_xy_new = 2*gamma_xy_new
phi = 60*(math.pi/180)
ep_y_new = (ep_x+ep_y)/2 + ((ep_x - ep_y)/2)*math.cos(2*phi) + (gamma_xy/2)*math.sin(2*phi)
#Display
print'The equivalent strain acting on the element oriented at 30 degrees clockwise = ',round(ep_y_new,1),"*10**-6"
print'The equivalent shear strain acting on the element = ',round(gamma_xy_new,0),"10**-6"
#Given
ep_x = -350.0 #(*10**-6) Normal Strain
ep_y = 200.0 #*(10**-6) Normal Strain
gamma_xy = 80.0 #*(10**-6) Shear Strain
#Calculation
#Orientation of the element
import math
tan_thetap = (gamma_xy)/(ep_x - ep_y)
thetap1 =math.atan(tan_thetap)*180/3.14+180
thetap=thetap1/2.0
#Principal Strains
k = (ep_x + ep_y)/2
l = (ep_x - ep_y)/2
tou = gamma_xy/2
R = math.sqrt( (l)**2 + tou**2)
ep1 = R + k
ep2 = k -R
ep_x1 = k + l*math.cos(2*-4.14*3.14/180.0)+ tou*math.sin(2*-4.14*3.14/180.0)
#Display
print'The orientation of the element in the positive counterclockwise direction = ',round(thetap,1),"degree"
print'The principal strains are ',round(ep1,0),"*10**-6 and ",round(ep2,0),"*10**-6"
print'The principal strain in the new x direction is ',round(ep_x1,0),"*10**-6"
#Given
ep_x = -350 #(*10**-6) Normal Strain
ep_y = 200.0 #*(10**-6) Normal Strain
gamma_xy = 80.0 #*(10**-6) Shear Strain
#Orientation of the element
import math
tan_thetap = -(ep_x - ep_y)/(gamma_xy)
thetap1 = math.atan(tan_thetap)*180/3.14+180
thetap=thetap1/2.0
#Maximum in-plane shear strain
l = (ep_x - ep_y)/2
tou = gamma_xy/2
R = sqrt( l**2 + tou**2)
max_inplane_strain = 2*R
gamma_xy_1 = (-l*math.sin(2*thetap1)+ tou*math.cos(2*thetap1))*2
strain_avg = (ep_x + ep_y)/2
thetap1 = thetap1*(180/math.pi)
thetap2 = (90 + thetap1)
#Display
print'The orientation of the element =',round(thetap,0,),"degre"
print'The maximum in-plane shear strain = ',round(max_inplane_strain,0),"*10**-6"
print'The average strain =',strain_avg,"*10**-6"
#Given
ep_x = 250.0 #(*10**-6) Normal Strain
ep_y = -150.0 #*(10**-6) Normal Strain
gamma_xy = 120.0 #*(10**-6) Shear Strain
#Calculation
#Construction of the circle
import math
strain_avg = (ep_x + ep_y)/2
tou = gamma_xy/2
R = sqrt((ep_x - strain_avg)**2 + (tou**2))
#Principal Strains
ep1 = (strain_avg + R)
ep2 = (strain_avg - R)
tan_thetap = (tou)/(ep_x - strain_avg)
thetap1 = (math.atan(tan_thetap))/2.0
thetap1 = thetap1*(180/math.pi)
#Display
print'The principal strains are = ',round(ep1,0),"*10**-6 and ",round(ep2,0),"*10**-6"
print'The orientation of the element = ',round(thetap1,2),"degree"
#Given
ep_x = 250 #(*10**-6) Normal Strain
ep_y = -150 #*(10**-6) Normal Strain
gamma_xy = 120 #*(10**-6) Shear Strain
#calculation
#Orientation of the element
thetas = 90 - 2*8.35
thetas1 = thetas/2
#Maximum in-plane shear strain
l = (ep_x - ep_y)/2
tou = gamma_xy/2
R = sqrt( l**2 + tou**2)
max_inplane_strain = 2*R
strain_avg = (ep_x + ep_y)/2
#Display
print'The orientation of the element ',thetas1,"degree"
print'The maximum in-plane shear strain',round(max_inplane_strain,0),"*10**-6"
print'The average strain = ',strain_avg,"*10**-6"
#Given
ep_x = -300 #(*10**-6) Normal Strain
ep_y = -100 #*(10**-6) Normal Strain
gamma_xy = 100 #*(10**-6) Shear Strain
theta = 20 #degrees
#Calculation
#Construction of the circle
import math
strain_avg = (ep_x+ ep_y)/2.0
tou = gamma_xy/2.0
R = sqrt((-ep_x + strain_avg)**2 + tou**2)
#Strains on Inclined Element
theta1 = 2*theta
phi = math.atan((tou)/(-ep_x +strain_avg))
phi = phi*(180/math.pi)
psi = theta1 - phi
psi = psi*(math.pi/180)
ep_x1 = -(-strain_avg+ R*math.cos(psi))
gamma_xy1 = -(R*math.sin(psi))*2
ep_y1 = -(-strain_avg - R*math.cos(psi))
#Display
print'The normal strain in the new x direction = ',round(ep_x1,0),"10**-6"
print'The normal strain in the new y direction = ',round(ep_y1,1),"10**-6"
print'The shear strain in the new xy direction = ',round(gamma_xy1,0),"10**-6"
#Given
ep_x = -400 #(*10**-6) Normal Strain
ep_y = 200 #*(10**-6) Normal Strain
gamma_xy = 150 #*(10**-6) Shear Strain
#calculation
#Maximum in-plane Shear Strain
strain_avg = (ep_x+ ep_y)/2
tou = gamma_xy/2
R = sqrt((-ep_x + strain_avg)**2 + tou**2)
strain_max = strain_avg + R
strain_min = strain_avg - R
max_shear_strain = strain_max - strain_min
#Absolute Maximum Shear Strain
abs_max_shear = max_shear_strain
#Display
print'The maximum in-plane shear strain= ',round(max_shear_strain,0),"10**-6"
print'The absolute maximum shear strain ',round(abs_max_shear,0),"10**-6"
#Given
import math
ep_a = 60.0 #(*10**-6) Normal Strain
ep_b = 135.0 #*(10**-6) Normal Strain
ep_c = 264.0 #*(10**-6) Normal Strain
theta_a = 0
theta_b = 60*(math.pi/180)
theta_c = 120*(math.pi/180)
#Calculation
a1 = (math.cos(theta_a))**2
b1 = (math.sin(theta_a))**2
c1 = math.cos(theta_a)*math.sin(theta_a)
a2 = (math.cos(theta_b))**2
b2 = (math.sin(theta_b))**2
c2 = math.cos(theta_b)*math.sin(theta_b)
a3 = (math.cos(theta_c))**2
b3 = (math.sin(theta_c))**2
c3 = math.cos(theta_c)*math.sin(theta_c)
ep_x = 60 #*10**-6
ep_y = 246 #*10**-6
gamma_xy = -149 #*10**-6
strain_avg = (ep_x + ep_y )/2.0
tou = gamma_xy/2.0
R = sqrt((-ep_x + strain_avg)**2 + tou**2)
ep1 = strain_avg + R
ep2 = strain_avg - R
tan_thetap =math.atan(-tou/(-ep_x + strain_avg))
thetap = tan_thetap/2.0
thetap2 = thetap*(180/math.pi)
#Display
print'The maximum in-plane principal strains are',round(ep1,0),"*10**-6 and ",round(ep2,1),"*10**-6"
print'The angle of orientation ',round(thetap2,1),"degree"
#Given
E_st = 200*10**9 #GPa
nu_st = 0.3 #Poisson's ratio
ep1 = 272 *10**-6
ep2 = 33.8 *10**-6
#Solving for the equations
#6.78*10**-6=sigma2-0.3sigma1
#54.4*10**-6=sigma1-0.3sigma2
sigma2= 25.4
#Display
print'The principal stresses at point A are ',sigma1,"MPa and " ,sigma2,"Mpa"
#Given
a = 300.0 #mm
b = 50.0 #mm
t = 20.0 #mm
E_cu = 120*10**3 #MPa
nu_cu = 0.34 # Poisson's ratio
#By inspection
sigma_x = 800 #MPa
sigma_y = -500.0 #MPa
tou_xy = 0
sigma_z = 0
#calculation
#By Hooke's Law
ep_x = (sigma_x/E_cu) - (nu_cu/E_cu)*(sigma_y + sigma_z)
ep_y = (sigma_y/E_cu) - (nu_cu/E_cu)*(sigma_x + sigma_z)
ep_z = (sigma_z/E_cu) - (nu_cu/E_cu)*(sigma_y + sigma_x)
#New lengths
a_dash = a + ep_x*a
b_dash = b + ep_y*b
t_dash = t + ep_z*t
#Display
print'The new length = ',round(a_dash,1),"mm"
print 'The new nas base is',round(b_dash,1),"mm"
print'The new thickness = ',round(t_dash,2),"mm"
#Given
p = 20 #psi, pressure
E = 600 #psi, pressure
nu = 0.45
#the given dimension are:
a = 4 #in
b = 2 # in
c = 3 #in
#Calculation
#Dilatation
sigma_x = -p
sigma_y = -p
sigma_z = -p
e = ((1-2*nu)/E)*(sigma_x + sigma_y + sigma_z)
#Change in Length
ep = (sigma_x - nu*(sigma_y + sigma_z))/E
del_a = ep*a
del_b = ep*b
del_c = ep*c
#Display
print'The change in length a = ',round(del_a,4),"inch"
print'The change in length b = ',round(del_b,4),"inch"
print'The change in length c = ',round(del_c,4),"inch"
#Given
T = 400 #lbft, tourqe
sigma_ult = 20000 #psi
#Calculations
import math
x = T*12/(math.pi/2)
r=(x/sigma_ult)**(1/3.0)
#Display
print'The smallest radius of the solid cast iron shaft ',round(r,3),"inch"
#Given
import math
sigmay=36 #ksi, stress
r = 0.5 #cm
sigma_yield = 360 #MPa, yield stress
T = 3.25 #kN/cm
A= (math.pi*r**2)
P = 15 #kN
J = (math.pi/2.0)*(r**4)
sigma_y_sqr = sigma_yield**2
#Calculations
sigma_x = -(P/A)
sigma_y = 0
tou_xy = (T*r)/J
k = (sigma_x + sigma_y)/2.0
R = sqrt(k**2 + (tou_xy**2))
sigma1 = k+R
sigma2 = k-R
l = sigma1 - sigma2
#Maximum Shear Stress Theory
x=sigma1-sigma2
y=sigma1**2+sigma2**2-sigma1*sigma2
if x>sigmay:
print"Shear failure of material will occur"
else:
print"not"
if y<sigmay**2:
print"Failure will not occur"
else:
print"it will occur"