import math
#Variable declaration
l=1.5 # length of the cylindrical shaft
Tmax=120 # Maximum allowable torque
c1=0.02 # Inner radius
c2=0.03 # Outer radius
#Calculation
#Case(a)
J=(1/2.0)*(math.pi)*(c2**4-c1**4) # Polar moment of inertia
c=c2 # Letting c equal to c2
T=((J*Tmax*(pow(10,6)))/(c))/(1000.0) # Largest Permissible Torque
#Case(b)
Tmin=(c1/c2)*(Tmax) # Minimum Shearing Stress
#Result
print ('Largest permissible torque that can be applied to the shaft = %lf kN' %T)
print ('Minimum shearing stress that can be applied to the shaft = %lf MPa' %Tmin)
import math
from sympy import symbols, solve
#Variable declaration
Din=90/(1000.0) # Inner diamter of shaft BC(m)
Dout=120/(1000.0) # Outer diamter of shaft BC(m)
Tab=symbols('Tab')
Tbc=symbols('Tbc')
#Calculation
#Equations of statics
Tab=solve(6-Tab,Tab) # Torque in the shaft AB(kN.m)
Tbc=14+6 # Torque in the shaft BC(kN.m)
#Case(a) Shaft BC
J=((math.pi)/2.0)*((pow(Dout/2,4)-pow(Din/2,4))) # Polar moment of inertia(m**4)
# Maximum Shearing Stress
Tmax=((Tbc*(Dout/2))/(J))/(1000.0) # Maximum shearing stress(MPa)
#Minimum Shearing Stress
Tmin=(45/60.0)*86.2 # Minimum shearing stress(MPa)
#Case(b) Shafts AB and CD
c=((6*4)/(65*(math.pi)))**1/3 # Radius of the shafts(m)
#Result
print ('Maximum shearing stress in shaft BC = %lf MPa' %Tmax)
print ('Minimum shearing stress in shaft BC = %lf MPa' %Tmin)
print ('Required diamter of the shafts AB and CD = %lf mm' %(c*2*1000))
import math
#Variable declaration
din=4 # Inner diamter of shaft (in)
dout=6 # Outer diamter of shaft (in)
STRESS=12 # Shearing stress(ksi)
#Calculation
#Hollow Shaft as Designed.
J=((math.pi)/2.0)*(pow((dout/2),4)-pow((din/2),4)) # Polar moment of inertia(in**4)
Th=(J*STRESS)/3.0 # Allowable shearing stress(kip.in)
#Solid Shaft of Equal Weight
rad=math.sqrt((dout/2)**2-(din/2)**2) # Radius of solid shaft of equal weight(in)
Te=(12*(math.pi)*(pow(rad,3)))/2.0 # Maximum allowable torque(kip.in)
#Hollow Shaft of 8-in. Diameter.
c5=math.sqrt(4**2 + 2**2 -3**2) # Inner radius of hallow shaft(in)
J8=((math.pi)*(4**4-3.317**4))/2.0 # Polar moment of inertia(in**4)
Tor=((212)*(12))/4.0
# Result
print ('Case(a):Maximum torque that can be transmitted by the shaft as designed = %lf kip.in' %Th)
print ('Case(b):Maximum torque that can be transmitted by the shaft of equal weight = %lf kip.in' %Te)
print ('Case(c):Maximum torque that can be transmitted by the hollow shaft of equal weight and 8 in outer diameter = %lf kip.in' %Tor)
import math
#Variable declaration
G=77*(pow(10,9)) # Modulus of rigidity(GPa)
L=1.5 # length of the shaft(m)
TWIST=2 # Allowable twist
#Calculation
#Case(a)
phy=(2)*((2*(math.pi))/(360)) # Angle of twist(rad)
#Case(b)
J=1.021*(pow(10,-6)) # Polar moment of inertia(m**4)
T=(((J*G)/(L))*(phy))/(1000) # Torque to be applied to the end of shaft(kN.m)
# Result
print ('Maximum torque that can be transmitted by the shaft as designed = %lf kN.m' %T)
import math
#Variable declaration
tmin=70*(pow(10,6)) # Shearing stress(Pa)
G=77*(pow(10,9))*(1.0) # Modulus of rigidity(Pa)
L=1500 # ength of arc AA'(mm)
c1=20 # inner radius(mm)
#Calculation
#Case(a)
Ymin=tmin/G # shearing strain on the inner surface of the shaft
#Case(b)
phy=((L*Ymin)/(c1))*(360/(2*(math.pi))) # Angle of twist(degrees)
# Result
print ('Maximum torque that can be transmitted by the shaft as designed = %lf degree' %phy)
import math
from sympy import symbols
#Variable declaration
rA=symbols('rA') # Variable declaration
rB=symbols('rB') # Variable declaration
Tad=symbols('Tad') # Variable declaration
T=symbols('T') # Variable declaration
L=symbols('L') # Variable declaration
J=symbols('J') # Variable declaration
G=symbols('G') # Variable declaration
#Calculation
rA=2*rB # Given relation
Tad=2*T # Given relation
phya=(Tad*L)/(J*G) # Angle of rotation phyA of gear A
phyb=(rA/rB)*(phya) # Angle of rotation phyB of gear B
phyEB=(T*L)/(J*G) # Angle of rotation phyEB through which end E rotates with respect to end B
phyE=phyb+phyEB # Angle of rotation of end E
# Result
print ('Angle of rotation of end E')
print (phyE)
import math
from sympy import symbols, solve
#Variable declaration
L=10 # Outer Length(in)
r=(7/16.0) # Outer radius(in)
Li=5 # Internal Length(in)
ri=(5/16.0) # Inner radius(in)
L1=5 # Equivalent to internal length(in)
L2=5 # Equivalent to internal length(in)
Ta=symbols('Ta') # Torque at a
Tb=symbols('Tb') # Torque at b
L1=symbols('L1') # Length
L2=symbols('L2') # Length
J1=symbols('J1') # polar moment of inertia
J2=symbols('J2') # polar moment of inertia
G=symbols('G') # modulus of rigidity of steel.
#Calculation
Tb=solve(((Ta*L1)/(J1*G))-((Tb*L2)/(J2*G)),Tb) # Internal torque
Tb[0]=Tb[0].subs([ (J1, 57.6*(pow(10,-3))), (J2, 42.6*(pow(10,-3))),(L1, 5), (L2, 5)])
Ta=solve(90-Tb[0]-Ta,Ta) # Internal torque(lb.ft)
Tb=0.740*Ta[0] # Internal torque(lb.ft)
# Result
print ('Torque exerted on the shaft by support A. = %lf lb.ft' %Ta[0])
print ('Torque exerted on the shaft by support B. = %lf lb.ft' %Tb)
import math
from sympy import symbols, solve
#Variable declaration
Tab=symbols('Tab') # Torque on shaft AB
Tbc=symbols('Tbc') # Torque on shaft BC
Tcd=symbols('Tcd') # Torque on shaft CD
#Calculation
#Statics
Tab=solve(250-Tab,Tab) # Using the free body shown(N.m)
Tbc=2000+250 # Torque on BC(N.m)
Tcd=Tbc # Torque on CD(N.m)
#Polar Moments of Inertia
Jab=((math.pi)*((0.015)**4))/2.0 # Polar moment of inertia AB(m**4)
Jbc=((math.pi)*((0.030)**4))/2.0 # Polar moment of inertia BC(m**4)
Jcd=((math.pi)*((0.030)**4-(0.022)**4))/2.0 # Polar moment of inertia CD(m**4)
#Angle of Twist
AngleA=((1/77.0)*(((250*0.4)/(0.0795))+(((2250)*(0.2))/(1.272))+(((2250)*(0.6))/(0.904))))/((pow(10,-6))*(pow(10,9))*(1.0)) # Angle of twist(rad)
AngleA=AngleA*(360/(2*math.pi)) # convertiong radian into degree
# Result
print ('Angle of twist at end A = %lf degree' %AngleA)
import math
from sympy import symbols
#Variable declaration
T0=symbols('T0') # Variable declaration
Tab=symbols('Tab') # Variable declaration
F=symbols('F') # Force
phyB=symbols('phyB') # Variable declaration
phyC=symbols('phyC') # Variable declaration
Smax=8000 # Maximum permissible shearing stress(psi)
cAB=0.375 # Radius of shaft AB(in)
cCD=0.5 # Radius of shaft CD(in)
rC=2.45 # Radius at C(in)
rB=0.875 # Radius at B(in)
Tcd=symbols('Tcd') # Variable declaration
# Calculation
# Statics
T0=F *0.875 # Equation 1 by Submission of Mb
Tcd=F*2.45 # Equation 2 by Submission of Mc
phyB=phyC*(rC/rB) # By noting that the peripheral motions of the gears are equal
#Shaft AB
Tab=T0 # Variable declaration
T0=round((8000)*(1/2.0)*(math.pi)*(0.375)**3) # Largest torque that must be applied to end A of shaft AB(lb.in)
#Shaft CD
T0=symbols('T0') # Variable declaration
Tcd=2.8*T0 # Equation
T0=round((8000*(1/2.0)*(math.pi)*(0.5)**3)/2.8) # Largest torque that must be applied to end C of shaft CD(lb.in)
#Angle of Rotation at End A
#Shaft AB
phyAB=(((561)*(24))/((1/2.0)*(math.pi)*((0.375)**4)*(11.2*pow(10,6))))*(360/(2*math.pi))
#Shaft CD
phyCD=(((561)*(36)*(2.8))/((1/2.0)*(math.pi)*((0.5)**4)*(11.2*pow(10,6))))*(360/(2*math.pi))
phyC=phyCD
phyB=2.8*(phyC)
phyA=phyB+phyAB
#Result
print('Case(a): Maximum permissible torque = %.1f lb.in' %T0)
print('Case(b): The corresponding angle through which end A of shaft AB rotates = %.1f degrees' %phyA)
import math
from sympy import symbols
#Variable declaration
T0=symbols('T0') # Variable declaration
T1=symbols('T1') # Variable declaration
T2=symbols('T2') # Variable declaration
phy1=symbols('phy1') # Variable declaration
phy2=symbols('phy2') # Variable declaration
Ts=120 # Maximum allowable stress in stell(MPa)
Ta=70 # Maximum allowable stress in aluminum(MPa)
Gs=77 # Modulus of regidity for steel(GPa)
Ga=27 # Modulus of regidity for aluminium(GPa)
T0=T1+T2 # Equation
phy1=phy2 # Equation
T2=T1*(77/27)*(0.614/2.003) # Since both the tube and the shaft are connected to the rigid disk
# Shearing Stresses
T1=round(((70*pow(10,6))*(2.003*pow(10,-6)))/(0.038)) # Torque(N.m)
T2=(0.874)*(3690) # Torque(N.m)
tsteel=((3225)*(0.025)*(pow(10,-6)))/(0.614*pow(10,-6)) # Maximum shearing stress in steel shaft(MPa)
T2=round(((120)*pow(10,6)*(0.614*pow(10,-6)))/(0.025),-1) # Reobtaining torque as our earlier assumption was wrong(N.m)
T1=round(2950/0.874) # Torque(N.m)
T0=(T1+T2)/(1000) # maximum torque(N.m)
#Result
print('Case(a): Maximum permissible torque = %.1f lb.in' %T0)
import math
#Variable declaration
P=5 # Power(hp)
f=3600 # frequency(rpm)
Tmax=8500 # Maximum torque(psi)
#Calculation
P=P*(6600) # Converting power into lb/s
f=(3600)/(60.0) # Converting frequency into cycles per second
T=(P)/(2*(math.pi)*f) # Torque exerted on the shaft
Ratio=T/Tmax # Here we are finding the value of J/c
c=(((10.30)*(pow(10,-3))*(2))/(math.pi))**(1/3.0)
d=2*c # Diameter of the shaft that should be used
#Result
print('Case(a): Size of shaft = %1f lb.in' %d)
import math
from sympy import symbols, solve
#Variable declaration
P=100 # Power(kW)
f=20 # frequency(Hz)
c2=25 # radius(mm)
Smax=60 # Shearing stress maximum(MPa)
c1=symbols('c1')
#Calculation
T=P/(2*(math.pi)*f) # torque exerted on the shaft
Ratio=T/(Tmax*(pow(10,6))) # Here we are finding the value of J/c2
c1=solve((0.025)**4-(0.050/math.pi)*(13.26*(pow(10,-6)))-(c1)**4,c1)
Thickness=c2-(c1[1]*1000) # Thickness that should be used if the shearing stress is not to exceed
#Result
print('Case(a): Tube thickness that should be used = %1f lb.in' %Thickness)
import math
#Variable declaration
D=7.5 # Diameter of the bigger shaft(in)
d=3.75 # Diameter of the smaller shaft(in)
r=0.5625 # Inner radius(in)
k=1.33 # Stress concentration factor
#Calculation
temp1=(D/d)
temp2=(r/d)
T=round((1/2)*(math.pi)*((1.875)**3)*(8/1.33),1) # Maximum torque(ksi)
#Power
f=(900/60) # Frequency(Hz)
Pa=(2*(math.pi)*15*62.3*pow(10,3)) # Power(lb/s)
Pa=round(Pa/6600) # Power(hp)
#Final Design
r=15/16 # Radius(in)
temp2=(0.9375/3.75)
k=1.20 # Stress concentration factor
T=(10.35*(8/1.20)) # Torque(kip.in)
Pb=(2)*(math.pi)*(15)*(69)*(pow(10,3)) # Power(lb/s)
Pb=round(Pb/6600) # Power(hp)
#Percent Change in Power
PC=round(((Pb-Pa)/Pa)*100)
#Result
print('Case(a): Maximum power that can be transmitted = %1f hp' %Pa)
print('Case(b): Percentage in power = %1f ' %PC)
import math
from sympy import symbols, solve
#Variable declaration
l=1.2 # length(m)
d=50 # diameter(mm)
T=4.60 # torque(kN)
G=77 # modulus of rigidity(GPa)
ty=150 # torque(MPa)
c=25 # radius(mm)
py=symbols('py')
#Calculation
# Case(a)
J=(1/2)*(math.pi)*(25*(pow(10,-3)))**4 # Polar moment of inertia(m**4)
Ty=(J*ty*(pow(10,6)))/(c*(pow(10,-3))) # Torque(kN.m)
py=solve((py/c)**3-4+((3*4.60)/(3.68)),py) # Radius of elastic core(mm)
# Case(b)
phyY=(Ty*l*(pow(10,3)))/(J*G*(pow(10,9))) # Angle of twist at the onset of yield(rad)
phy=((93.4*(pow(10,-3)))/(0.630))*(360/(2*math.pi)) # Angle of twist(degree)
# Result
print('Case(a): Radius of elastic core = %1f mm' %py[0])
print('Case(b): Angle of twist = %1f degree ' %phy)
import math
#Variable declaration
T=4.60*(10**3) # Torque(N.m)
L=1.2 # length(m)
G=77*(10**9) # modulus of rigidity(Pa)
J=614*(10**-9) # Polar moment of inertia(m**4)
phy=8.50
c=25*(10**-3) # radius(m)
#Calculation
# Case(a)
phyl=((T*L)/(J*G))*(360/(2*(math.pi))) # Lateral twist(degree)
phyp=phy-phyl # Permanent twist(degree)
# Case(b)
Tlmax=((T*c)/(J))/(pow(10,6)) # Residual stresses(MPa)
# Result
print('Case(a): Permanent twist = %1f degree' %phyp)
print('Case(b): Residual stress = %1f MPa ' %Tlmax)
import math
from sympy import integrate, symbols
#Variable declaration
p=symbols('p')
G=(11.2*pow(10,6)) # Modulus of rigidity(GPa)
ty=21 # Stress(ksi)
#Calculation
#Geometric properties
c1=(1/2)*(1.5) # Radius(in)
c2=(1/2)*(2.25) # Radius(in)
J=round((1/2)*(math.pi)*(c2**4-c1**4),2) # Polar moment of inertia(in**4)
#Case(a) Onset of yield
tmax=ty
Ty=round(((21)*(2.02))/1.125,1) # Torque at y(kip.in)
phyY=((21*(10**3))*(60))/(1.125*11.2*pow(10,6)) # Onset of yield(rad)
phyY=round(phyY*(360/(2*math.pi)),2)
#Case(b) Fully Plastic Deformation
Tp=round(2*math.pi*21*integrate(p**2, (p, c1, c2)),1) # Torque(kip.in)
phyF=round((21*pow(10,3)*60)/(0.75*11.2*pow(10,6)),4) # Fully plastic deformation(rad)
phyF=round(phyF*(360/(2*math.pi)),2)
# Result
print('Case(a): Magnitude of T when yield first occurs = %1f degree' %phyY)
print('Case(b): Angle of twist when the deformation has become fully plastic.= %1f MPa ' %phyF)
import math
#Variable declaration
Tp=44.1
phyF=8.59
# Calculation
# Elastic Unloading
Tmax=((44.1)*(1.125))/2.02
Tmin=(Tmax)*(0.75/1.125)
phyl=round(((44.1*pow(10,3)*60)*(360/(2*math.pi)))/((2.02)*(11.2*pow(10,6))),2)
phy=phyF-phyl
# Result
print('Case(a): Residual stress = %1f kip.in' %(0))
print('Case(b): Permanent angle of twist= %1f degree ' %(phy))
import math
#Variable declaration
t=0.160 # thickness(in)
T=24 # Torque(kip.in)
#Calculation
# Case(a)
Area=3.84*2.34 # Area bounded by centre line(in**2)
t=(T)/(2*t*Area) # shearing stress in wall(ksi)
# Case(b)
tABAC=0.120
tBDCD=0.200
tAB=(T)/(2*tABAC*Area) # shearing stress in wall(ksi)
tAC=tAB
tBD=(T)/(2*tBDCD*Area) # shearing stress in wall(ksi)
tCD=tBD
# Result
print('Case(a): Shearing stress in each wall = %1f ksi' %t)
print('Case(b): Shearing stress in wall AB and AC= %1f ksi ' %tAB)
print('Case(b): Shearing stress in wall BD and CD= %1f ksi ' %tCD)
import math
#Bar with Square Cross Section
#Variable declaration
tALL=40 # Stress(MPa)
#Calculation
# Bar with square cross section
a=0.040 # Length(m)
b=0.040 # Length(m)
temp=(a/b)
c1=0.208 # Coefficient
tmax=tALL # Maximum stress(MPa)
T1=(40)*(pow(10,6))*(0.208)*(pow(0.040,3)) # Torque(N.m)
# Bar with Rectangular Cross Section.
a=0.064 # Length(m)
b=0.025 # Length(m)
temp2=(a/b)
T2=(40)*(pow(10,6))*(0.259)*(0.064)*(pow(0.025,2)) # Torque(N.m)
#Square Tube
A=(0.034)*(0.034) # Area bounded by the center line of the cross section(m**2)
T3=round((40)*(pow(10,6))*(2)*(0.006)*(1.156)*(pow(10,-3)),0) # Torque(N.m)
# Result
print('Largest torque on bar with square cross section = %1f N.m' %T1)
print('Largest torque on bar with rectangular cross section = %1f N.m' %T2)
print('Largest torque on square tube = %1f N.m' %T3)