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?

大人用です。中学受験1997年甲陽学院中「【大人も解けない図形】小学生が解く問題で実力を試そう...」様を、計算はsympyで作図は手抜きのつもりでした。

0
Last updated at Posted at 2026-08-13

小学生解けるんです。...

・長文です。ver3.1 がおすすめカモ。大人げないです。

オリジナル

まなびスクエア 様 (0:00〜16:38) はじめまして。よろしくお願いします。
↓【大人も解けない図形】小学生が解く問題で実力を試そう【中学受験の算数】
https://youtu.be/sjeds-lwfcc

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

ver0.1

・先生の丸写しです。図形の証明を省略です。私はまだわかっていません。

# ver0.1 
from sympy import *
var('m1,m2',real=True,positive=True)
m1=solve(Eq(2.5*m1,8.5),m1)[0] # ;print(m1) 
m2=m1*2                        # ;print(m2)
print("#",m2*m2)
# 46.2400000000000

ver0.2

・以下は大人の? sympy事情です。

# ver0.2 
from sympy import *
BC=17
var('m1,m2',real=True,positive=True)
m1=solve(Eq(Rational(5,2)*m1,BC*Rational(1,2)),m1)[0] # ;print(m1) 
m2=m1*2                                               # ;print(m2)
print("#",        (m2*m2)          )
print("#",        (m2*m2).evalf()  )
print("#",   float((m2*m2).evalf()))
print("#",f"{float (m2*m2):g}"     ) 
print("#",f"{float (m2*m2):.2f}"   ) 
# 1156/25
# 46.2400000000000
# 46.24
# 46.24
# 46.24

いつもの sympyで

ver1.1

・大人は補助線が多いと無理カモ。大人は普通にズルします。
・Bを原点。GEの中点:正方形の中心座標(s,s)

# ver1.1 
from sympy import *
var('s',real=True,positive=True)
BC=17
A,B,C=map(Point,[(BC/2,BC),(0,0),(BC,0)])
S    =Point(s,s)                                   # 傾き45°を使っています。
P    =Line(Line(B,S).perpendicular_line(S)).intersection(Line(B,A))[0]  #;print(P)
Q    =Line(Line(B,S).perpendicular_line(S)).intersection(Line(C,A))[0]  #;print(Q)
rep  ={s:solve(Eq(S.x-P.x,Q.x-S.x),s)[0]}                               #;print(rep)
print("#",       (Q.x.subs(rep)-P.x.subs(rep))**2)
print("#",float(((Q.x.subs(rep)-P.x.subs(rep))**2).evalf()))
# 1156/25
# 46.24

ver1.2

・大人は連立方程式です。中点と内積0です。(普通は垂線の足かも)

# ver1.2
from sympy import *
var('s,t',real=True,positive=True)
BC=17
A,B,C=map(Point,[(BC/2,BC),(0,0),(BC,0)])
P    =B+s*(A-B).unit
Q    =C+t*(A-C).unit
M    =P.midpoint(Q)
sol  =solve([Eq(M.x,M.y),Eq((B-M).dot(P-Q),0)],[s,t])  # 傾き45°を使っています。
rep  ={s:sol[0][0],t:sol[0][1]}
print("#",       (Q.x.subs(rep)-P.x.subs(rep))**2          )
print("#",float(((Q.x.subs(rep)-P.x.subs(rep))**2).evalf()))
# 1156/25
# 46.24

ver2.1

・ソルバー風。まず、AIの正方形(辺の長さ8.5cm) を1個書いてみる。 
 >このような正方形を見えたか? >正方形を作れるんじゃないの?

# ver2.1
from sympy import *
BC=17
A,B,C  =map(Point,[(BC/2,BC),(0,0),(BC,0)])
I      =Point(BC,BC)
C_mid_I=C.midpoint(I)                               #;print(C_mid_I)
F      =Line(C,A).intersection(Line(B,C_mid_I))[0]  #;print(F)
E      =Point(F.y,F.y)
print("#",(F.x-E.x)**2)
# 1156/25

ver2.2

・上と同じ。グラフで交点計算です。
・Rational(1,2)は、1/2の意味です。分数のまま計算です。0.5にしたくない。

# ver2.2
from sympy import *
var('x,y',real=True,positive=True)
sol=solve([Eq(y,Rational(1,2)*x),Eq(y,-2*x+34)],[x,y])  
print("#",       (sol[x]-sol[y])**2)
print("#",float(((sol[x]-sol[y])**2).evalf()))
# 1156/25
# 46.24

ver3.1

・CAD風なら簡単。p.reflect(Line) がありました。正方形を意識しない?

# ver3.1
from sympy import *
BC=17
A,B,C=map(Point,[(BC/2,BC),(0,0),(BC,0)])
A_ref=A.reflect(Line(B,Point(1,1)))              #;print(A_ref)
F    =Line(B,A_ref).intersection(Line(A,C))[0]   #;print(F)
print("#",(F.x-F.y)**2)
print("#",float(((F.x-F.y)**2).evalf()))
# 1156/25
# 46.24

ver3.2

・上と同じ。

# ver3.2
from sympy import *
BC=17
A,B,C=map(Point,[(BC/2,BC),(0,0),(BC,0)])
F    =Line(B,A.reflect(Line(B,Point(1,1)))).intersection(Line(A,C))[0]
print("#",(F.x-F.y)**2)
print("#",float(((F.x-F.y)**2).evalf()))
# 1156/25
# 46.24

(続けて)作図

・Gemini先生でできませんでした。ChatGPT先生にSVG図→PNG図にしてもらいました。

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

image.png

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

sympyのweb上での実行方法

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

(テンプレート)

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

sympy のdoc

ver0.1

ver0.2

ver1.1

ver1.2

ver2.1

ver2.2

ver3.1

・reflect(line) < Entities
https://docs.sympy.org/latest/modules/geometry/entities.html#sympy.geometry.entity.GeometryEntity.reflect

ver3.2

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?