```python
# https://colab.research.google.com/github/kassbohm/wb-snippets/blob/master/ipynb/HTM_03/Selbst/4.4.ipynb

from sympy import *
sa_subs, ca_subs = var("s, c")

pprint("\nJ: Inertia Tensor wrt CG.")
pprint("\nJK: K-Components of J.")
pprint("\nJI: I-Components of J.")

pprint("\nJK / (ml²):")
JK = Matrix([
    [  96,   0, -72 ],
    [   0, 150,   0 ],
    [ -72,   0,  54 ],
    ])
pprint(JK)

alpha = var("alpha")
ca, sa = cos(alpha), sin(alpha)
R = Matrix([
    [ ca, sa, 0],
    [-sa, ca, 0],
    [  0,  0, 1],
    ])
Rt = R.transpose()
JI = Rt * JK * R


pprint("\nJI / (ml²):")

tmp = JI.subs([
    (sa, sa_subs),
    (ca, ca_subs),
    ])
pprint(tmp)

# pprint("\nEigenvalue of JK / ( ml² ), Multiplicity, Eigenvector:")
# tmp = JK.eigenvects()
# pprint(tmp)

A, JE = JK.diagonalize(normalize=True)

pprint("\nJE: JK diagonalized / ( ml² ):")
pprint(JE)

pprint("\nA, so that JK = A JE Aᵀ:")
pprint(A)

pprint("\nChecking: JK must be equal to A JE Aᵀ:")
tmp = A*JE*A.transpose()
pprint(tmp)

# JK: K-Components of JC / ( ml² ):
# ⎡96    0   -72⎤
# ⎢             ⎥
# ⎢ 0   150   0 ⎥
# ⎢             ⎥
# ⎣-72   0   54 ⎦
#
# JI: I-Components of JC / ( ml² ):
# ⎡    2        2                       ⎤
# ⎢96⋅c  + 150⋅s      -54⋅c⋅s      -72⋅c⎥
# ⎢                                     ⎥
# ⎢                     2       2       ⎥
# ⎢   -54⋅c⋅s      150⋅c  + 96⋅s   -72⋅s⎥
# ⎢                                     ⎥
# ⎣    -72⋅c           -72⋅s        54  ⎦
#
# Eigenvalue / ( ml² ), multiplicity, eigenvector:
# ⎡⎛      ⎡⎡3/4⎤⎤⎞  ⎛        ⎡⎡0⎤  ⎡-4/3⎤⎤⎞⎤
# ⎢⎜      ⎢⎢   ⎥⎥⎟  ⎜        ⎢⎢ ⎥  ⎢    ⎥⎥⎟⎥
# ⎢⎜0, 1, ⎢⎢ 0 ⎥⎥⎟, ⎜150, 2, ⎢⎢1⎥, ⎢ 0  ⎥⎥⎟⎥
# ⎢⎜      ⎢⎢   ⎥⎥⎟  ⎜        ⎢⎢ ⎥  ⎢    ⎥⎥⎟⎥
# ⎣⎝      ⎣⎣ 1 ⎦⎦⎠  ⎝        ⎣⎣0⎦  ⎣ 1  ⎦⎦⎠⎦
#
# JE; Eigenbasis-Components of JC / ( ml² ):
# ⎡0   0    0 ⎤
# ⎢           ⎥
# ⎢0  150   0 ⎥
# ⎢           ⎥
# ⎣0   0   150⎦
#
# A, so that JK = A JE Aᵀ:
# ⎡3/5  0  -4/5⎤
# ⎢            ⎥
# ⎢ 0   1   0  ⎥
# ⎢            ⎥
# ⎣4/5  0  3/5 ⎦
#
# Checking: JK must be equal to A JE Aᵀ:
# ⎡96    0   -72⎤
# ⎢             ⎥
# ⎢ 0   150   0 ⎥
# ⎢             ⎥
# ⎣-72   0   54 ⎦

```

c7c456077886177816ab23b6069de98b0bb66403
ipynb
Jupyter Notebook
ipynb/HTM_03/Selbst/4.4.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
ipynb/HTM_03/Selbst/4.4.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
ipynb/HTM_03/Selbst/4.4.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
Qwen/Qwen-72B
1. YES
2. YES