from __future__ import division
from scipy import integrate
from sympy import symbols
import math
#eqn 15.30 K=S(pi*a)^1/2*alpha
S=175 #stress range (N/mm^2)
K=1708 #fracture toughness (n/mm^3/2)
alpha=1 #constant
n=4 #constant
C=40*10**-15 #rate of crack growth (mm/cycle)
ai=0.1 #initial crack length
alpha_f=K**2/S**2/math.pi
Nf=2/C/(n-2)/(S*math.pi**0.5)**n*(1/ai**((n-2)/2)-1/alpha_f**((n-2)/2))
print "Number of cycles to failure = %5.0f cycles\n"%(Nf)