from __future__ import division
import math
#Given
#Variable declaration
h=20 #height in m
D=4 #External diameter in m
d=2 #Internal diameter in m
p=1 #Horizontal wind pressure in kN/sq.m
w=22 #specific weight in kN/m^3
K=2/3 #Co-efficient of wind resistance
#Calculation
A1=(math.pi/4)*(D**2-d**2) #Area of cross-section
W=w*A1*h #Weigth of the chimney in kN
sigma0=W/A1 #Direct stress in kN/sq.mm
A2=D*h #Projected area of the surface exposed to wind in sq.m
F=K*p*A2 #Wind Force in kN
M=F*h/2 #Bending moment in kNm
I=(math.pi/64)*(D**4-d**4) #Moment of inertia
y=D/2 #Distance between C.G. of the base section and extreme edge of the base
Z=I/y #Section modulus
sigmab=M/Z #Bending stress
sigma_max=round(sigma0+sigmab,2) #Maximum stress in kN/sq.m
sigma_min=round(sigma0-sigmab,2) #Minimum stress in kN/sq.m
#Result
print"Maximum stress =",sigma_max,"kN/m^2"
print"Minimum stress =",sigma_min,"kN/m^2"