Introductie SymPy voor Matrixframe opdracht

Introductie SymPy voor Matrixframe opdracht#

In deze iPython notebook wordt het gebruik van Python voor het MatrixFrame practicum toegelicht.

Opdracht 1#

figuur 1

Allereest moeten de bibliotheken worden geïmporteerd. SymPy is de symbolische rekenbibliotheek voor Python

import numpy as np
import matplotlib.pyplot as plt
import sympy as sp

Alle wiskundige symbolen die later rechts van het = teken worden geïntroduceerd moeten eerst gedefinieerd worden zodat Python weet dat het om SymPy variabelen gaat. Daarbij moet voor de zakking moet worden aangegeven dat het een functie is. Daarnaast moeten ook alle mogelijk integratieconstantes moeten worden gedefinieerd.

q, x = sp.symbols('q x')
L, EI = sp.symbols('L EI')
C1, C2, C3, C4 = sp.symbols('C1 C2 C3 C4')

De verplaatsingsfunctie kan dan geworden worden door viermaal te integreren met integrate, let op dat de je dan ook handmatig de integratieconstrantes definieert. Met display wordt een variabele op een nette wiskundige manier weergegeven

V = sp.integrate(-q,x)+C1
M = sp.integrate(V,x)+C2
kappa = M / EI
phi = sp.integrate(kappa,x)+C3
w = sp.integrate(-phi,x)+C4
display(w)
\[\displaystyle - \frac{C_{1} x^{3}}{6 EI} - \frac{C_{2} x^{2}}{2 EI} - C_{3} x + C_{4} + \frac{q x^{4}}{24 EI}\]

Nu kunnen de randvoorwaarden worden ingevuld. Met .subs vervang je een variabele in een vergelijking door een andere variabele of een getal. Met sp.Eq definieer je een vergelijking met een linker en rechterzijde.

Eq1 = sp.Eq(w.subs(x, 0), 0) 
Eq2 = sp.Eq(w.subs(x, L), 0)
Eq3 = sp.Eq(M.subs(x, 0), 0)
Eq4 = sp.Eq(M.subs(x, L), 0)
display(Eq1,Eq2,Eq3,Eq4)
\[\displaystyle C_{4} = 0\]
\[\displaystyle - \frac{C_{1} L^{3}}{6 EI} - \frac{C_{2} L^{2}}{2 EI} - C_{3} L + C_{4} + \frac{L^{4} q}{24 EI} = 0\]
\[\displaystyle C_{2} = 0\]
\[\displaystyle C_{1} L + C_{2} - \frac{L^{2} q}{2} = 0\]

De integratieconstantes kunnen nu worden opgelost. Met sp.solve wordt de set vergelijkingen van de randvoorwaarden opgelost voor de onbekende integratieconstantes.

sol = sp.solve((Eq1,Eq2,Eq3,Eq4),(C1,C2,C3,C4))
display(sol)
{C1: L*q/2, C2: 0, C3: -L**3*q/(24*EI), C4: 0}

De gevonden integratieconstructies kunnen nu worden ingevoerd in de originele functie voor \(w\)

w_sol = w.subs(sol)
display(w_sol)
\[\displaystyle \frac{L^{3} q x}{24 EI} - \frac{L q x^{3}}{12 EI} + \frac{q x^{4}}{24 EI}\]

Voor de numerieke waarde kunnen de symbolen worden vervangen door getalwaardes.

w_subs = w_sol.subs([(EI,1000),(q,5),(L,10)])
display(w_subs)
\[\displaystyle \frac{x^{4}}{4800} - \frac{x^{3}}{240} + \frac{5 x}{24}\]

Om de gevonden functie te plotten is het handig de SymPy vergelijking om te schrijven naar NumPy functie, sp.lambdify doet dat voor je. Vervolgens kan je met bekende functies van NumPy en Matplotlib een grafiek plotten.

w_numpy = sp.lambdify(x,w_subs) 
x_plot = np.linspace(0,10,50)
w_plot = w_numpy(x_plot)
plt.plot(x_plot,w_plot)
plt.gca().invert_yaxis() # draait de y-as om
plt.title("w-lijn")
plt.axhline(0,color='black') #geeft een horizontale lijn op w=0 weer
plt.xlim(0,10)
plt.annotate('%.2f m' % w_numpy(5), xy = [5,w_numpy(5)]) #geeft de getalswaarde weer in de grafiek
plt.axis('off');
../_images/6735f5a9e99379a62615f693e3fcd067b7022df340a3af9d5afd4a0dfca64cd9.png

