import math
#Variable declaration
E=29*(pow(10,6)) # Modulus of elasticity(psi)
L1=12 # Length(in)
L2=12 # Length(in)
L3=16 # Length(in)
A1=0.9 # Area(in**2)
A2=0.9 # Area(in**2)
A3=0.3 # Area(in**2)
P1=60*(pow(10,3)) # Internal force(lb)
P2=15*(pow(10,3)) # Internal force(lb)
P3=30*(pow(10,3)) # Internal force(lb)
#Calculation
Delta=round((1/E)*(((P1*L1)/A1)+(-(P2*L2)/A2)+((P3*L3)/A3)),4) # deformation of the steel rod(in)
#Result
print ('Deformation of the steel rod = %lf in' %Delta)
import math
from sympy import symbols,solve
#Variable declaration
Eab=70*(pow(10,9)) # Modulus of elasticity of AB(GPa)
Aab=500*(pow(10,-6)) # Cross sectional area of AB(mm**2)
Ecd=200*(pow(10,9)) # Modulus of elasticity of CD(GPa)
Acd=600*(pow(10,-6)) # Cross sectional area of CD(mm**2)
Fe=30 # Force(kN)
Pb=-60*(pow(10,3)) # Internal force in link AB(kN)
n=-1
Pd=90*(pow(10,3)) # Internal force in link CD(kN)
Lab=0.3 # Length of AB(m)
Lcd=0.4 # Length of CD(m)
x=symbols('x') # Variable declaration
Se=symbols('Se') # Variable declaration
#Calculation
#Free Body: Bar BDE
Fcd=(30*0.6)/(0.2) # Force of tension(kN)
Fab=n*(30*0.4)/(0.2) # Force of compression(kN)
#Case(a)
#Deflection of B.
Sb=((Pb*Lab)/(Aab*Eab))*(1000) # Deflection of B(mm)
#Case(b)
#Deflection of D.
Sd=((Pd*Lcd)/(Acd*Ecd))*(1000) # Deflection of D(mm)
#Case(c)
#Deflection of E.
x=solve(((200-x)/x)-((0.514)/(0.300)),x) # Distance HD(mm)
Se=solve(((400+73.7)/73.7)-(Se/0.300),Se) # Deflection of E(mm)
#Result
print('Case(a): Deflection of B = %1f psi' %Sb)
print('Case(b): Deflection of D = %lf psi' %Sd)
print('Case(c): Deflection of E = %lf psi' %Se[0])
import math
from sympy import symbols,solve
#Variable declaration
Lb=18 # Length of Bolt CD(in)
Pb=symbols('Pb') # Force(kips)
Ab=((1/4.0)*(math.pi)*pow(0.75,2)) # Area of cross section of CD and GH(in**2)
Eb=(29*(pow(10,6))) # Modulus of elasticity of steel(psi)
Lr=12 # Length of Bolt EF(in)
Pr=symbols('Pr') # Force(kips)
Ar=((1/4.0)*(math.pi)*pow(1.5,2)) # Area of cross section of EF(in**2)
Er=((10.6)*(pow(10,6))) # Modulus of elasticity of aluminium(psi)
n=-1
#Calculation
# Bolts CD and GH
Sb=((Pb*Lb)/(Ab*Eb)) # Deformation
# Rod EF
Sr=n*((Pr*Lr)/(Ar*Er)) # Deformation
# Displacement of D Relative to B
Eq=(1/4.0)*(0.1)-Sb+Sr # Because displacements are equal to the deformations of the bolts and of the rod
# Free Body: Casting B
#Pr-2*Pb=0 # Submission of forces is zero
# Forces in Bolts and Rod
Pb=(solve((Eq).subs(Pr,(2*Pb)))[0])/(1000.0) # Force in the bolt(kips)
Pr=2*Pb # Force in th rod(kips)
# Stress in Rod
er=Pr/Ar # Stress in rod(ksi)
#Result
print('Stress in rod = %1f ksi' %er)
import math
from sympy import symbols, solve
#Variable declaration
P1=symbols('P1') # Axial force
L=symbols('L') # Length of rod
A1=symbols('A1') # Cross section of rod
E1=symbols('E1') # Modulus of elasticity
P2=symbols('P2') # Axial force
A2=symbols('A2') # Cross section of rod
E2=symbols('E2') # Modulus of elasticity
P=symbols('P') # Total axial force
#Calculation
S1=(P1*L)/(A1*E1) # Deforamation in rod
S2=(P2*L)/(A2*E2) # Deformation in rod
P1=((P2)/(A2*E2))*(A1*E1) # Equating deformations S1 and S2
P2=solve(P1-P+P2,P2) # Solving the above equation for P2
P1=((P2[0]/(A2*E2))*(A1*E1)) # Solving for P1
S1=(P1*L)/(A1*E1)
S2=(P2[0]*L)/(A2*E2)
#Result
print("Deformation in the rod :-")
print(S1)
print("Deformation in the tube :-")
print(S2)
import math
from sympy import symbols,solve
#Variable declaration
Ra=symbols('Ra') # Reaction at A
Rb=symbols('Rb') # Reaction at B
P=symbols('P') # Net reaction
S=symbols('S') # Total elongation
S1=symbols('S1') # Elongation of AC
S2=symbols('S2') # Elongation of BC
L1=symbols('L1') # Length of AC
L2=symbols('L2') # Length of BC
P1=symbols('P1') # Internal force
P2=symbols('P2') # Internal force
A=symbols('A') # Area of cross section
E=symbols('E') # Modulus of elasticity
#Calculation
S1=(P1*L1)/(A*E) # Elongation of AC
S2=(P2*L2)/(A*E) # Elongation of BC
S=S1+S2 # Total elongation of the bar
S=0 # Total elongation of the bar is zero
x=solve((Ra*L1-Rb*L2, Ra+Rb-P), Ra, Rb) # Solving the equations to find reactions at A and B.
e1=(x[Ra])/A # Stress in AC
e2=(x[Rb])/A # Stress in BC
#Result
print("Stress in AC :-")
print(S1)
print("Stress in BC :-")
print(S2)
import math
from sympy import symbols, solve
#Variable declaration
P1=0 # Force in the first portion(N)
P2=600*(pow(10,3)) # Force in the second portion(N)
P3=600*(pow(10,3)) # Force in the third portion(N)
P4=900*(pow(10,3)) # Force in the forth portion(N)
E=symbols('E') # Modulus of elasticity
Rb=symbols('Rb') # Reaction at B(N)
n=-1
A1=400*(pow(10,-6)) # Area of cross section of first portion(m**2)
A2=400*(pow(10,-6)) # Area of cross section of second portion(m**2)
A3=250*(pow(10,-6)) # Area of cross section of third portion(m**2)
A4=250*(pow(10,-6)) # Area of cross section of forth portion(m**2)
L1=0.150 # Length of first portion(m)
L2=0.150 # Length of second portion(m)
L3=0.150 # Length of third portion(m)
L4=0.150 # Length of forth portion(m)
#Calculation
Sl=((600*(pow(10,3)))/(400*(pow(10,-6))) + (600*(pow(10,3)))/(250*(pow(10,-6))) + (900*(pow(10,3)))/(250*(pow(10,-6))))*(0.150/E) # Deformation(m)
P1=n*Rb # Force on first portion(N)
P2=n*Rb # Force on second portion(N)
A1=400*(pow(10,-6)) # Area of cross section of first portion(m**2)
A2=250*(pow(10,-6)) # Area of cross section of second portion(m**2)
L1=0.300 # Length of first portion(m)
L2=0.300 # Length of second portion(m)
Sr=(P1*L1)/(A1*E) + (P2*L2)/(A2*E) # Deformation(m)
Rb=solve(Sl+Sr,Rb) # Reaction at B(N)
Ra=900+(Rb[0]) # Reaction at A(N)
#Result
print('Reaction at A = %lf' %Ra)
print('Reaction at B = %lf' %Rb[0])
import math
from sympy import symbols, solve
#Variable declaration
E=200*(pow(10,9)) # Modulus of elasticity(GPa)
Rb=symbols('Rb') # Reaction at B(N)
Ra=symbols('Ra') # Reaction at A(N)
#Calculation
Rb=(solve(((1.125*(pow(10,9)))/(200*(pow(10,9))))-(((1.95*(pow(10,3)))*Rb)/(200*(pow(10,9))))-(4.5*(pow(10,-3))),Rb))[0]/(10**3) # Solving for Rb(N)
Ra=solve(Ra-900+Rb,Ra) # Solving for Ra(N)
#Result
print('Reaction at A = %lf' %Ra[0])
print('Reaction at B = %lf' %Rb)
import math
from sympy import symbols, solve
#Variable declaration
E=29*(pow(10,6))*(1.0) # Modulus of elasticity(psi)
Alpha=6.5*(pow(10,-6)) # Constant(/F)
n=-1
L1=12 # Length of AC(m)
L2=12 # Length of CB(m)
A1=0.6 # Area of cross section of AC(m**2)
A2=1.2 # Area of cross section of BC(m**2)
Rb=symbols('Rb') # Reaction at B(N)
P1=Rb # Internal force(N)
P2=Rb # Internal force(N)
DELTAt=n*(50+75) # Diff in temperature(F)
AC=12 # Length of AC(m)
CB=12 # Length of CB(m)
#Calculation
St=Alpha*DELTAt*24 # Deformation(in)
Sr=((P1*L1)/(A1*E)) + ((P2*L2)/(A2*E)) # Deformation(in)
Rb=(solve(St+Sr,Rb))[0]/(1000.0) # Reaction at B(kips)
S1=(Rb)/A1 # Stress in portion AC(ksi)
S2=(Rb)/A2 # Stress in portion CB(ksi)
Et=Alpha*DELTAt # Thermal strain(in./in.)
Ratio=S1/E # Other component of eAC(in./in.)
Eac=Et + S1/E # Component of strain in AC(in)
Ecb=Et + S2/E # Component of strain in CB(in)
Sac=Eac*(AC) # Deformation of rod AC(in)
Scb=Ecb*(CB) # Deformation of rod CB(in)
#Result
print('Stress in portion AC = %lf' %S1)
print('Stress in portion CB = %lf' %S2)
import math
from sympy import symbols
#Variable declaration
Ldf=30 # Length of DF(in)
Adf=(1/4.0)*(math.pi)*(3/4.0)*(3/4.0) # Cross sectional area of DF(in**2)
Lce=24 # Length of CE(in)
Ace=(1/4.0)*(math.pi)*(1/2.0)*(1/2.0) # Cross sectional area of DF(in**2)
E=(10.6*pow(10,6)) # Molulus of elasticity(psi)
Fce=symbols('Fce') # Force on CE(N)
Fdf=symbols('Fdf') # Force on DF(N)
Sd=symbols('Sd') # Force on CE(N)
#Calculation
# Case(a)
# Statics
Eq=Fce*12 + Fdf*20 - 180 # Because submission of Mb is 0
# Geometry
Sc=0.6*Sd # By using similar triangles
Sa=0.9*Sd # By using similar triangles
# Deformations
Sc=(Fce*Lce)/(Ace*E) # Deformation at C(in)
Sd=(Fdf*Ldf)/(Adf*E) # Deformation at D(in)
Fce=0.333*Fdf # By solving Sc= 0.6*Sd we get this result
# Force in Each Rod
Fdf=(180/(((12)*(0.333))+20)) # By using Eq and the value of Fce
Fce=0.333*Fdf # Force in CE(N)
# Case(b)
# Deflections
Sd=(Fdf*(pow(10,3))*Ldf)/(Adf*E) # Deflection of point D(in)
Sa=0.9*Sd # Deflection of point A(in)
#Result
print('Case(a): Force in rod DF = %.1f psi' %Fdf)
print('Case(a): Force in rod CE = %lf psi' %Fce)
print('Case(b): Deflection of point A = %lf psi' %Sa)
import math
from sympy import symbols
#Variable declaration
Ldf=30 # Length of DF(in)
Adf=(1/4.0)*(math.pi)*(3/4.0)*(3/4.0) # Cross sectional area of DF(in**2)
Lce=24 # Length of CE(in)
Ace=(1/4.0)*(math.pi)*(1/2.0)*(1/2.0) # Cross sectional area of DF(in**2)
E=(10.6*pow(10,6)) # Molulus of elasticity(psi)
Fce=symbols('Fce') # Force on CE(N)
Fdf=symbols('Fdf') # Force on DF(N)
Sd=symbols('Sd') # Force on CE(N)
Rb=symbols('Rb') # Reaction at B(m)
#Calculation
Ra=0.4*Rb # By considering the free body motion
L=0.3 # Length of rod DE(m)
DeltaT=30 # Change in temperature(C)
Alpha=(20.9*pow(10,-6)) # Constant(/C)
A=(1/4)*(math.pi)*(pow(0.22,2)) # Area of cross-section of rod AC(m**2)
E=200 # Molulus of elasticity(psi)
St=L*(DeltaT)*Alpha # Deflection(m)
temp=(L/(A*E))
Sc=str(temp)+'*Ra' # Deflection(m)
Sd=str(0.4)+'*Sc' # Deflection(m)
Sd=4.74*pow(10,-9) # After computing the above equation
Sbd=str(4.04*pow(10,-9))+'*Ra' # Deflection(m)
S1=str(5.94*pow(10,-9))+'*Rb' # Deflection(m)
Rb=((188.1*pow(10,-6))/(5.94*pow(10,-9)))/(pow(10,3)) # Reaction at B(m)
db=((round(Rb,1))/((1/4.0)*(math.pi)*(pow(0.03,2))))/(pow(10,3)) # Stress in cylinder(MPa)
#Result
print('Stress in cylinder = %.1f MPa' %db)
import math
#Variable declaration
P=12*(pow(10,3)) # Axial load(kN)
r=8*(pow(10,-3)) # Radius of the rod(m)
n=-1
#Calculation
A=(math.pi)*(r**2) # Cross sectional area of rod(m**2)
Sx=(P/A) # Stress in cylinder(MPa)
Ex=(300/500.0) # Strain()
Ey=(n*(2.4))/16.0 # Strain()
E=Sx/Ex # Modulus of elasticity(GPa)
v=n*(Ey/Ex) # Poissons ratio()
#Result
print('Modulus of elasticity = %.1f GPa' %E)
print('Poissons ratio = %.1f ' %v)
import math
from sympy import symbols, solve
#Variable declaration
E=29*(pow(10,6)) # Modulus of elasticity(GPa)
v=0.29 # Poissons ratio()
Sx=symbols('Sx') # Strain variable
Sy=symbols('Sy') # Strain variable
Sz=symbols('Sz') # Strain variable
Ex=symbols('Ex') # Stress variable
Ey=symbols('Ey') # Stress variable
Ez=symbols('Ez') # Stress variable
p=symbols('p') # pressure
n=-1
Sx=n*p # Strain at x
Sy=n*p # Strain at y
Sz=n*p # Strain at z
Ey=Ez=Ex # Equating all the stresses
#Calculation
# Case(a)
Ex=((n*p)*(1-(2*v)))/E # Stress
Ex=(n*1.2*(pow(10,3)))/4 # Stress(in./in)
DELTAy=n*(300*(pow(10,-6)))*(2) # Change in length(in)
DELTAz=n*(300*(pow(10,-6)))*(3) # Change in length(in)
# Case(b)
p=(solve(p+((29*(pow(10,6)))*(n*300*(pow(10,-6))))/(1-0.58),p)[0])/(pow(10,3)) # pressure(ksi)
#Result
print('Change in length in y direction = %1f in' %DELTAy)
print('Change in length in z direction = %1f in' %DELTAz)
print('Pressure = %.1f ksi' %p)
import math
#Variable declaration
p=180 # Hydrostatic pressure(MPa)
E=200 # Modulus of elasticity(GPa)
v=0.29 # Poissons ratio()
#Calculation
k=E/(3*(1-(2*v))) # Bulk modulus of steel(GPa)
e=-p/k # Dialation
V=80*40*60 # Volume of block in unstressed state(mm**3)
DELTAv=(e*V)/(pow(10,3)) # change in volume per unit volume
# Results
print('Change in volume = %1f mm**3' %DELTAv)
import math
#Variable declaration
G=90 # Modulus of rigidity(ksi)
disp=0.04 # Displacement of upper rod(in)
Lda=2 # Height of bar(in)
A=8*2.5 # Area of cross section(in**2)
#Calculation
Yxy=(disp/Lda) # Shearing strain(rad)
Txy=(90*(pow(10,3)))*(0.020) # Shearing stress(psi)
P=(Txy*A)/(pow(10,3)) # Force exerted on the upper plate(kips)
# Results
print('Shearing strain in rod=%1f rad' %Yxy)
print('Force exerted on the upper plate=%1f kips' %P)
import math
#Variable declaration
Ex=155.0 # Modulus of elasticity in x direction(GPa)
Ey=12.10 # Modulus of elasticity in y direction(GPa)
Ez=12.10 # Modulus of elasticity in z direction(GPa)
Vxy=0.248 # Poissons ratio in xy direction
Vxz=0.248 # Poissons ratio in xz direction
Vyz=0.458 # Poissons ratio in yz direction
n=-1
F=140*(pow(10,3)) # Compressive load(kN)
L=0.060 # Length of cube(m)
#Calculation
#(a) Free in y and z Directions
Sx=(n*F)/(0.060*0.060) # Stress in x direction(MPa)
Sy=0 # Stress in y direction(MPa)
Sz=0 # Stress in z direction(MPa)
ex=Sx/Ex # Lateral strains
ey=n*((Vxy*Sx)/Ex) # Lateral strains
ez=n*((Vxy*Sx)/Ex) # Lateral strains
DELTAx=ex*L # Change in cube dimension in x direction(um)
DELTAy=ey*L # Change in cube dimension in y direction(um)
DELTAz=ez*L # Change in cube dimension in z direction(um)
#(b) Free in z Direction, Restrained in y Direction
Sx=n*38.89 # Stress in x direction(MPa)
Sy=(Ey/Ex)*(Vxy)*(Sx) # Stress in y direction(MPa)
Vyx=(Ey/Ex)*(Vxy) # Poissons ratio
ex=(Sx/Ex)-(((Vyx)*(Sy))/Ey) # Lateral strains in x direction
ey=0 # Lateral strains in y direction
ez=n*((Vxz*Sx)/Ex)-(((Vyz)*(Sy))/Ey) # Lateral strains in z direction
DELTAx=ex*L*1000 # Change in cube dimension in x direction(um)
DELTAy=ey*L # Change in cube dimension in y direction(um)
DELTAz=ez*L*1000 # Change in cube dimension in z direction(um)
# Results
print('Change in cube dimension in x direction=%1f um' %DELTAx)
print('Change in cube dimension in y direction=%1f um' %DELTAy)
print('Change in cube dimension in z direction=%1f um' %DELTAz)
import math
#Variable declaration
d=9 # Diameter of the rod(in)
t=3/4.0 # Thickness of the rod(in)
ex=12 # Normal stresses(ksi)
ez=20 # Normal stresses(ksi)
E=(10*pow(10,6)) # Moduluus of elasticity(psi)
v=(1/3) # Poissons ratio
V=15*15*(3/4.0) # Volume(in**3)
n=-1
#Calculation
STRAINx=(1/(pow(10,7)*(1.0)))*(12-(20/3.0))*(1000) # Strain in x direction(in./in)
STRAINy=n*(1/(pow(10,7)*1.0))*((12/3.0)+(20/3.0))*(1000) # Strain in y direction(in./in)
STRAINz=(1/(pow(10,7)*(1.0)))*(20-(12/3.0))*(1000) # Strain in z direction(in./in)
#Case(a)
DELTAba=(STRAINx)*(d) # Change in diameter(in)
#Case(b)
DELTAcd=(STRAINz)*(d) # Change in diameter(in)
#Case(c)
DELTAt=(STRAINy)*(t) # Change in thickness(in)
#Case(d)
e=(STRAINx+STRAINy+STRAINz) # Volume of the plate(in**3)
DeltaV=(e*V)
# Results
print('Change in diamter of rod AB =%1f in' %DELTAba)
print('Change in diamter of rod CD =%1f in' %DELTAcd)
print('Change in thickness =%1f in' %DELTAt)
print('Volume of the plate =%1f in**3' %DeltaV)
import math
#Variable declaration
D=60 # Width(mm)
d=40 # Width(mm)
r=8 # Radius(mm)
K=1.82 # Stress-concentration factor
Smax=165 # Allowable normal stress(MPa)
#Calculation
eave=(165/1.82) # Average stress in the narrower portion(MPa)
P=round((40*10*eave)/(1000),1) # Largest Axial Load(kN)
# Results
print('Largest Axial Load =%1f in' %P)
import math
#Variable declaration
L=500.0 # Length of rod(mm)
A=60 # Cross Sectional area(mm**2)
E=200 # Modulus of elasticity(GPa)
ey=300 # Yield Point(MPa)
DELTAc=7 # Stretch(mm)
#Calculation
ec=DELTAc/L # Maximum strain permitted on point C
ey=(ey*(pow(10,6)))/(E*(pow(10,9))*(1.0)) # Maximum strain permitted on point Y
ed=ec-ey # Strain after unloading
DELTAd=ed*L # Deformation(mm)
# Results
print('Permanent set deformation =%1f mm' %DELTAd)
from sympy import symbols, solve
#Variable declaration
Lad=2 # Length of AD(m)
Lce=5 # Length of CE(m)
E=200.0 # Modulus of elasticity(GPa)
ey=300 # Stress(MPa)
Aad=400 # Area of cross section of AD(mm**2)
Ace=500.0 # Area of cross section of CE(mm**2)
STRAINad=ey/E # Stress(MPa) #
#Calculation
Pad=symbols('Pad') # Variable declaration
Pce=symbols('Pce') # Variable declaration
Pce=Pad
Q=symbols('Q') # Variable declaration
Q=2*Pad # Force(kN)
d=ey # Maximum elastic deflection of point A
PadM=ey*Aad # Maximum force(kN)
Q=(2*PadM)/(1000.0) # Maximum force(kN)
Sa1=STRAINad*Lad # Maximum deflection of point A(mm)
Pce=120 # This implies Pad is also 120
ece=Pce/Ace # Stress in rod CE(MPa)
STRAINce=ece/E # Strain CE
Sc1=STRAINce*Lce # Deflection of point C(mm)
Sb=(1/2)*(Sa1+Sc1) # Deflection of point B(mm)
# Since we must have Sb 10 mm, we conclude that plastic deformation will occur.
# Plastic Deformation
eAD=ey # Equating stresses
Sc=6 # Deflection in C(mm)
Sa2=symbols('Sa2') # Variable declaration
Sa2=solve(((1/2)*(Sa2+6)-10),Sa2) # The deflection Sa for which Sb = 10
# Unloading
Sa3=14-3 #Since the stress in rod CE remained within the elastic range, we note that the final deflection of point C is zero.
print('Required maximum value of Q =%.1f mm' %Q)
print('The final position of the beam =%1f mm' %Sa3)