0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sympy「Point(r*cos(θ), r*sin(θ)) を 三角関数を使わずに入力して、Point(r*cos(θ), r*sin(θ))を出力したい。」をAI先生に聞きました。

0
Last updated at Posted at 2026-02-06

(本日の)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

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?