from math import pi
#variable declaration
D=0.505;
Lo=2;
Lf=2.53;
Py=15000;
Pmax=18500;
Pf=16200;
D_f=0.315;
#calculation
A0=pi*D**2/4;
Af=pi*D_f**2/4;
s_u=Pmax/A0;
s0=Py/A0;
s_f=Pf/A0;
e_f=(Lf-Lo)/Lo;
q=(A0-Af)/A0;
#result
print('\nUltimate Tensile Strength = %g psi\n0.2 percent offset yield strength = %g psi\nBreaking Stress = %g psi\nElongation = %g percent\nReduction of Area = %g percent\n\n\nNote: Slight Computational Errors in book')%(s_u,s0,s_f,e_f*100,q*100);
from math import log
#case 1
#variable declaration
Af=100.0;
Lf1=60.0;
A0=150.0;
L01=40.0;
Lf=83.0;
L0=40.0;
Df=8.0;
D0=12.8;
#calculation
L1=float (Lf1/L01);
A1=float (A0/Af);
ef11=log(L1);
ef21=log(A1);
L2=(Lf/L0);
D2=D0/Df;5
ef12=log(L2);
ef22=2*log(D2);
#result
print('\nTrue Strain to fracture using changes in length = %g\nTrue Strain to fracture using changes in area = %g')%(ef11,ef21);
print('\n\n\nFor More ductile metals\nTrue Strain to fracture using changes in length = %g\nTrue Strain to fracture using changes in diameter = %g')%(ef12,ef22);
from math import exp
#variable declaration
def sigma(e):
return 200000*e**0.33;
E_u=0.33;
#calculation
sigma_u=sigma(E_u);
s_u=sigma_u/exp(E_u);
#result
print('Ultimate Tensile Strength = %g psi')%(s_u);
#variable declaration
C_70=10.2;
C_825=2.1;
m_70=0.066;
m_825=0.211;
e1=1;
e2=100;
#calculation 1
print('\nAt 70deg F\n');
sigma_a=C_70*e1**m_70;
sigma_b=C_70*e2**m_70;
#result 1
print('sigma_a = %g ksi\nsigma_b = %g ksi\nsigma_b/sigma_a = %g\n')%(sigma_a,sigma_b,sigma_b/sigma_a);
#calculation 2
print('\n\nAt 825deg F\n');
sigma_a=C_825*e1**m_825;
sigma_b=C_825*e2**m_825;
#result 2
print('sigma_a = %g ksi\nsigma_b = %g ksi\nsigma_b/sigma_a = %g\n')%(sigma_a,sigma_b,sigma_b/sigma_a);