# Chapter 11: Energy Methods¶

## Example 11.01, Page number 699¶

In [1]:
import math
from sympy import symbols

#Variable declaration
P=symbols('P')                                                               # Force
L=symbols('L')                                                               # Length
A=symbols('A')                                                               # Area
E=symbols('E')                                                               # Modulus of elasticity
n=symbols('n')                                                               # Value

#Calculation
Un=((P**2)*((1/2.0)*L))/(2*A*E) + ((P**2)*((1/2.0)*L))/(2*(n**2)*A*E)            # Strain energy
U1=Un.subs(n,1)                                                              # Strain energy

#Result
print('Strain energy :- ')
print(U1)

Strain energy :-
0.5*L*P**2/(A*E)


## Example 11.02, Page number 700¶

In [2]:
import math
from sympy import symbols

#Variable declaration
Fbc=symbols('Fbc')                                                              # Force
Fbd=symbols('Fbd')                                                              # Force
BC=symbols('BC')                                                                # Length
BD=symbols('BD')                                                                # Length
AE=symbols('AE')                                                                # Length
l=symbols('l')                                                                  # Length
P=symbols('P')                                                                  # Force
n=-1

#Calculation
U=((Fbc**2)*(BC))/(2*AE)  +  ((Fbd**2)*(BD))/(2*AE)                             # Strain energy
SE=U.subs([(BC, (0.6*l)),(BD, (0.8*l)),(Fbc, (0.6*P)),(Fbd, (0.8*P))])          # Strain energy

#Result
print('Strain energy :-')
print(SE)

Strain energy :-
0.364*P**2*l/AE


## Example 11.03, Page number 701¶

In [4]:
import math
from sympy import integrate, symbols

#Variable declaration
P=symbols('P')                                                          # Force
x=symbols('x')                                                          # Distance
E=symbols('E')                                                          # Modulus of elasticity
I=symbols('I')                                                          # Moment of inertia
l=symbols('l')                                                          # Value
n=-1

#Calculation
U=integrate((((P**2)*(x**2))/(2*E*I)),(x,0,l))                            # Strain energy

#Result
print('Strain energy :- ')
print(U)

Strain energy :-
P**2*l**3/(6*E*I)


## Example 11.04, Page number 702¶

In [5]:
import math
from sympy import symbols

#Variable declaration
T=symbols('T')                                                                     # Twisting couple
L=symbols('L')                                                                     # Length
G=symbols('G')                                                                     # Modulus of elasticity
j=symbols('j')                                                                     # Polar moment of inertia
n=symbols('n')                                                                     # Value

#Calculation
Un=((T**2)*((1/2.0)*L))/(2*G*j) + ((T**2)*((1/2.0)*L))/(2*(n**4)*G*j)                  # Strain energy
U1=Un.subs(n,1)                                                                       # Strain energy

#Result
print('Strain energy :- ')
print(U1)

Strain energy :-
0.5*L*T**2/(G*j)


## SAMPLE PROBLEM 11.1, Page number 707¶

In [7]:
import math
from sympy import symbols,solve

#Variable declaration
E=29*(pow(10,6))                                                         # Elastic strain energy(psi)
A=((math.pi)/4.0)*(pow(0.75,2))                                            # Area of cross section(in**2)
L=60                                                                     # Length(in)
Sy=symbols('Sy')                                                         # Stress

#Calculation
#Factor Of Safety
U=5*120                                                                  # Strain energy(in.lb)
#Strain-Energy Density
V=A*L                                                                    # Volume(in**3)
u=(U/V)                                                                  # Strain energy density(in.lb/in**3)
#Yield Strength
Sy=solve(Sy**2/(2.0*29.0*pow(10.0,6))-22.6,Sy)                                    # Maximum stress(ksi)

#Result
print('Yield strength of steel :-')
print(Sy[1]/1000)

Yield strength of steel :-
36.2049720342386


## SAMPLE PROBLEM 11.2, Page number 708¶

In [8]:
import math
from sympy import integrate,symbols

#Variable declaration
P=40                                                                         # Force(kips)
L=12                                                                         # Length(ft)
a=3                                                                          # Length(ft)
b=9                                                                          # Length(ft)
E=29*(pow(10,6))                                                             # Modulus of elasticity(psi)
P=symbols('P')                                                               # Force
b=symbols('b')                                                               # Length
L=symbols('L')                                                               # Length
P=symbols('P')                                                               # Force
a=symbols('a')                                                               # Length
x=symbols('x')                                                               # Length
v=symbols('v')                                                               # Length
E=symbols('E')                                                               # Modulus of elasticity
I=symbols('I')                                                               # Moment of inertia

#Calculation
#Bending Moment
Ra=(P*b)/L                                                                   # Reaction
Rb=(P*a)/L                                                                   # Reaction

