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?

大人向け。角の二等分線が2つ「数学チャレンジ問題 PH=?(答えが、あの数の2乗になります。)」様を、sympy で計算と作図。

0
Last updated at Posted at 2026-11-13

・ver0.2 Youtubeのコメント様より。私は、わからなくてGemini先生に教えてもらいました。
・>答えが、あの数の2乗になります。
 本ページの最後にリンクあります。

オリジナル

YUUU0123 様 (0:00〜4:38) いつもお世話になっております。
↓数学チャレンジ問題 PH=?(答えが、あの数の2乗になります。)
https://youtu.be/4bgSu71G1IM

いつものsympyで(オリジナル Youtbe様の方法を参考に)

ver0.1

・先生の丸写しです。ステキです。ソースコード内で、図形の証明は省略です。
・補助線4本でした。線分PC,CQ,QP,PTです。

# ver0.1
from sympy import *
var('x',real=True,positive=True)
AB,AC=1,2
x=solve(Eq(x**2,1+x*(x-2)/2+x*(x-1)/2+sqrt(5)*x/2),x)[0]
print("#",x.together())
# (sqrt(5) + 3)/2

ver0.2

・(再)ver0.2 Youtubeのコメント様より。私は、わからなくてGemini先生に教えてもらいました。
・逆三角関数をあきらめて、Triangleにしました。

# ver0.2
from sympy import *
var('x,radABC',real=True,positive=True)
AB,AC=1,2
tr   =Triangle(sas=(AC,90,AB))
theta=tr.angles[tr.vertices[1]]

# Calculate the exact value of cot(atan(2)/2) / (-1 + cot(atan(2)/2)) correctly in SymPy
import sympy as sp

# θ = atan(2) とおく
# theta = sp.atan(2)

# 半角の公式を使って cot(theta/2) を計算
# cot(theta/2) = (1 + cos(theta)) / sin(theta)
cos_t = sp.cos(theta)
sin_t = sp.sin(theta)
cot_half = (1 + cos_t) / sin_t

# 目的の式を構築
expr = cot_half / (-1 + cot_half)

# 簡約化
exact_result = sp.simplify(expr)

print("Exact Value:", exact_result.together())
# Exact Value: (sqrt(5) + 3)/2

sympyで

ver1.1

・

# ver1.1
from sympy import *
# var('r',real=True,positive=True)
AB,AC=1,2
A,B,C=map(Point,[(0,0),(AB,0),(0,AC)])
print("#",Line(A,A+B.unit+C.unit).intersection(Line(B,B+((C-B).unit+Point(1,0))))[0].y.together())
# (sqrt(5) + 3)/2

Gemini先生へ。作図。

PNG図 のみ出力して下さい。各辺の長さを厳密値で追加表示して下さい。
(ver1.1 ソースコード表示省略)

・matplotlib経由です。

image.png

いつもの? sympyの実行環境 と 参考のおすすめです。

sympyのweb上での実行方法

SymPy Live Shellで。
ソースコードの解説は、私よりGemini先生へのソースコードの丸投げがおすすめです。質問の追加はいくらでも。
モーダル対応?「実行して」。「作図して」「問題文章の丸投げ」いい時代です。

(テンプレート)

いつもと違うおすすめです。

sympy のdoc

・いらないカモ。

ver0.1

ver0.2

ver1.1

・together(*args, **kwargs) < 
https://docs.sympy.org/latest/modules/core.html#sympy.core.expr.Expr.trigsimp

Qiita 内で。

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?