In [1]:
from sympy import *
tension_bottom = Symbol('T_b')
K = Symbol('K')
z = Symbol('z')
L = Symbol('L')
E,I = symbols('E I')
tension = (tension_bottom + K*z)
linear_density = Symbol('m')
loading = Symbol('p')
shape_function = Matrix([
1 - 3 * (z/L)**2 + 2 * (z/L)**3,
z * (1 - z/L)**2,
3 * (z/L)**2 - 2 * (z/L)**3,
z**2 / L * (z/L - 1)
])
shape_function_derivation = diff(shape_function, z)
shape_function_derivation_derivation = diff(shape_function, z, z)
M_integral = linear_density * shape_function * shape_function.T
K_integral = shape_function_derivation_derivation * shape_function_derivation_derivation.T *E *I
Kg_integral = shape_function_derivation * shape_function_derivation.T * tension
loading_integral = shape_function * loading
M = integrate(M_integral, (z, 0, L))
K = integrate( K_integral, (z, 0, L))
Kg = integrate(Kg_integral, (z, 0, L))
Loading = integrate(loading_integral, (z, 0, L))
In [2]:
M = expand(M)
K = expand(K)
Kg = expand(Kg)
Loading = expand(Loading)
In [3]:
init_printing()
In [4]:
M
Out[4]:
In [5]:
K
Out[5]:
In [6]:
Kg
Out[6]:
In [7]:
Loading
Out[7]:
In [ ]: