```python
from sympy import *

kwargs = {}
kwargs["mat_str"] = "bmatrix"
kwargs["mat_delim"] = ""

l, EI, M = var("l, EI, M")

l2 = l*l
l3 = l*l*l

pprint("\nVar. 1:")
K = EI/l3
K *= Matrix(
[
[  4*l2 ,  -6*l ,  2*l2 ,   6*l ,  0    ,   0    ],
[ -6*l  ,  12   , -6*l  , -12   ,  0    ,   0    ],
[  2*l2 ,  -6*l ,  8*l2 ,   0   ,  2*l2 ,   6*l  ],
[  6*l  , -12   ,  0    ,  24   , -6*l  , -12    ],
[  0    ,   0   ,  2*l2 ,  -6*l ,  4*l2 ,   6*l  ],
[  0    ,   0   ,  6*l  , -12   ,  6*l  ,  12    ],
]
)
pprint(latex(K / (EI/l3),**kwargs))

p1,w1,p2,w2,p3,w3 = var("psi,w1,psi2,w2,psi3,w3")
M1,F1,M2,F2,M3,F3 = var("M1,F1,M2,F2,M3,F3")
u = Matrix([0,0,p2,w2,0,0])
f = Matrix([M1,F1,-M,0,M3,F3])

unknowns = [M1,F1,p2,w2,M3,F3]

eq = Eq(K*u , f)
sol = solve(eq, unknowns)
pprint(sol)

pprint("\nVar. 2:")
K = EI/l3
K *= Matrix(
[
[  4*l2 ,  -6*l ,  2*l2 ,   6*l  ],
[ -6*l  ,  12   , -6*l  , -12    ],
[  2*l2 ,  -6*l ,  4*l2 ,   6*l  ],
[  6*l  , -12   ,  6*l  ,  12    ],
]
)
# pprint("\nK:")
# pprint(latex(K / (EI/l3),**kwargs))

p1,w1,p2,w2 = var("psi1,w1,psi2,w2")
M1,F1,M2,F2 = var("M1,F1,M2,F2")
u = Matrix([p1,0,0,0])
f = Matrix([-M/2,F1,M2,F2])

unknowns = [p1,F1,M2,F2]

eq = Eq(K*u , f)
sol = solve(eq, unknowns)
pprint(sol)

# Var. 1:
# ⎧    3⋅M      -3⋅M       -M       -M       -M⋅l        ⎫
# ⎨F₁: ───, F₃: ─────, M₁: ───, M₃: ───, ψ₂: ─────, w₂: 0⎬
# ⎩    4⋅l       4⋅l        4        4        8⋅EI       ⎭
#
# Var. 2:
# ⎧    3⋅M      -3⋅M       -M       -M⋅l ⎫
# ⎨F₁: ───, F₂: ─────, M₂: ───, ψ₁: ─────⎬
# ⎩    4⋅l       4⋅l        4        8⋅EI⎭

```

aff9455ca49bc041af99807fd3cdc4a9fb63f9b0
ipynb
Jupyter Notebook
ipynb/HTM_03/Exam/2/a2.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
ipynb/HTM_03/Exam/2/a2.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
ipynb/HTM_03/Exam/2/a2.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
Qwen/Qwen-72B
1. YES
2. YES