(本日の)ChatGPT先生へ
## 質問リスト(このスレッド)
1. sympy で `Point(r*cos(θ), r*sin(θ))` を
三角関数を使わずに入力して、
`Point(r*cos(θ), r*sin(θ))` を出力したい。
2. rotate はどうですか。
(回答抜粋)
from sympy import symbols, Point, exp, I, re, im, simplify
r, θ = symbols('r θ', real=True)
z = r*exp(I*θ) # ← 三角関数なしの入力
P = Point(
simplify(re(z)),
simplify(im(z))
)
print(P)
from sympy import symbols, Point
r, θ = symbols('r θ', real=True)
P0 = Point(r, 0) # ← 三角関数なし
P = P0.rotate(θ)
print(P)
原点以外を中心に回転したい場合
from sympy import symbols, Point
r, θ = symbols('r θ', real=True)
O = Point(0, 0)
P = Point(r, 0).rotate(θ, O)
print(P)
Gemini先生へ
いつもの? sympyの実行環境と 参考のおすすめです。
いつもと違うおすすめです。
sympy doc
・