In [3]:

```
#example 4.1
FS=4.0; # FOS
q=110*2.0; # in 1b/ft^2
Nq=90.0;
Ny=50.0;
Gamma=110.0; # in 1b/ft^3
m1=0.34; # From Figure 4.6(a)
B=2.5; # in ft
L=2.5; # in ft
H=1.5; # in ft
phi=35; # in degree
m2=0.45; # From Figure 4.6(b)
Fqs=1-0.34*B/L;
Fys=1-0.45*B/L;
qu=q*Nq*Fqs+1/2.0*Gamma*Ny*Fys*B;
Qall=qu*B**2/FS;
print round(Qall,2),"bearing load in lb"
```

In [6]:

```
#example 4.2
FS=3.0; # FOS
cu=72.0;
q=18.0; # in kN/m^3
B=1.0;# in m
H=0.25;# in m
qu=5.14*(1+(0.5*B/H-0.707)/5.14)*cu+q;
qall=qu/FS;
print round(qall,1),"bearing capacity of soil in kN/m**2"
```

In [9]:

```
#example 4.3
import math
k=0; #B/L;
c2=30;
Gamma=17.5; # in kN/m^3
H=1.5; # in m
Df=1.2; # in m
B=2.0; # in m
Ks=2.5;
phi=40; # in degree
pi=math.pi;
qu=(1+0.2*k)*5.14*c2+(1+k)*Gamma*H**2*(1+2*Df/H)*Ks*math.tan(phi*pi/180)/B+Gamma*H;
Qu=qu*B;
print round(Qu,2),"is bearing capacity in kN/m"
print "there is slight variation due to rounding off error"
#soil 2
Ny=109.4;
Nq=64.2;
Fqs=1;
Fys=1;
qt=Gamma*Df*Nq*Fqs+1/2.0*Gamma*Ny*Fys*B;
print qt,"bearing capacity in kN/m**2"
# answer in book is different due to approximation
```

In [12]:

```
#example 4.4
B=1.0; # in m
L=1.5;# in m
c2=48;# in m
ca=108; # in KN/m^2
D=1.0;# in m
H=1.0;# in m
Gamma=16.8; # in KN/m^3
FS=4;
qu=(1+0.2*B/L)*5.14*c2+(1+B/L)*2*ca*H/B+Gamma*D; # in KN/m^2
c1=120.0;
gamma1=16.8; # in kN/m^3
Df=1.0;
qt=(1+0.2*B/L)*5.14*c1+gamma1*Df;
print qt,"is qt in kN/m**2"
print "no need to calculate qt since it is not useful for calculation"
print qu/FS,"is allowable shear stress in kN/m**2"
print qu/FS*1*1.5," is allowable load in kN"
```

In [13]:

```
#example 4.5
c=50; # in KN/m^2
#from table
Ncq=6.3;
FS=4.0;# FOS
qu=c*Ncq; # in KN/m^2
qall=qu/4;
print qall,"allowed shear stress in kN/m**2"
```

In [14]:

```
#example 4.6
Gamma=16.8; # in kN/m^3
B=1.5;# in m
#from table
Nyq=120.0;
qu=1/2.0*Gamma*B*Nyq; # in KN/m^2
print qu," is shear stress in kN/m**2"
```

In [17]:

```
#example 4.7
import math
phi=35; # in degree
Df=1.5; # in m
B=1.5; # in m
Gamma=17.4; # in kN/m^3
A=math.pi/4*Df**2; # in m^2
m=0.25;
Ku=0.936;
Fq=1+2*(1+m*Df/B)*Df/B*Ku*math.tan(phi*math.pi/180);
Qu=Fq*Gamma*A*Df; # in KN/m^2
print round(Qu,1)," is bearing capacity in kN"
```

In [20]:

```
#example 4.8
cu=52; # in kN/m^2
B=1.5; # in m
L=3; # in m
k=0.107*cu+2.5;
print round(k,2)," is Df/B of square"
A=L*B; # in m^2
Beta=0.2;
Gamma=18.9; # in kN/m^3
Df=1.8; # in m
Qu=A*(Beta*(7.56+1.44*B/L)*cu+Gamma*Df); # in kN/m^2
print round(Qu,1)," is ultimate shear force in kN"
```