import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-15.1 Page No.332\n');
##Torque
P=5.;
n=1750.;
T=63000.*P/n;
print'%s %.2f %s '%('\n Torque = ',T,' in-lb.');
##Length of key for shear
Su=61000.;
Ss=0.5*Su;
b=0.125;
D=0.5;
Ls1=2*T/(Ss*b*D);
SF=2.5;
Ls=SF*Ls1;
print'%s %.2f %s '%('\n Length of key for shear = ',Ls,' in.');
##Length of key for compression
Sc=51000.;
t=0.125;
Lc1=4.*T/(Sc*t*D);
Lc=SF*Lc1;
print'%s %.2f %s '%('\n Length of key for compression = ',Lc,' in.');
import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-15.2 Page No.335\n');
##Torque capacity
Ss=30500.;
D=1.;
L=2.;
T1=Ss*math.pi*D**2*L/16.;
SF=2.;
T=T1/SF;
print'%s %.2f %s '%('\n Torque capacity 1 = ',T,' in-lb.');
n=6.;
d=0.81;
A=(D-d)*L*n/2.;
S=1000.;
rm=(1.+0.810)/4.;
T2=S*A*rm;
print'%s %.2f %s '%('\n Torque capacity 2 = ',T2,' in-lb.');