In [8]:

```
#Variable declaration
P = 5 #load(k)
L = 8*12 #beam length(in)
E = 30*10**6 #modulus of elasticity(psi)
I = 75.0 #moment of inertia(in^4)
q = 1.5*(1./12.)#load intensity(k/in)
#Calculations
Sc = ((P*L**3)/(48*E*I))+((5.*q*L**4)/(384.*E*I))
#Result
print "The download deflection is",Sc,"in(Calculation mistake in textbook)"
```

In [19]:

```
#Variable declaration
E = 30*10**6*144 #modulus of elasticity(lb/ft^2)
I = 25.92/12 #moment of inertia(ft^4)
x = 12 #ft
#Calculations
'''The equivalent load q(x) for the beam is given by the following equation
q(x) = -700(x)^-1+800(x-6)^0 - 800(x-12)^0 - 5600(x-12)^-1 + 1500(x-16)^-1
Since the equation equals zero at all points except where x=16, we omit the last term
Taking 4th order integration, we obtain the following expression,'''
C1 = (-((350*x**3)/3)+((100*(x-6)**4)/3)-((100*(x-12)**4)/3)+((2800*(x-12)**3)/3))/12
print "C1 =",C1
#For Deflection at point C
x = 6
Elv = ((350*x**3)/3)-(100*((x-6)**4)/3)+(100*((x-12)**4)/3)+(2800*((x-12)**3)/3)+(C1*x)
Sc = Elv/(E*I) #ft
#For deflection at point D
x = 16
Elv_16 = ((350*x**3)/3)-(100*((x-6)**4)/3)+(100*((x-12)**4)/3)+(2800*((x-12)**3)/3)+(C1*x)
Sd = Elv_16/(E*I)
#Results
print "Deflection at point C is",round((-Sc*12),8),"in"
print "Deflection at point D is",round((Sd*12),8),"in"
print "\n Please note that there is a calculation mistake in textbook while calculating Elv. Hence, the difference in solution"
```