De \(\phi\), \(M\) en \(V\)-lijn kunnen op gelijke wijze worden gevonden als de \(w-\)lijn.

phi_sol = phi.subs(sol)
display(phi_sol)

phi_subs = phi_sol.subs([(EI,1000),(q,5),(L,10)])
display(phi_subs)

phi_numpy = sp.lambdify(x,phi_subs)
phi_plot = phi_numpy(x_plot)
plt.figure()
plt.plot(x_plot,phi_plot)
plt.gca().invert_yaxis()
plt.title("phi-lijn")
plt.axhline(0,color='black')
plt.xlim(0,10)
plt.annotate('%.2f m/m' % phi_numpy(0),xy = [0,phi_numpy(0)])
plt.annotate('%.2f m/m' % phi_numpy(10),xy = [10,phi_numpy(10)])
plt.axis('off');
\[\displaystyle - \frac{L^{3} q}{24 EI} + \frac{L q x^{2}}{4 EI} - \frac{q x^{3}}{6 EI}\]
\[\displaystyle - \frac{x^{3}}{1200} + \frac{x^{2}}{80} - \frac{5}{24}\]
../_images/16bb8dec75d48b3b52649e9493da5506781dab9b995efcf16c072aa63d1df9c4.png
M_sol = M.subs(sol)
display(M_sol)

M_subs = M_sol.subs([(EI,1000),(q,5),(L,10)])
display(M_subs)

M_numpy = sp.lambdify(x,M_subs)
M_plot = M_numpy(x_plot)
plt.figure()
plt.plot(x_plot,M_plot)
plt.gca().invert_yaxis()
plt.title("M-lijn")
plt.axhline(0,color='black')
plt.xlim(0,10)
plt.annotate('%.1f kNm' % M_numpy(5),xy = [5,M_numpy(5)])
plt.axis('off');
\[\displaystyle \frac{L q x}{2} - \frac{q x^{2}}{2}\]
\[\displaystyle - \frac{5 x^{2}}{2} + 25 x\]
../_images/42cc98965bfac56472f24af407a0f441112146f98be9442b3a732072fdfd6093.png
V_sol = V.subs(sol)
display(V_sol)

V_subs = V_sol.subs([(EI,1000),(q,5),(L,10)])
display(V_subs)

V_numpy = sp.lambdify(x,V_subs)
V_plot = V_numpy(x_plot)
plt.figure()
plt.plot(x_plot,V_plot)
plt.gca().invert_yaxis()
plt.title("V-lijn")
plt.axhline(0,color='black')
plt.xlim(0,10)
plt.annotate('%.1f kN' % V_numpy(0),xy = [0,V_numpy(0)])
plt.annotate('%.1f kN' % V_numpy(10),xy = [10,V_numpy(10)])
plt.axis('off');
\[\displaystyle \frac{L q}{2} - q x\]
\[\displaystyle 25 - 5 x\]
../_images/5e0bd0a69d620242e9f893b59a83220c8a473cc322143eeaa56c84c2a4bfb635.png

Opdracht 2#

Opdracht 2#

ALs de ligger uit meerdere velden bestaat, kan deze met meerdere differentiaalvergelijkingen worden opgelost.

figuur 1

Voor elk veld moeten allereerst apart de symbolen worden gedefiniëerd

q1, q2 = sp.symbols('q1 q2')
F, L1, L2, EI = sp.symbols('F L1 L2 EI')
C1, C2, C3, C4, C5, C6, C7, C8 = sp.symbols('C1 C2 C3 C4 C5 C6 C7 C8')
x = sp.symbols('x')

De vergelijkingen moeten gelijktijdig worden opgelost zodat er 8 verschillende integratieconstantes worden opgesteld

V1 = sp.integrate(-q1,x)+C1
M1 = sp.integrate(V1,x)+C2
kappa1 = M1 / EI
phi1 = sp.integrate(kappa1,x)+C3
w1 = sp.integrate(-phi1,x)+C4
display(w1)

V2 = sp.integrate(-q2,x)+C5
M2 = sp.integrate(V2,x)+C6
kappa2 = M2 / EI
phi2 = sp.integrate(kappa2,x)+C7
w2 = sp.integrate(-phi2,x)+C8
display(w2)