M1=((P*b)/L)*x                                                               # Bending moment
M2=((P*a)/L)*v                                                               # Bending moment

# Case(a) Bending Moment
U=(1/(2.0*E*I))*(integrate(M1**2,(x,0,a))+integrate(M2**2,(v,0,b)))            # Total strain energy

# Case(b) Evaluation of the Strain Energy
a=36                                                                         # Length(in)
L=144                                                                        # Length(in)
b=108                                                                        # Length(in)
I=248                                                                        # Moment of inertia(in**4)
U=U.simplify()
Usubs=(40*36*108)/(6.0*29*248*144*(pow(10,3)))                                 # Strain energy

#Result
print('Case(a): Strain energy :-')
print(U)
print('Case(b): Evaluated Strain energy = %lf psi '%Usubs)

Case(a): Strain energy :-
0.166666666666667*P**2*a**2*b**2*(a + b)/(E*I*L**2)
Case(b): Evaluated Strain energy = 0.000025 psi


## Example 11.06, Page number 717¶

In [27]:
import math
from sympy import symbols

#Variable declaration
Pm=symbols('Pm')                                                                       # Force
L=symbols('L')                                                                         # Length
E=symbols('E')                                                                         # Modulus of elasticity
A=symbols('A')                                                                         # Area
m=symbols('m')                                                                         # Mass
v0=symbols('v0')                                                                       # Velocity

#Calculation
Um=(5*(Pm**2)*(L))/(16.0*A*E)                                                            # Strain energy
Pm=((16/5.0)*((Um*A*E)/(L)))**(1/2.0)                                                      # Force
Sm=Pm/A                                                                                # Stress

#Result
print('Maximum value of stress in rod :-')
print(Sm)

Maximum value of stress in rod :-
1.0*(Pm**2)**0.5/A


## Example 11.07, Page number 717¶

In [28]:
import math
from sympy import symbols

#Variable declaration
Pm=symbols('Pm')                                                            # Force
L=symbols('L')                                                              # Length
E=symbols('E')                                                              # Modulus of elasticity
I=symbols('I')                                                              # Moment of inertia
m=symbols('m')                                                              # Mass
v0=symbols('v0')                                                            # Velocity
Lc=symbols('Lc')                                                            # Length
W=symbols('W')                                                              # Work
h=symbols('h')                                                              # Height

#Calculation
Um=((Pm**2)*(L**3))/(6.0*E*I)                                                 # Strain energy
Pm=((6)*((Um*E*I)/(L**3)))**(1/2.0)                                           # Static force
Sm=(Pm*L*c)/(I)                                                             # Maximum stress

#Result
print('Maximum stress in the beam :-')
print(Sm)

Maximum stress in the beam :-
L*c*(Pm**2)**0.5/I


## Example 11.08, Page number 721¶

In [29]:
import math
from sympy import symbols

#Variable declaration
Pm=symbols('Pm')                                                               # Force
L=symbols('L')                                                                 # Length
E=symbols('E')                                                                 # Modulus of elasticity
I=symbols('I')                                                                 # Moment of inertia
m=symbols('m')                                                                 # Mass
v0=symbols('v0')                                                               # Velocity
Lc=symbols('Lc')                                                               # Length
h=symbols('h')                                                                 # Height
c=symbols('c')                                                                 # Length
xm=symbols('xm')                                                               # Distance

#Calculation
Um=(1/2.0)*(m)*(v0**2)                                                           # Strain energy
Um=(1/2.0)*(Pm)*(xm)                                                             # Expressing Um as the work of the equivalent horizontal static load
xm=((Pm)*(L**3))/(48.0*E*I)                                                      # Deflection of c corresponding to static load Pm
Um=(((Pm**2)*(L**3))/(48.0*E*I))*(1/2.0)                                           # Substituting xm in strain energy
Sm=(Pm*Lc)/(4.0*I)                                                               # Maximum stress
Sm=((3*m*(v0**2)*(E)*I)/(L*(I/c)**2))**(1/2.0)                                   # Maximum stress after sustituting for Pm
xm=Pm*((L**3)/(48.0*E*I))                                                        # Maximum deflection

#Result
print(Pm)
print('Case(b): Maximum stress :-')
print(Sm)
print('Case(c): Maximum deflection :-')
print(xm)

Case(a): Equivalent static load :-
48**0.5*(E*I*m*v0**2/L**3)**0.5
Case(b): Maximum stress :-
3**0.5*(E*c**2*m*v0**2/(I*L))**0.5
Case(c): Maximum deflection :-
48**0.5*L**3*(E*I*m*v0**2/L**3)**0.5/(48*E*I)


## Example 11.09, Page number 723¶

In [30]:
import math
from sympy import symbols,solve

