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?

大人用です。1/4円「数学チャレンジ問題 △APDの面積は?」様を、計算はsympyで作図は手抜きのつもりでした。

0
Last updated at Posted at 2026-08-11

・本問題は奥が深いです。

オリジナル

YUUU0123 様 (0:00〜3:21) いつもお世話になっております。
↓数学チャレンジ問題 △APDの面積は?
https://youtu.be/lxgm-ZAvChU

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

ver0.1

・先生の丸写しです。

# ver0.1 
from sympy import *
var('h,a',real=True,positive=True)
print("#",Rational(1,2)*a*solve(Eq(h/4,8/a),h)[0])
# 16

いつもの sympyで

ver1.1

・できませんでした。私のソースコードです。

# ver1.1 
# from sympy import *
# var('xp,yp',real=True,positive=True)
# A,P,D=map(Point,[(0,sqrt(xp**2+yp**2)),(xp,yp),(sqrt(xp**2+yp**2),sqrt(xp**2+yp**2))])
# sol  =solve([Eq(A.distance(P),8),Eq(P.distance(D),5)],[xp,yp])  ;print(sol)
# # rep={xp:sol[0][0],yp:sol[0][1]}
# # print(Triangle(A.subs(rep),P.subs(rep),D.subs(rep)).area)
# # rep={xp:sol[1][0],yp:sol[1][1]}
# # print(Triangle(A.subs(rep),P.subs(rep),D.subs(rep)).area)
# xp=88*sqrt(137)/137,yp= 105*sqrt(137)/137)
# になりませんか。

ver1.2

・面積からヘロンの公式より正方形の辺の長さです。

# # ver1.2 
# from sympy import *
# var('a',real=True,positive=True)
# AP,PD=8,5
# s    =(AP+PD+a)/2
# a_sol=solve( Eq(sqrt(s*(s-8)*(s-5)*(s-a)),16),a)[0]  
# B,A,D=map(Point,[(0,0),(0,a_sol),(a_sol,a_sol)])
# P    =Circle(A,AP).intersection(Circle(D,PD))[0]       ;print(P)
# print(a_sol,B.distance(P))
# # Point2D(88*sqrt(137)/137, 105*sqrt(137)/137)
# # sqrt(137) sqrt(137)

ver1.3

Gemini 先生に教えてもらいました。
 ver1.1がver1.2になるハズだ。です。

# ver1.3
from sympy import *

# シンボルの定義(r = sqrt(xp^2 + yp^2))
var('xp yp r', real=True, positive=True)

# 距離の2乗に関する多項式方程式
eq1 = Eq(xp**2 + (yp - r)**2, 64)       # AP^2 = 8^2
eq2 = Eq((xp - r)**2 + (yp - r)**2, 25) # PD^2 = 5^2
eq3 = Eq(xp**2 + yp**2, r**2)           # r^2 = xp^2 + yp^2

# 3変数(xp, yp, r)の連立方程式として解く
sols = solve([eq1, eq2, eq3], [xp, yp, r], dict=True)

# 正の実数解を抽出
sol = [s for s in sols if s[xp] > 0 and s[yp] > 0][0]

# 座標の代入
A = Point(0, sol[r])
P = Point(sol[xp], sol[yp])
D = Point(sol[r], sol[r])

# 三角形APDの面積を計算
tri = Triangle(A, P, D)
area = simplify(tri.area)

print(f"xp = {sol[xp]}")
print(f"yp = {sol[yp]}")
print(f"r  = {sol[r]}")
print(f"三角形 APD の面積: {area}")
# xp = 88*sqrt(137)/137
# yp = 105*sqrt(137)/137
# r  = sqrt(137)
# 三角形 APD の面積: 16

(続けて)Gemini先生へ

PNG図のみ出力して下さい。
(ソースコードの表示を省略)

image.png

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

sympyのweb上での実行方法

SymPy Live Shellで。FreeCADのマクロは、以下で実行できません。

(テンプレート)

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

sympy のdoc

ver0.1

ver1.3

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?