Failed to rearrange. Have to ceom back to that.
from sympy import *
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
x, h = symbols('x h')
M = Matrix([
[1, 0, 0, 0],
[0, 1, 0, 0],
[1, h, h**2, h**3],
[0, 1, 2*h, 3*h**2]
])
M
# Example from Fig. 9.2
u0 = Matrix([[1], [0], [0], [0]])
u1 = Matrix([[0], [1], [0], [0]])
u2 = Matrix([[0], [0], [1], [0]])
u3 = Matrix([[0], [0], [0], [1]])
# Matrix inversion test
a0 = M.inv()*u0
a1 = M.inv()*u1
a2 = M.inv()*u2
a3 = M.inv()*u3
M.inv()
V, E, I, u, a, b = symbols('V E I u a b')
E=1 #elasticity modulus
I=1 #moment of interia
# u= ???
# f= ???
# rough structure -
# haven't found how to represent equation for potential energy yet
#V=integrate(1/2*E*I*(diff(u, x, x))**2-u*f[i], ???)