BEP voorbeelden#
import sympy as sp
import numpy as np
from sympy import symbols
E, I = symbols('E, I')
x = symbols('x')
sf = sp.SingularityFunction
import matplotlib.pyplot as plt
#Voorbeeld 1
w = -1/12*sf(x, 0, 3) + 1/6*sf(x, 5, 3) - 1/12*sf(x, 10, 3) + 25/4*x
phi = sp.diff(w)*-1
M = sp.diff(phi)
V = sp.diff(M)
sp.plot(w, ylim=(30,0), xlim=(0, 10), size=(10,5))
sp.plot(phi, ylim=(10,-10), xlim=(0, 10), size=(10,5))
sp.plot(M, ylim=(5,-1), xlim=(0, 10), size=(10,5))
sp.plot(V, ylim=(1,-1), xlim=(0, 10), size=(10,5))
<sympy.plotting.plot.Plot at 0x1f3c1113460>
#Voorbeeld 2
w = 99/20*sf(x, 0, 2) - 399/600*sf(x, 0, 3) + 1/24*sf(x, 2, 4) - 1/24*sf(x, 8, 4) - 201/600*sf(x, 10, 3)
phi = sp.diff(w)*-1
M = sp.diff(phi)
V = sp.diff(M)
sp.plot(w, ylim=(50,0), xlim=(0, 10), size=(10,5))
sp.plot(phi, ylim=(20,-20), xlim=(0, 10), size=(10,5))
sp.plot(M, ylim=(7,-12), xlim=(0, 10), size=(10,5))
sp.plot(V, ylim=(5,-3), xlim=(0, 10), size=(10,5))
<sympy.plotting.plot.Plot at 0x1f3c0ef02b0>
#Voorbeeld 3
w = 20/12*sf(x, 0, 2) - 5/36*sf(x, 0, 3) - 875/108*sf(x, 4, 1) + 1/6*sf(x, 5, 3) - 1/36*sf(x, 10, 3)
phi = sp.diff(w)*-1
M = sp.diff(phi)
V = sp.diff(M)
sp.plot(w, ylim=(30,0), xlim=(0, 10), size=(10,5))
sp.plot(phi, ylim=(10,-10), xlim=(0, 10), size=(10,5))
sp.plot(M, ylim=(2,-4), xlim=(0, 10), size=(10,5))
sp.plot(V, ylim=(1,-1), xlim=(0, 10), size=(10,5))
<sympy.plotting.plot.Plot at 0x1f3c0e861c0>
#Voorbeeld 4
w = -89/1086*sf(x, 0, 3) + 1/6*sf(x, 2, 3) - 6/181*sf(x, 4, 1) - 558/362*sf(x, 6, 2) - 92/1086*sf(x, 10, 3) + 398/181*x
phi = sp.diff(w)*-1
M = sp.diff(phi)
V = sp.diff(M)
sp.plot(w, ylim=(10,0), xlim=(0, 10), size=(10,5))
sp.plot(phi, ylim=(3,-3), xlim=(0, 10), size=(10,5))
sp.plot(M, ylim=(3,-3), xlim=(0, 10), size=(10,5))
sp.plot(V, ylim=(1,-1), xlim=(0, 10), size=(10,5))
<sympy.plotting.plot.Plot at 0x1f3c216d460>
#Voorbeeld 5
u = -1/2*sf(x, 0, 1) + 1*sf(x, 5, 1) - 1/2*sf(x, 10, 1)
N = sp.diff(u)
sp.plot(u, ylim=(0, -3), xlim=(0, 10), size=(10,5))
sp.plot(N, ylim=(1,-1), xlim=(0, 10), size=(10,5))
<sympy.plotting.plot.Plot at 0x1f3c1079130>
#Voorbeeld 6
u = -5/9*sf(x, 0, 1) + 5/9*sf(x, 3, 0) + 1*sf(x, 5, 1) - 4/9*sf(x, 10, 1)
N = sp.diff(u)
sp.plot(u, ylim=(0, -3), xlim=(0, 10), size=(10,5))
sp.plot(N, ylim=(1,-1), xlim=(0, 10), size=(10,5))
<sympy.plotting.plot.Plot at 0x1f3c10c91c0>
#Voorbeeld 7
x = symbols('x')
w = 63/2*sf(x, 0, 2) - 4/6*sf(x, 0, 3) + 3/6*sf(x, 10, 3) - 7420/3*sf(x, 10, 0) + 1/6*sf(x, 13, 3) - 4/6*sf(x, 15, 3) + 226/3*sf(x, 15, 0) + 2/3*sf(x, 20, 3)
wV = 63/2*sf(x, 0, 2) - 4/6*sf(x, 0, 3) + 3/6*sf(x, 10, 3) + 1/6*sf(x, 13, 3) - 4/6*sf(x, 15, 3) + 2/3*sf(x, 20, 3)
phi = sp.diff(w)*-1
M = sp.diff(phi)
V = sp.diff(wV, x, 3)
w_numpy = sp.lambdify(x, w.rewrite(sp.Piecewise))
phi_numpy = sp.lambdify(x, phi.rewrite(sp.Piecewise))
M_numpy = sp.lambdify(x, M.rewrite(sp.Piecewise))
V_numpy = sp.lambdify(x, V.rewrite(sp.Piecewise))
u = 1*sf(x, 0, 1) - 5*sf(x, 10, 1) - 7480/3*sf(x, 10, 0) + 4*sf(x, 15, 1) + 14794/3*sf(x, 15, 0)
N = sp.diff(u)
u_numpy = sp.lambdify(x, u.rewrite(sp.Piecewise))
N_numpy = sp.lambdify(x, N.rewrite(sp.Piecewise))
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), w_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([6000, 0])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('w-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), phi_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([0, -750])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('phi-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), M_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([0, -80])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('M-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), V_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([1, -5])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('V-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), u_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([4000, -4000])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('u-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), N_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([2, -6])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('N-lijn')
Text(0.5, 1.0, 'N-lijn')
factor = sp.symbols('factor')
w = (63/2*sf(x, 0, 2) - 4/6*sf(x, 0, 3) + 3/6*sf(x, 10, 3) - 7420/3*sf(x, 10, 0) + 1/6*sf(x, 13, 3) - 4/6*sf(x, 15, 3) + 226/3*sf(x, 15, 0) + 2/3*sf(x, 20, 3))/(factor)
u = (1*sf(x, 0, 1) - 5*sf(x, 10, 1) - 7480/3*sf(x, 10, 0) + 4*sf(x, 15, 1) + 14794/3*sf(x, 15, 0))/(factor)
u_test = u.subs(factor, 1000)
w_test = w.subs(factor, 1000)
x_structure = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,10,0)) * x
+ (sp.SingularityFunction(x,10,0) - sp.SingularityFunction(x,15,0)) * 10
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * (x-5)).expand().rewrite(sp.Piecewise)
z_structure = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,10,0)) * 0
+ (sp.SingularityFunction(x,10,0) - sp.SingularityFunction(x,15,0)) * (-x+10)
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * (-5)).expand().rewrite(sp.Piecewise)
x_structure_numpy = sp.lambdify(x,x_structure)
z_structure_numpy = sp.lambdify(x,z_structure)
display(w_test.subs({x:20}))
display(u_test.subs({x:20}))
\[\displaystyle 5.3425\]
\[\displaystyle 2.428\]
x_res = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,10,0)) * u_test
+ (sp.SingularityFunction(x,10,0) - sp.SingularityFunction(x,15,0)) * w_test
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * u_test).expand().rewrite(sp.Piecewise)
z_res = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,10,0)) * w_test
+ (sp.SingularityFunction(x,10,0) - sp.SingularityFunction(x,15,0)) * -u_test
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * w_test).expand().rewrite(sp.Piecewise)
x_res_numpy = sp.lambdify(x,x_res)
z_res_numpy = sp.lambdify(x,z_res)
plt.figure(figsize=(10, 5))
plt.plot(x_structure_numpy(np.linspace(0,20,101)),z_structure_numpy(np.linspace(0,20,101)), label='Original structure')
plt.plot(x_res_numpy(np.linspace(0,20,2010))+x_structure_numpy(np.linspace(0,20,2010)),z_res_numpy(np.linspace(0,20,2010))+z_structure_numpy(np.linspace(0,20,2010)), label='Displaced structure')
plt.gca().invert_yaxis()
plt.gca().set_aspect('equal')
plt.axis('off')
plt.legend();
#Voorbeeld 8
x = symbols('x')
w = -2/15*sf(x, 0, 3) + 1/3*sf(x, 3, 3) - 1/5*sf(x, 5, 3) - 119/2*sf(x, 5, 0) - 76/5*sf(x, 10, 1) + 3/6*sf(x, 13, 3) - 7/10*sf(x, 15, 3) - 125/2*sf(x, 15, 0) + 1/5*sf(x, 20, 3) + 147/10*x
wV = -2/15*sf(x, 0, 3) + 1/3*sf(x, 3, 3) - 1/5*sf(x, 5, 3) - 76/5*sf(x, 10, 1) + 3/6*sf(x, 13, 3) - 7/10*sf(x, 15, 3) + 1/5*sf(x, 20, 3) + 147/10*x
phi = sp.diff(w)*-1
M = sp.diff(phi)
V = sp.diff(wV, x, 3)
w_numpy = sp.lambdify(x, w.rewrite(sp.Piecewise))
phi_numpy = sp.lambdify(x, phi.rewrite(sp.Piecewise))
M_numpy = sp.lambdify(x, M.rewrite(sp.Piecewise))
V_numpy = sp.lambdify(x, V.rewrite(sp.Piecewise))
u = -6/5*sf(x, 5, 1) + 119/2*sf(x, 5, 0) - 9/5*sf(x, 15, 1) - 65/2*sf(x, 15, 0) + 3*sf(x, 20, 1)
N = sp.diff(u)
u_numpy = sp.lambdify(x, u.rewrite(sp.Piecewise))
N_numpy = sp.lambdify(x, N.rewrite(sp.Piecewise))
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), w_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([60, -60])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('w-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), phi_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([20, -20])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('phi-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), M_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([4, -8])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('M-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), V_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([4, -2])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('V-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), u_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([100, -100])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('u-lijn')
fig, ax = plt.subplots(figsize=(10,5))
ax.plot(np.linspace(0, 20, 1000), N_numpy(np.linspace(0, 20, 1000)))
plt.xlim([0, 20])
plt.ylim([2, -6])
ax.spines['left'].set_position('zero')
ax.spines['right'].set_color('none')
ax.yaxis.tick_left()
ax.spines['bottom'].set_position('zero')
ax.spines['top'].set_color('none')
ax.xaxis.tick_bottom()
plt.title('N-lijn')
Text(0.5, 1.0, 'N-lijn')
factor = sp.symbols('factor')
w = (-2/15*sf(x, 0, 3) + 1/3*sf(x, 3, 3) - 1/5*sf(x, 5, 3) - 119/2*sf(x, 5, 0) - 76/5*sf(x, 10, 1) + 3/6*sf(x, 13, 3) - 7/10*sf(x, 15, 3) - 125/2*sf(x, 15, 0) + 1/5*sf(x, 20, 3) + 147/10*x)/(factor)
u = (-6/5*sf(x, 5, 1) + 119/2*sf(x, 5, 0) - 9/5*sf(x, 15, 1) - 65/2*sf(x, 15, 0) + 3*sf(x, 20, 1))/(factor)
u_test = u.subs(factor, 100)
w_test = w.subs(factor, 100)
x_structure = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,5,0)) * 0
+ (sp.SingularityFunction(x,5,0) - sp.SingularityFunction(x,15,0)) * (x-5)
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * (10)).expand().rewrite(sp.Piecewise)
z_structure = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,5,0)) * -x
+ (sp.SingularityFunction(x,5,0) - sp.SingularityFunction(x,15,0)) * -5
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * (x-20)).expand().rewrite(sp.Piecewise)
x_structure_numpy = sp.lambdify(x,x_structure)
z_structure_numpy = sp.lambdify(x,z_structure)
display(w_test.subs({x:20}))
display(u_test.subs({x:20}))
\[\displaystyle 0\]
\[\displaystyle 0\]
x_res = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,5,0)) * w_test
+ (sp.SingularityFunction(x,5,0) - sp.SingularityFunction(x,15,0)) * u_test
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * -w_test).expand().rewrite(sp.Piecewise)
z_res = ((sp.SingularityFunction(x,0,0) - sp.SingularityFunction(x,5,0)) * -u_test
+ (sp.SingularityFunction(x,5,0) - sp.SingularityFunction(x,15,0)) * w_test
+ (sp.SingularityFunction(x,15,0) - sp.SingularityFunction(x,20,0)) * u_test).expand().rewrite(sp.Piecewise)
x_res_numpy = sp.lambdify(x,x_res)
z_res_numpy = sp.lambdify(x,z_res)
plt.figure(figsize=(10, 5))
plt.plot(x_structure_numpy(np.linspace(0,20,101)),z_structure_numpy(np.linspace(0,20,101)), label='Original structure')
plt.plot(x_res_numpy(np.linspace(0,20,2010))+x_structure_numpy(np.linspace(0,20,2010)),z_res_numpy(np.linspace(0,20,2010))+z_structure_numpy(np.linspace(0,20,2010)), label='Displaced structure')
plt.gca().invert_yaxis()
plt.gca().set_aspect('equal')
plt.axis('off')
plt.legend();