Eq1 = sp.Eq(w1.subs(x,0),0)
Eq2 = sp.Eq(phi1.subs(x,0),0)
Eq3 = sp.Eq(w1.subs(x,L1),w2.subs(x,L1))
Eq4 = sp.Eq(M1.subs(x,L1),M2.subs(x,L1))
Eq5 = sp.Eq(V1.subs(x,L1),V2.subs(x,L1)+F)
Eq6 = sp.Eq(phi1.subs(x,L1),phi2.subs(x,L1))
Eq7 = sp.Eq(w2.subs(x,L1+L2),0)
Eq8 = sp.Eq(M2.subs(x,L1+L2),0)
display(Eq1,Eq2,Eq3,Eq4,Eq5,Eq6,Eq7,Eq8)
\[\displaystyle - \frac{C_{1} x^{3}}{6 EI} - \frac{C_{2} x^{2}}{2 EI} - C_{3} x + C_{4} + \frac{q_{1} x^{4}}{24 EI}\]
\[\displaystyle - \frac{C_{5} x^{3}}{6 EI} - \frac{C_{6} x^{2}}{2 EI} - C_{7} x + C_{8} + \frac{q_{2} x^{4}}{24 EI}\]
\[\displaystyle C_{4} = 0\]
\[\displaystyle C_{3} = 0\]
\[\displaystyle - \frac{C_{1} L_{1}^{3}}{6 EI} - \frac{C_{2} L_{1}^{2}}{2 EI} - C_{3} L_{1} + C_{4} + \frac{L_{1}^{4} q_{1}}{24 EI} = - \frac{C_{5} L_{1}^{3}}{6 EI} - \frac{C_{6} L_{1}^{2}}{2 EI} - C_{7} L_{1} + C_{8} + \frac{L_{1}^{4} q_{2}}{24 EI}\]
\[\displaystyle C_{1} L_{1} + C_{2} - \frac{L_{1}^{2} q_{1}}{2} = C_{5} L_{1} + C_{6} - \frac{L_{1}^{2} q_{2}}{2}\]
\[\displaystyle C_{1} - L_{1} q_{1} = C_{5} + F - L_{1} q_{2}\]
\[\displaystyle \frac{C_{1} L_{1}^{2}}{2 EI} + \frac{C_{2} L_{1}}{EI} + C_{3} - \frac{L_{1}^{3} q_{1}}{6 EI} = \frac{C_{5} L_{1}^{2}}{2 EI} + \frac{C_{6} L_{1}}{EI} + C_{7} - \frac{L_{1}^{3} q_{2}}{6 EI}\]
\[\displaystyle - \frac{C_{5} \left(L_{1} + L_{2}\right)^{3}}{6 EI} - \frac{C_{6} \left(L_{1} + L_{2}\right)^{2}}{2 EI} - C_{7} \left(L_{1} + L_{2}\right) + C_{8} + \frac{q_{2} \left(L_{1} + L_{2}\right)^{4}}{24 EI} = 0\]
\[\displaystyle C_{5} \left(L_{1} + L_{2}\right) + C_{6} - \frac{q_{2} \left(L_{1} + L_{2}\right)^{2}}{2} = 0\]
sol = sp.solve((Eq1,Eq2,Eq3,Eq4,Eq5,Eq6,Eq7,Eq8),(C1,C2,C3,C4,C5,C6,C7,C8))
display(sol[C1])
display(sol[C2])
display(sol[C3])
display(sol[C4])
display(sol[C5])
display(sol[C6])
display(sol[C7])
display(sol[C8])
\[\displaystyle \frac{12 F L_{1}^{2} L_{2} + 24 F L_{1} L_{2}^{2} + 8 F L_{2}^{3} + 5 L_{1}^{4} q_{1} + 20 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{2} L_{2}^{2} q_{1} + 6 L_{1}^{2} L_{2}^{2} q_{2} + 8 L_{1} L_{2}^{3} q_{1} + 12 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}}{8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}}\]
\[\displaystyle \frac{- 4 F L_{1}^{2} L_{2} - 8 F L_{1} L_{2}^{2} - L_{1}^{4} q_{1} - 4 L_{1}^{3} L_{2} q_{1} - 4 L_{1}^{2} L_{2}^{2} q_{1} - 2 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}}{8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}}\]
\[\displaystyle 0\]
\[\displaystyle 0\]
\[\displaystyle \frac{- 8 F L_{1}^{3} - 12 F L_{1}^{2} L_{2} - 3 L_{1}^{4} q_{1} + 8 L_{1}^{4} q_{2} - 4 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{3} L_{2} q_{2} + 30 L_{1}^{2} L_{2}^{2} q_{2} + 20 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}}{8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}}\]
\[\displaystyle \frac{8 F L_{1}^{3} + 12 F L_{1}^{2} L_{2} + 3 L_{1}^{4} q_{1} - 4 L_{1}^{4} q_{2} + 4 L_{1}^{3} L_{2} q_{1} - 8 L_{1}^{3} L_{2} q_{2} - 6 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}}{8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}}\]
\[\displaystyle \frac{- 3 F L_{1}^{2} - L_{1}^{3} q_{1} + L_{1}^{3} q_{2}}{6 EI}\]
\[\displaystyle \frac{- 4 F L_{1}^{3} - L_{1}^{4} q_{1} + L_{1}^{4} q_{2}}{24 EI}\]
w1_sol = w1.subs(sol)
w2_sol = w2.subs(sol)
display(w1_sol,w2_sol)
\[\displaystyle \frac{q_{1} x^{4}}{24 EI} - \frac{x^{3} \cdot \left(12 F L_{1}^{2} L_{2} + 24 F L_{1} L_{2}^{2} + 8 F L_{2}^{3} + 5 L_{1}^{4} q_{1} + 20 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{2} L_{2}^{2} q_{1} + 6 L_{1}^{2} L_{2}^{2} q_{2} + 8 L_{1} L_{2}^{3} q_{1} + 12 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}\right)}{6 EI \left(8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}\right)} - \frac{x^{2} \left(- 4 F L_{1}^{2} L_{2} - 8 F L_{1} L_{2}^{2} - L_{1}^{4} q_{1} - 4 L_{1}^{3} L_{2} q_{1} - 4 L_{1}^{2} L_{2}^{2} q_{1} - 2 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}\right)}{2 EI \left(8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}\right)}\]
\[\displaystyle \frac{q_{2} x^{4}}{24 EI} - \frac{x^{3} \left(- 8 F L_{1}^{3} - 12 F L_{1}^{2} L_{2} - 3 L_{1}^{4} q_{1} + 8 L_{1}^{4} q_{2} - 4 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{3} L_{2} q_{2} + 30 L_{1}^{2} L_{2}^{2} q_{2} + 20 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}\right)}{6 EI \left(8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}\right)} - \frac{x^{2} \cdot \left(8 F L_{1}^{3} + 12 F L_{1}^{2} L_{2} + 3 L_{1}^{4} q_{1} - 4 L_{1}^{4} q_{2} + 4 L_{1}^{3} L_{2} q_{1} - 8 L_{1}^{3} L_{2} q_{2} - 6 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}\right)}{2 EI \left(8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}\right)} - \frac{x \left(- 3 F L_{1}^{2} - L_{1}^{3} q_{1} + L_{1}^{3} q_{2}\right)}{6 EI} + \frac{- 4 F L_{1}^{3} - L_{1}^{4} q_{1} + L_{1}^{4} q_{2}}{24 EI}\]
w1_subs = w1_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
w2_subs = w2_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
display(w1_subs,w2_subs)
\[\displaystyle - \frac{231 x^{3}}{40960} + \frac{181 x^{2}}{5120}\]
\[\displaystyle \frac{x^{4}}{3000} - \frac{19373 x^{3}}{3072000} + \frac{2989 x^{2}}{128000} + \frac{27 x}{500} - \frac{63}{1000}\]
x1_plot = np.linspace(0,3,30)
x2_plot = np.linspace(3,8,80)
w1_numpy = sp.lambdify(x,w1_subs)
w2_numpy = sp.lambdify(x,w2_subs)
w1_plot = w1_numpy(x1_plot)
w2_plot = w2_numpy(x2_plot)
plt.plot(x1_plot,w1_plot)
plt.plot(x2_plot,w2_plot)
plt.gca().invert_yaxis()
plt.title("w-lijn")
plt.axhline(0,color='black')
plt.xlim(0,8)
plt.annotate('%.2f m' % w1_numpy(3),xy = [3,w1_numpy(3)])
plt.axis('off');
../_images/f58cdd7233a12e7deab005790514fa898c0a1e35f08cb0460ed18afc3167b3a4.png
phi1_sol = phi1.subs(sol)
phi2_sol = phi2.subs(sol)
display(phi1_sol, phi2_sol)