#Variable declaration
Pm=symbols('Pm')                                                                      # Force
L=symbols('L')                                                                        # Length
E=symbols('E')                                                                        # Modulus of elasticity
A=symbols('A')                                                                        # Area of crosssection
m=symbols('m')                                                                        # Mass
v0=symbols('v0')                                                                      # Velocity
P=symbols('P')                                                                        # Force
yb=symbols('yb')                                                                      # Distance

#Calculation
yb=solve(0.364*(((P**2.0)*L)/(A*E))-(1/2.0)*P*yb,yb)

#Result
print('Vertical deflection of B :-')
print(yb)

Vertical deflection of B :-
[0.728*L*P/(A*E)]


## Example 11.10, Page number 723¶

In [31]:
import math
from sympy import symbols,solve

#Variable declaration
Pm=symbols('Pm')                                                                      # Force
L=symbols('L')                                                                        # Length
E=symbols('E')                                                                        # Modulus of elasticity
I=symbols('I')                                                                        # Moment of inertia
m=symbols('m')                                                                        # Mass
P=symbols('P')                                                                        # Force
yA=symbols('yA')                                                                      # Distance
h=symbols('h')                                                                        # Height
G=symbols('G')                                                                        # Modulus of elasticity

#Calculation
yA1=solve((((P**2)*(L**3))/(6.0*E*I))-(1/2.0)*P*yA,yA)                                      # Deflection of end A
yA2=solve((((P**3)*(L**3))/(6.0*E*I))*(1+(3*E*(h**2))/(10.0*(G)*(L**2)))-(1/2.0)*(P)*(yA),yA) # Deflection of end A

#Result
print('Deflection of end A taking into account of normal stress only:-')
print(yA1)
print('Deflection of end A taking into account of both the normal and shearing stresses.:-')
print(yA2)

Deflection of end A taking into account of normal stress only:-
[0.333333333333333*L**3*P/(E*I)]
Deflection of end A taking into account of both the normal and shearing stresses.:-
[0.0333333333333333*L*P**2*(3.0*E*h**2 + 10.0*G*L**2)/(E*G*I)]


## Example 11.11, Page number 724¶

In [32]:
import math
from sympy import symbols,solve

#Variable declaration
Pm=symbols('Pm')                                                                  # Force
L=symbols('L')                                                                    # Length
E=symbols('E')                                                                    # Modulus of elasticity
I=symbols('I')                                                                    # Moment of inertia
m=symbols('m')                                                                    # Mass
P=symbols('P')                                                                    # Force
yA=symbols('yA')                                                                  # Distance
h=symbols('h')                                                                    # Height
G=symbols('G')                                                                    # Modulus of rigidity
T=symbols('T')                                                                    # Torque
J=symbols('J')                                                                    # Polar moment of inertia
phyDB=symbols('phyDB')                                                            # Angle of twist

#Calculation
phyDB=solve((17/32.0)*(T**2)*(L)*(1/(2.0*G*J))-(1/2.0)*(T)*(phyDB),phyDB)               # Angle of twist

#Result
print('Angle of twist for entire shaft:-')
print(phyDB)

Angle of twist for entire shaft:-
[0.53125*L*T/(G*J)]


## SAMPLE PROBLEM 11.3, Page number 725¶

In [34]:
import math
from sympy import symbols,solve

#Variable declaration
ym=symbols('ym')                                                         # Distance
E=symbols('E')                                                           # Modulus of elasticity
I=symbols('I')                                                           # Moment of inertia
L=symbols('L')                                                           # Length
W=symbols('W')                                                           # Weight
h=symbols('h')                                                           # Height

#Calculation
#Principle of Work and Energy
Pm=(48*E*I)/(L**3.0)                                                       # Force
U2=(1/2.0)*Pm*ym                                                           # Strain energy
Eq=U2-(W*(h+ym))                                                         # Equation

#Case(a) Maximum Deflection of Point C
E=73*(pow(10,9))                                                         # Modulus of elasticity(Pa)
I=(1/12.0)*((0.04)**4)                                                     # Moment of inertia(m**4)
L=1                                                                      # Length(m)
h=0.040                                                                  # Height(m)
W=80*9.81                                                                # Force(N)
ym=solve(373.8*(pow(10,3))*(ym**2)-(784.8)*ym-31.39,ym)                  # Distance(mm)

#Case(b) Maximum Stress
Pm=48*(15.573*(pow(10,3)))*(0.01027)                                     # Force(N)
Sm=(((1/4.0)*(7677)*(0.020))/((1/12.0)*pow(0.040,4)))/(1000000.0)              # Stress(MPa)

#Result
print('Maximum deflection of point C:-')
print(ym[1]*1000)
print('Maximum stress:-')
print(Sm)

Maximum deflection of point C:-
10.2734993791682
Maximum stress:-
179.9296875