In [19]:

```
#Given
e_z= 4 #Constant
ab = 0.200 #m, dimension
from scipy import integrate
#Calculations
#Part a)
import math
def f(z):
return(1+(40*10**-3)*(math.sqrt(z)))
z=integrate.quad(f,0,ab) #Strain formula for short line segment = delta(sdash) =(1+e_z)delta(s)
deltaB= z[0]-ab
deltaB_mm= deltaB*1000
#Part b)
e_avg = deltaB/ab# Normal strain formula e = (delta(sdash) -delta(s))/delta(s)
#Display
print"The displacement at the end of the rod is = ",round(deltaB_mm,2),"mm"
print"The average normal strain in the rod is =",round(e_avg,4),"mm"
```

In [12]:

```
#Given
theta = 0.05 #degree, angle
L1=300.0 #mm, length
L2 = 400.0 #mm
#Calculations
import math
alpha=math.atan(L2/L1)*180/3.14
phi=90-alpha+theta
Lad=math.sqrt(L1**2+L2**2)
Lbd=math.sqrt(Lad**2+L2**2-2*L2*Lad*math.cos(36.92*3.14/180.0))
epsilonBD=(Lbd-L1)/(L1)
dLbd=(theta*3.14/180.0)*L2
#Display
print"The average normal strain =",round(epsilonBD,3),"mm/mm"
```

In [13]:

```
#Given
#The given dimension are
ab= 250.0 #mm
bbdash_x = 3.0 #mm
bbdash_y = 2.0 #mm
ac = 300.0 #mm
#calculations
#Part(a)
import math
abdash = math.sqrt((ab - bbdash_y)**2 + (bbdash_x)**2) #Pythagoras theorem
avg_normal_strain = (abdash-ab)/ab
#Part(b)
gamma_xy = math.atan(bbdash_x/(ab - bbdash_y)) #shear strain formula
#Display
print"The average normal strain along AB is =",round(avg_normal_strain,4),"mm/mm"
print"The average shear strain =",round(gamma_xy,4),"rad"
```

In [22]:

```
#Given
ab = 150 #mm
bc = 150 #mm
disp_cd= 2 #mm
ab_half = ab/2.0
addash_half = (bc+disp_cd)/2.0
#Calculations
#Part(a)
import math
ac = sqrt((ab)**2 + (bc)**2) #Pythagoras theorem in mm
ac_m = ac/1000.0 #in m
acdash = sqrt((ab)**2 + (bc+disp_cd)**2) #Pythagoras theorem in mm
acdash_m = acdash/1000.0 #in m
avg_strain_ac = (acdash_m - ac_m)/ac_m #Normal strain formula
#Part(b)
theta_dash = 2* math.atan((addash_half)/(bc/2.0))
gamma_xy = (math.pi / 2.0)- theta_dash
#Display
print"The average normal strain along the diagonal AC is =",round(avg_strain_ac,5),"mm/mm"
print"The shear strain at E relative to the x,y axes =",round(gamma_xy,4),"rad"
```