Created
February 17, 2015 17:37
-
-
Save jamiek/c10ef33abd0911a2622d to your computer and use it in GitHub Desktop.
ex 4.9 with additional point load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "Ex 4-9 modified_and Numerical" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "heading", | |
"level": 2, | |
"metadata": {}, | |
"source": "Example 4.9 with slight modification, Added a point force P acting donward at node 2" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": true, | |
"input": "from sympy import *\nfrom sympy import Matrix\nfrom sympy import init_printing\nfrom IPython.display import Latex, Math, display #allow printing latex inline with formatted matricies\ninit_printing()\n#%load_ext sympy.interactive.ipythonprinting\n\n\n\n\nE = Symbol('E')\nI = Symbol('I')\nL = Symbol('L')\nP2 = Symbol('P2')\nM2 = Symbol('M2')\nM3 = Symbol('M3')\nw = Symbol ('w')\nP= Symbol('P')\nF1y= Symbol('F_{1y}')\nF3y= Symbol('F_{3y}')\nM1= Symbol('M_{1}')\nM3= Symbol('M_{3}')\nD = Symbol('D')\nv2 = Symbol('v2')\nphi2 = Symbol('\\phi_2')\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "from IPython.display import HTML\n\nHTML('''<script>\ncode_show=true; \nfunction code_toggle() {\n if (code_show){\n $('div.input').hide();\n } else {\n $('div.input').show();\n }\n code_show = !code_show\n} \n$( document ).ready(code_toggle);\n</script>\nThe raw code for this IPython notebook is by default hidden for easier reading.\nTo toggle on/off the raw code, click <a href=\"javascript:code_toggle()\">here</a>.''')", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": "<script>\ncode_show=true; \nfunction code_toggle() {\n if (code_show){\n $('div.input').hide();\n } else {\n $('div.input').show();\n }\n code_show = !code_show\n} \n$( document ).ready(code_toggle);\n</script>\nThe raw code for this IPython notebook is by default hidden for easier reading.\nTo toggle on/off the raw code, click <a href=\"javascript:code_toggle()\">here</a>.", | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 2, | |
"text": "<IPython.core.display.HTML at 0xa163650>" | |
} | |
], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Define element stiffness" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "k= (1/L**3)*E*I*Matrix([[12, 6*L, -12, 6*L], [6*L, 4*L*L, -6*L, 2*L*L], [-12, -6*L, 12, -6*L], [6*L, 2*L*L, -6*L, 4*L*L] ])\ndisplay(Math(latex('[k]= ')+latex(k)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$[k]= \\left[\\begin{smallmatrix}{}\\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I & - \\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I\\\\\\frac{6 E}{L^{2}} I & \\frac{4 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I\\\\- \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I & \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I\\\\\\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{4 E}{L} I\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x13710fb0>" | |
} | |
], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "K_g=zeros(6)", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 3, | |
"metadata": {}, | |
"source": "Add element 1 to global matrix" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "K_g[0:4,0:4] = K_g[0:4,0:4] +k\ndisplay(Math(latex('[K]= ')+latex(K_g)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$[K]= \\left[\\begin{smallmatrix}{}\\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I & - \\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I & 0 & 0\\\\\\frac{6 E}{L^{2}} I & \\frac{4 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I & 0 & 0\\\\- \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I & \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I & 0 & 0\\\\\\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{4 E}{L} I & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0 & 0 & 0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163b30>" | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Add element 2 to global matrix" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "K_g[2:6,2:6]=K_g[2:6,2:6] + k\ndisplay(Math(latex('[K]= ')+latex(K_g)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$[K]= \\left[\\begin{smallmatrix}{}\\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I & - \\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I & 0 & 0\\\\\\frac{6 E}{L^{2}} I & \\frac{4 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I & 0 & 0\\\\- \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I & \\frac{24 E}{L^{3}} I & 0 & - \\frac{12 E}{L^{3}} I & \\frac{6 E}{L^{2}} I\\\\\\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I & 0 & \\frac{8 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I\\\\0 & 0 & - \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I & \\frac{12 E}{L^{3}} I & - \\frac{6 E}{L^{2}} I\\\\0 & 0 & \\frac{6 E}{L^{2}} I & \\frac{2 E}{L} I & - \\frac{6 E}{L^{2}} I & \\frac{4 E}{L} I\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163a70>" | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Work equivalent nodal loads for element 1" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "f1_0 = Matrix([-3*w*L/40, -(w*L**2)/60, -7*w*L/40, (w*L**2)/40])\ndisplay(Math(latex('\\{f^{(1)}_0\\}= ')+latex(f1_0)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{f^{(1)}_0\\}= \\left[\\begin{smallmatrix}{}- \\frac{3 L}{40} w\\\\- \\frac{L^{2} w}{60}\\\\- \\frac{7 L}{40} w\\\\\\frac{L^{2} w}{40}\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163c30>" | |
} | |
], | |
"prompt_number": 7 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Work equivalent nodal loads for element 2" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "f2_0 = Matrix([-13*w*L/40, -(7*w*L**2)/120, -17*w*L/40, (w*L**2)/15])\ndisplay(Math(latex('\\{f^{(2)}_0\\}= ')+latex(f2_0)))\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{f^{(2)}_0\\}= \\left[\\begin{smallmatrix}{}- \\frac{13 L}{40} w\\\\- \\frac{7 w}{120} L^{2}\\\\- \\frac{17 L}{40} w\\\\\\frac{L^{2} w}{15}\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163c30>" | |
} | |
], | |
"prompt_number": 8 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "System load array" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "F = zeros(6,1)\nF[0] = F1y\nF[1] = M1\nF[2] = -P\nF[4] = F3y\ndisplay(Math(latex('\\{F\\} = ')+latex(F)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{F\\} = \\left[\\begin{smallmatrix}{}F_{{1y}}\\\\M_{{1}}\\\\- P\\\\0\\\\F_{{3y}}\\\\0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163b50>" | |
} | |
], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Convert to numerical values with L = 100in, w = 20 lb/in, P=1000 lb, E = 30E6 psi, I =100 in^4" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "#convert to numerical values with L = 100in, w = 20 lb/in, P=1000 lb, E = 30E6 psi, I =100 in^4\nkn = k.subs({L:100, E:30e6, I:100, w:20, P:1000})\nkn = np.array(np.array(kn), np.float)\n\nK_gn = K_g.subs({L:100, E:30e6, I:100, w:20, P:1000})\nK_gn = np.array(np.array(K_gn), np.float)\n\nf1_0n = f1_0.subs({L:100, E:30e6, I:100, w:20, P:1000})\nf1_0n = np.array(np.array(f1_0n), np.float)\n\nf2_0n = f2_0.subs({L:100, E:30e6, I:100, w:20, P:1000})\nf2_0n = np.array(np.array(f2_0n), np.float)\n\nFn = F.subs({L:100, E:30e6, I:100, w:20, P:1000, F1y:0, F3y:0, M1:0, M3:0})\nFn = np.array(np.array(Fn), np.float)\n\n\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 10 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Enforce constraints and solve for {d}" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "F_0n = np.zeros((6,1))\nF_0n[0:4] = f1_0n \nF_0n[2:6] = f2_0n +F_0n[2:6]\n\nF_rn = F_0n + Fn\n\ndisplay(Math(latex('\\{F\\} = [K]\\{d\\} - \\{F_0\\} ')))\n\nD = [0, 0, v2, phi2, 0, 0]\n\ndisplay(Math( latex(F) + latex('=') + latex(Matrix(K_gn).evalf(4)) + latex(Matrix(D)) + latex('-')+ latex(Matrix(F_0n).evalf(5))))\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{F\\} = [K]\\{d\\} - \\{F_0\\} $$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1374b2f0>" | |
}, | |
{ | |
"latex": "$$\\left[\\begin{smallmatrix}{}F_{{1y}}\\\\M_{{1}}\\\\- P\\\\0\\\\F_{{3y}}\\\\0\\end{smallmatrix}\\right]=\\left[\\begin{smallmatrix}{}3.6 \\cdot 10^{4} & 1.8 \\cdot 10^{6} & -3.6 \\cdot 10^{4} & 1.8 \\cdot 10^{6} & 0 & 0\\\\1.8 \\cdot 10^{6} & 1.2 \\cdot 10^{8} & -1.8 \\cdot 10^{6} & 6.0 \\cdot 10^{7} & 0 & 0\\\\-3.6 \\cdot 10^{4} & -1.8 \\cdot 10^{6} & 7.2 \\cdot 10^{4} & 0 & -3.6 \\cdot 10^{4} & 1.8 \\cdot 10^{6}\\\\1.8 \\cdot 10^{6} & 6.0 \\cdot 10^{7} & 0 & 2.4 \\cdot 10^{8} & -1.8 \\cdot 10^{6} & 6.0 \\cdot 10^{7}\\\\0 & 0 & -3.6 \\cdot 10^{4} & -1.8 \\cdot 10^{6} & 3.6 \\cdot 10^{4} & -1.8 \\cdot 10^{6}\\\\0 & 0 & 1.8 \\cdot 10^{6} & 6.0 \\cdot 10^{7} & -1.8 \\cdot 10^{6} & 1.2 \\cdot 10^{8}\\end{smallmatrix}\\right]\\left[\\begin{smallmatrix}{}0\\\\0\\\\v_{2}\\\\\\phi_{2}\\\\0\\\\0\\end{smallmatrix}\\right]-\\left[\\begin{smallmatrix}{}-150.0\\\\-3333.3\\\\-1000.0\\\\-6666.7\\\\-850.0\\\\13333.0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa16d050>" | |
} | |
], | |
"prompt_number": 11 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "D_rn = dot(inv(K_gn[2:4,2:4]),F_rn[2:4])\nD_n = np.zeros((6,1))\nD_n[2:4] = D_rn \ndisplay(Math(latex('\\{d\\}= ')+latex(Matrix(D_n).evalf(4))))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{d\\}= \\left[\\begin{smallmatrix}{}0\\\\0\\\\-0.02778\\\\-2.778 \\cdot 10^{-5}\\\\0\\\\0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163ff0>" | |
} | |
], | |
"prompt_number": 12 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "System force array (Reactions)" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "#reactions\nR_n = dot(K_gn,D_n) - F_0n\ndisplay(Math(latex('\\{F\\}= ')+latex(Matrix(R_n).evalf(5))))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{F\\}= \\left[\\begin{smallmatrix}{}1100.0\\\\51667.0\\\\-1000.0\\\\0\\\\1900.0\\\\-65000.0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163d50>" | |
} | |
], | |
"prompt_number": 13 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 4, | |
"metadata": {}, | |
"source": "Element Forces" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "#element forces\nf1n = dot(kn,D_n[0:4]) - f1_0n\ndisplay(Math(latex('\\{f^1\\}= ')+latex(Matrix(f1n).evalf(5))))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{f^1\\}= \\left[\\begin{smallmatrix}{}1100.0\\\\51667.0\\\\-600.0\\\\41667.0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163e70>" | |
} | |
], | |
"prompt_number": 14 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "f2n = dot(kn,D_n[2:6]) - f2_0n\ndisplay(Math(latex('\\{f^2\\}= ')+latex(Matrix(f2n).evalf(5))))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$\\{f^2\\}= \\left[\\begin{smallmatrix}{}-400.0\\\\-41667.0\\\\1900.0\\\\-65000.0\\end{smallmatrix}\\right]$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163c30>" | |
} | |
], | |
"prompt_number": 15 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 3, | |
"metadata": {}, | |
"source": "Calculate shear and moment based on differential realtions" | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "v1 = Symbol('v1')\nv2 = Symbol('v2')\nphi1 = Symbol('phi1')\nphi2 = Symbol('phi2')\nx = Symbol('x')\nv = ((2/L**3)*(v1-v2) + (1/L**2)*(phi1 +phi2))*x**3 + (-3/(L**2)*(v1-v2) - 1/L*(2*phi1 + phi2))*x**2 + phi1*x + v1\ndisplay(Latex('recall our displacement function:'))\ndisplay(Math(latex(r'\\tilde{v}(x) = ')+latex(v)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "recall our displacement function:", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0x1374b5d0>" | |
}, | |
{ | |
"latex": "$$\\tilde{v}(x) = \\phi_{1} x + v_{1} + x^{3} \\left(\\frac{1}{L^{2}} \\left(\\phi_{1} + \\phi_{2}\\right) + \\frac{1}{L^{3}} \\left(2 v_{1} - 2 v_{2}\\right)\\right) + x^{2} \\left(- \\frac{1}{L} \\left(2 \\phi_{1} + \\phi_{2}\\right) - \\frac{1}{L^{2}} \\left(3 v_{1} - 3 v_{2}\\right)\\right)$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1374b5f0>" | |
} | |
], | |
"prompt_number": 16 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "V=E*I*diff(v,x,3)\ndisplay(Math(latex(r'V(x)=EI\\frac{d^3\\tilde{v}(x)}{dx^3} = ')+latex(V)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "$$V(x)=EI\\frac{d^3\\tilde{v}(x)}{dx^3} = \\frac{6 E}{L^{2}} I \\left(\\phi_{1} + \\phi_{2} + \\frac{1}{L} \\left(2 v_{1} - 2 v_{2}\\right)\\right)$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1371c230>" | |
} | |
], | |
"prompt_number": 17 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "V1= V.subs({L:100, E:30e6, I:100, v1:D_n[0], phi1:D_n[1], v2:D_n[2], phi2:D_n[3] })\ndisplay(Latex('The shear force in element 1:'))\ndisplay(Math(latex('V^{(1)}= ')+latex(V1.evalf(5))))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "The shear force in element 1:", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0x1374b270>" | |
}, | |
{ | |
"latex": "$$V^{(1)}= 950.0$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0xa163ed0>" | |
} | |
], | |
"prompt_number": 18 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "V2= V.subs({L:100, E:30e6, I:100, v1:D_n[2], phi1:D_n[3], v2:D_n[4], phi2:D_n[5] })\ndisplay(Latex('The shear force in element 2:'))\ndisplay(Math(latex('V^{(2)}= ')+latex(V2.evalf(5))))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "The shear force in element 2:", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0x1374b450>" | |
}, | |
{ | |
"latex": "$$V^{(2)}= -1050.0$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1374b150>" | |
} | |
], | |
"prompt_number": 19 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "M=E*I*diff(v,x,2)\ndisplay(Latex('The bending moment:'))\ndisplay(Math(latex(r'M(x)=EI\\frac{d^2\\tilde{v}(x)}{dx^2} = ')+latex(M)))", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "The bending moment:", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0x1374b4b0>" | |
}, | |
{ | |
"latex": "$$M(x)=EI\\frac{d^2\\tilde{v}(x)}{dx^2} = \\frac{2 E}{L} I \\left(- 2 \\phi_{1} - \\phi_{2} + \\frac{3 x}{L} \\left(\\phi_{1} + \\phi_{2} + \\frac{1}{L} \\left(2 v_{1} - 2 v_{2}\\right)\\right) - \\frac{1}{L} \\left(3 v_{1} - 3 v_{2}\\right)\\right)$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1374b750>" | |
} | |
], | |
"prompt_number": 20 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "Me1= M.subs({L:100, E:30e6, I:100, v1:D_n[0], phi1:D_n[1], v2:D_n[2], phi2:D_n[3] })\ndisplay(Latex('The bending moment in element 1:'))\ndisplay(Math(latex('M^{(1)}= ')+latex(Me1.evalf(5))))\ndisplay(Latex('remeber that the x here is \"local\" to the element (i.e. from 0 to 100)'))\n", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "The bending moment in element 1:", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0x1374bd30>" | |
}, | |
{ | |
"latex": "$$M^{(1)}= 950.0 x - 48333.0$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1374bcd0>" | |
}, | |
{ | |
"latex": "remeber that the x here is \"local\" to the element (i.e. from 0 to 100)", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0xa16d170>" | |
} | |
], | |
"prompt_number": 21 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "Me2=M.subs({L:100, E:30e6, I:100, v1:D_n[2], phi1:D_n[3], v2:D_n[4], phi2:D_n[5] })\ndisplay(Latex('The bending moment in element 2:'))\ndisplay(Math(latex('M^{(2)}= ')+latex(Me2.evalf(5))))\ndisplay(Latex('remeber that the x here is \"local\" to the element (i.e. from 0 to 100)'))\n#remeber that the x here is \"local\" to the element (e.g. from 0 to 100)", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": "The bending moment in element 2:", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0x1374b5d0>" | |
}, | |
{ | |
"latex": "$$M^{(2)}= - 1050.0 x + 53333.0$$", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Math at 0x1374b5d0>" | |
}, | |
{ | |
"latex": "remeber that the x here is \"local\" to the element (i.e. from 0 to 100)", | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": "<IPython.core.display.Latex at 0xa16d110>" | |
} | |
], | |
"prompt_number": 22 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 22 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment