import math
#calculate The stress induced in the concrete and steel and
b = 10.;##inches
d = 1.;##inches
h = 20.;##inches
r = 2.;##inches
M_r = 500000.;##lb-inches
m = 15.;
A_r = 4.*0.25*math.pi*d**2;##in^2
h_eff = h-r;##inches
K = m*A_r/(b*h_eff);##inches
n1 = math.sqrt((K)**2+(2*K))-K;
n = n1*h_eff;##inches
a = h_eff-(n/3);##inches
c = 2.*M_r/(b*n*a);##lb/in^2
t = (h_eff-n)*m*c/n;##lb/in^2
print'%s %.d %s'%('The stress induced in the concrete and steel, t =',t,'lb/in^2');
##there is a minute error in the answer given in textbook.
import math
#calculate The distance of the N.A from the top edge and The safe moment of inertia and The safe moment of inertia
b = 8.;##inches
d = 7/8.;##inches
h = 18.;##inches
r = 2.;##inches
c = 750.;##lb/in^2
t_limit = 18000.;##lb/in^2
m = 8.;
h_eff = 16.;##inches
m = 18;
A_t = 3*0.25*math.pi*d**2;##in^2
K = m*A_t/(b*h_eff);##inches
n1 = math.sqrt((K)**2.+(2.*K))-K;
n = n1*h_eff;##inches
a = h_eff - (n/3.);##inches
t = m*c*(h_eff-n)/n;##lb/in^2
if t<t_limit:
t = t;
else:
t = t_limit;
M_r = t*A_t*a;## lb/inches
W = M_r*8./(12.*h_eff);##lb-wt
print'%s %.3f %s'%('The distance of the N.A from the top edge, n =',n,'inches.');
print'%s %.d %s'%('The safe moment of inertia is, t =',t,'lb/in^2.');
print'%s %.d %s %d %s'% ('Unifromly distributed load over the beam, W =',W,'lb-wt. or',W/16.011,'lb. per foot run');
##there are calculation errors given in the answer in textbook.
import math
#calculate Area of steel reinforcement required and Corresponding stress in steel
import numpy
from numpy import roots
def quadratic(d,M_c,c_limit,b):
p = ([1 , -(d*3), + M_c*3/(0.5*c_limit*b)]);
Z = numpy.roots(p);
return Z;
b = 12.;##inches
h = 22.;##inches
r = 2.;##inches
W = 1500.;##lb per foot run
d = h-r;##feet
l = 20.;##inches
c_limit = 700.;## lb/in^2
m = 15.;
M_c = W*20.*l*b/8.;## lb-inches
Z = quadratic(d,M_c,c_limit,b);
n = round(Z[1]);
t = m*c_limit*(d-n)/n;## lb/in62
A_t = 0.5*c_limit*b*n/t;## in^2
print'%s %.d %s'%('Area of steel reinforcement required is, A_t =',A_t,'in^2');
print'%s %.d %s'%(' Corresponding stress in steel is, t =',t,'lb/in^2');
import math
#calculate Effective deapth
m = 15.;
t = 18000.;## lb/in^2
c = 700.;## lb/in^2
b = 12.;## inches
M = 900000.;##bending moment lb/inches
k1 = 1./((t/(m*c))+1.);##k = n/d
k2 = 1.-k1/3.;##k2 = a/d
p = 0.5*c*k1/(t);
d = math.sqrt(M/(0.5*c*b*k1*k2));##inches
A_t = p*b*d;## sq.inches
A_t_previous = 0.25*math.pi*(7/8.)**2;##section area with diameter 7/8 inches
n = A_t/A_t_previous;
print'%s %.2f %s'%('Effective deapth is d =',d,'inches');
print'%s %.3f %s'%('A_t =',A_t,'sq.inches');
import math
#calculate the effective death
l = 20.;##feet
W = 500.;## lb per foot run
c = 750.;## lb/in^2
t = 18000.;## lb/in^2
m = 15.;
BM_max = W*l*l*12./8. ;## lb-inches
##by making the effective deapth d twice the width b
d = (BM_max/(126.*0.5))**(1/3.);##inches
b = 0.5*d;##inches
##necessary reinforcement is 0.8% of concrete section
A_t = 0.008*b*d;## in^2
print'%s %.2f %s %.2f %s'%('d =',d,'inches ,b =',b,'inches');
print'%s %.3f %s'%('A_t =',A_t,'in^2');
import math
#calculate d1 and d2 and r1
W = 180.;## lb per sq.foot
l = 10.;## feet
b = 12.;##inches
c = 750.;## lb/in^2
m = 15.;
M = W*l*l*12./8.;##lb-inches
d_new = math.sqrt(M/(126.*b));##inches
A_t = 0.8*b*d_new/100.;##in^2
##using 3/8 inch rods
d1 = 3/8.;##inches
A1 = 0.25*math.pi*(d1)**2;##in^2
r1 = A1*b/A_t;##inch
##using 1/2 inch rods
d2 = 1/2.;##inches
A2 = 0.25*math.pi*(d2)**2;##in^2
r2 = A2*b/A_t;##inches
print'%s %.3f %s'%('d =',d_new,'inches');
print'%s %.3f %s'%('A_t =',A_t,'in^2');
print'%s %.3f %s %.2f %s'%('Using',d1,'inch rods, spacing centre to centre will be',r1,'inches');
print'%s %.2f %s %.1f %s'%('Using ',d2,' inch rods, spacing centre to centre will be ',r2,' inches');
##there are round-off errors in the answer given in textbook
import math
#calculate foot width of slab and spacing centre to centre
l = 12.;##feet
w = 150.;## lb per sq.foot
##Live load
LL = w*l;##lb-wt
##Dead Load assuming the slab thickness to be 6 inches
t = 6.;##inches
DL = t*l*12.;##lb-wt
##total load
W = LL+DL;##lb-wt
M = W*l*12./10.;##lb-inches
d = math.sqrt(M/(12.*126.));
print'%s %.4f %s'%('d =',d,'inches');
##With about an inch to cover the slab will be 6 inch thick
A_t = 0.8*l*d/100.;## in^2
##using 1/2 inch rods
d1 = 1/2.;##inches
A1 = 0.25*math.pi*(d1)**2;##in^2
r1 = A1*l/A_t;##inches
print'%s %.4f %s'%(' Per foot width of slab, A_t =',A_t,'in^2');
print'%s %.2f %s %.3f %s'%('Using',d1,'inch rods, spacing centre to centre will be ',r1,' inches');
##there are minute calculation errors in the answer given in textbook.