phi1_subs = phi1_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
phi2_subs = phi2_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
display(phi1_subs, phi2_subs)

phi1_numpy = sp.lambdify(x,phi1_subs)
phi2_numpy = sp.lambdify(x,phi2_subs)
phi1_plot = phi1_numpy(x1_plot)
phi2_plot = phi2_numpy(x2_plot)
plt.figure()
plt.plot(x1_plot,phi1_plot)
plt.plot(x2_plot,phi2_plot)
plt.gca().invert_yaxis()
plt.title("phi-lijn")
plt.axhline(0,color='black')
plt.xlim(0,8)
plt.annotate('%.4f m/m' % phi1_numpy(3),xy = [3,phi1_numpy(3)])
plt.annotate('%.4f m/m' % phi2_numpy(8),xy = [8,phi2_numpy(8)])
plt.axis('off');
\[\displaystyle - \frac{q_{1} x^{3}}{6 EI} + \frac{x^{2} \cdot \left(12 F L_{1}^{2} L_{2} + 24 F L_{1} L_{2}^{2} + 8 F L_{2}^{3} + 5 L_{1}^{4} q_{1} + 20 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{2} L_{2}^{2} q_{1} + 6 L_{1}^{2} L_{2}^{2} q_{2} + 8 L_{1} L_{2}^{3} q_{1} + 12 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}\right)}{2 EI \left(8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}\right)} + \frac{x \left(- 4 F L_{1}^{2} L_{2} - 8 F L_{1} L_{2}^{2} - L_{1}^{4} q_{1} - 4 L_{1}^{3} L_{2} q_{1} - 4 L_{1}^{2} L_{2}^{2} q_{1} - 2 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}\right)}{EI \left(8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}\right)}\]
\[\displaystyle - \frac{q_{2} x^{3}}{6 EI} + \frac{x^{2} \left(- 8 F L_{1}^{3} - 12 F L_{1}^{2} L_{2} - 3 L_{1}^{4} q_{1} + 8 L_{1}^{4} q_{2} - 4 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{3} L_{2} q_{2} + 30 L_{1}^{2} L_{2}^{2} q_{2} + 20 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}\right)}{2 EI \left(8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}\right)} + \frac{x \left(8 F L_{1}^{3} + 12 F L_{1}^{2} L_{2} + 3 L_{1}^{4} q_{1} - 4 L_{1}^{4} q_{2} + 4 L_{1}^{3} L_{2} q_{1} - 8 L_{1}^{3} L_{2} q_{2} - 6 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}\right)}{EI \left(8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}\right)} + \frac{- 3 F L_{1}^{2} - L_{1}^{3} q_{1} + L_{1}^{3} q_{2}}{6 EI}\]
\[\displaystyle \frac{693 x^{2}}{40960} - \frac{181 x}{2560}\]
\[\displaystyle - \frac{x^{3}}{750} + \frac{19373 x^{2}}{1024000} - \frac{2989 x}{64000} - \frac{27}{500}\]
../_images/b971e7bd28fad6d23199de083c33a01f5809c7aba81595d6d84b12b364c4e125.png
M1_sol = M1.subs(sol)
M2_sol = M2.subs(sol)
display(M1_sol, M2_sol)

