LoginSignup
0
0

More than 5 years have passed since last update.

sympyで「行列の回転(Rotation matrix)逆回転」をやってみた//simplifyがmatrixでもできた

Last updated at Posted at 2018-07-20

(参考)回転行列
https://ja.wikipedia.org/wiki/%E5%9B%9E%E8%BB%A2%E8%A1%8C%E5%88%97
(参考)【python】sympyのsympifyとsimplifyの違いについて ?simplify
https://piruty.hatenablog.com/entry/%3Fp%3D117

fullscript.py
from sympy import *
var("t")
var("A B C")
A=Matrix(([cos( t),-sin( t)], [sin( t),cos( t)]))
B=Matrix(([cos(-t),-sin(-t)], [sin(-t),cos(-t)]))
C=A*B
print(C)
print(type(C))
print(simplify(C))
# Matrix([[sin(t)**2 + cos(t)**2, 0], [0, sin(t)**2 + cos(t)**2]])
# <class 'sympy.matrices.dense.MutableDenseMatrix'>
# Matrix([[1, 0], [0, 1]])
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0