M1_subs = M1_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
M2_subs = M2_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
display(M1_subs, M2_subs)

M1_numpy = sp.lambdify(x,M1_subs)
M2_numpy = sp.lambdify(x,M2_subs)
M1_plot = M1_numpy(x1_plot)
M2_plot = M2_numpy(x2_plot)
plt.figure()
plt.plot(x1_plot,M1_plot)
plt.plot(x2_plot,M2_plot)
plt.gca().invert_yaxis()
plt.title("M-lijn")
plt.axhline(0,color='black')
plt.xlim(0,8)
plt.annotate('%.2f kNm' % M1_numpy(0),xy = [0,M1_numpy(0)])
plt.annotate('%.2f kNm' % M1_numpy(3),xy = [3,M1_numpy(3)])
plt.annotate('%.2f kNm' % M2_numpy(5.5),xy = [5.5,M2_numpy(5.5)])
plt.axis('off');
\[\displaystyle - \frac{q_{1} x^{2}}{2} + \frac{x \left(12 F L_{1}^{2} L_{2} + 24 F L_{1} L_{2}^{2} + 8 F L_{2}^{3} + 5 L_{1}^{4} q_{1} + 20 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{2} L_{2}^{2} q_{1} + 6 L_{1}^{2} L_{2}^{2} q_{2} + 8 L_{1} L_{2}^{3} q_{1} + 12 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}\right)}{8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}} + \frac{- 4 F L_{1}^{2} L_{2} - 8 F L_{1} L_{2}^{2} - L_{1}^{4} q_{1} - 4 L_{1}^{3} L_{2} q_{1} - 4 L_{1}^{2} L_{2}^{2} q_{1} - 2 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}}{8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}}\]
\[\displaystyle - \frac{q_{2} x^{2}}{2} + \frac{x \left(- 8 F L_{1}^{3} - 12 F L_{1}^{2} L_{2} - 3 L_{1}^{4} q_{1} + 8 L_{1}^{4} q_{2} - 4 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{3} L_{2} q_{2} + 30 L_{1}^{2} L_{2}^{2} q_{2} + 20 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}\right)}{8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}} + \frac{8 F L_{1}^{3} + 12 F L_{1}^{2} L_{2} + 3 L_{1}^{4} q_{1} - 4 L_{1}^{4} q_{2} + 4 L_{1}^{3} L_{2} q_{1} - 8 L_{1}^{3} L_{2} q_{2} - 6 L_{1}^{2} L_{2}^{2} q_{2} - 4 L_{1} L_{2}^{3} q_{2} - L_{2}^{4} q_{2}}{8 L_{1}^{2} + 16 L_{1} L_{2} + 8 L_{2}^{2}}\]
\[\displaystyle \frac{17325 x}{512} - \frac{4525}{64}\]
\[\displaystyle - 4 x^{2} + \frac{19373 x}{512} - \frac{2989}{64}\]
../_images/a9fa36095b93cff0664ef3f39b993860c17bf6c71c093bd4adb73ec4dc556ff5.png
V1_sol = V1.subs(sol)
V2_sol = V2.subs(sol)
display(V1_sol, V2_sol)

V1_subs = V1_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
V2_subs = V2_sol.subs([(EI,1000),(F,20),(q1,0),(q2,8),(L1,3),(L2,5)])
display(V1_subs, V2_subs)

V1_numpy = sp.lambdify(x,V1_subs)
V2_numpy = sp.lambdify(x,V2_subs)
V1_plot = V1_numpy(x1_plot)
V2_plot = V2_numpy(x2_plot)
plt.figure()
plt.plot([0,3],[V1_plot,V1_plot])
plt.plot(x2_plot,V2_plot)
plt.gca().invert_yaxis()
plt.title("V-lijn")
plt.axhline(0,color='black')
plt.xlim(0,8) 
plt.annotate('%.2f kN' % V1_numpy(0),xy = [0,V1_numpy(0)])
plt.annotate('%.2f kN' % V1_numpy(3),xy = [3,V1_numpy(3)])
plt.annotate('%.2f kN' % V2_numpy(3),xy = [3,V2_numpy(3)])
plt.annotate('%.2f kN' % V2_numpy(8),xy = [8,V2_numpy(8)])
plt.axis('off');
\[\displaystyle - q_{1} x + \frac{12 F L_{1}^{2} L_{2} + 24 F L_{1} L_{2}^{2} + 8 F L_{2}^{3} + 5 L_{1}^{4} q_{1} + 20 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{2} L_{2}^{2} q_{1} + 6 L_{1}^{2} L_{2}^{2} q_{2} + 8 L_{1} L_{2}^{3} q_{1} + 12 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}}{8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}}\]
\[\displaystyle - q_{2} x + \frac{- 8 F L_{1}^{3} - 12 F L_{1}^{2} L_{2} - 3 L_{1}^{4} q_{1} + 8 L_{1}^{4} q_{2} - 4 L_{1}^{3} L_{2} q_{1} + 24 L_{1}^{3} L_{2} q_{2} + 30 L_{1}^{2} L_{2}^{2} q_{2} + 20 L_{1} L_{2}^{3} q_{2} + 5 L_{2}^{4} q_{2}}{8 L_{1}^{3} + 24 L_{1}^{2} L_{2} + 24 L_{1} L_{2}^{2} + 8 L_{2}^{3}}\]
\[\displaystyle \frac{17325}{512}\]
\[\displaystyle \frac{19373}{512} - 8 x\]
../_images/9adaf8db099e08b7fb3ab30c0df935ae63078cea49afbaba6ea42b4cc6bf237d.png