問題文
1辺の長さが $1$ の正六角形 $\mathrm{ABCDEF}$ が与えられている。点 $\mathrm{P}$ が辺 $\mathrm{AB}$ 上を、点 $\mathrm{Q}$ が辺 $\mathrm{CD}$ 上をそれぞれ独立に動くとき、線分 $\mathrm{PQ}$ を $2:1$ に内分する点 $\mathrm{R}$ が通りうる範囲の面積を求めよ。(2017 東京大学 文系第2問)
$$\frac{\sqrt{3}}{9}$$
※ この答えは学校側が公表したものではありません。個人が作成した非公式の答えです。
コード
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as ani
#紙の準備
left = -1.1
right = 1.1
bottom = -1.2
top = 1.0
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title("2017東大数学 文系第2問",pad=15)
ax.set_xlim(left,right)
ax.set_ylim(bottom,top)
ax.set_aspect("equal")
ax.axis("off")
#正六角形の描画
hex_x = [np.cos(k*np.pi/3) for k in range(9)]
hex_y = [np.sin(k*np.pi/3) for k in range(9)]
ax.plot(hex_x,hex_y,color="0.8")
for i in range(3):
ax.plot([hex_x[i],hex_x[i+3]],[hex_y[i],hex_y[i+3]],
color="0.8",linewidth=0.8)
for i in range(6):
ax.plot([2/3*hex_x[i]+1/3*hex_x[i+1],2/3*hex_x[i+3]+1/3*hex_x[i+2]],
[2/3*hex_y[i]+1/3*hex_y[i+1],2/3*hex_y[i+3]+1/3*hex_y[i+2]],
color="0.8",linewidth=0.8)
ax.plot([1/3*hex_x[i]+2/3*hex_x[i+1],1/3*hex_x[i+3]+2/3*hex_x[i+2]],
[1/3*hex_y[i]+2/3*hex_y[i+1],1/3*hex_y[i+3]+2/3*hex_y[i+2]],
color="0.8",linewidth=0.8)
#定点の準備
a = np.array([-1,0])
b = np.array([-1/2,np.sqrt(3)/2])
c = np.array([ 1/2,np.sqrt(3)/2])
d = np.array([ 1,0])
#動く点の準備
PQ, = ax.plot([],color="steelblue",marker="o",zorder=10)
R, = ax.plot([],color="royalblue",marker="o",zorder=10)
#解説パート
attach1 = ax.text(0.0,-0.5,"1辺が $\\dfrac{1}{3}$ の正三角形",
alpha=0,ha="right")
attach2,= ax.plot([1/6,0,1/3,1/6],
np.sqrt(3)*np.array([-1/6,-1/3,-1/3,-1/6]),
alpha=0,color="coral",zorder=10,linewidth=4)
attach3 = ax.text(1/3,-0.5,"の面積は",
alpha=0)
attach4 = ax.text(0.0,-0.8,"$\\dfrac{1}{2}\\times\\dfrac{1}{3}\\times\\dfrac{1}{3}\\times\\sin60\\degree=\\dfrac{\\sqrt{3}}{36}$",
alpha=0,ha="center")
attach5,= ax.plot([0,1/6,1/3,0,1/6,1/3,1/2,1/6,1/3,1/2],
np.sqrt(3)*np.array([1/3,1/2,1/3,1/3,1/6,1/3,1/6,1/6,0,1/6]),
alpha=0,color="coral",zorder=10,linewidth=4)
attach6 = ax.text(0.0,-1.1,"それが4枚あるので、",
alpha=0,ha="right")
attach7 = ax.text(0.0,-1.1,"$\\dfrac{\\sqrt{3}}{36}\\times4$",
alpha=0)
attach8 = ax.text(0.3,-1.1,"$=\\dfrac{\\sqrt{3}}{9}$",
alpha=0)
attach9 = ax.text(0.6,-1.1,"$\\cdots$(答)",
alpha=0)
#PとQとRを動かして塗りつぶすための関数
def show_R(p,q):
PQ.set_data([p[0],q[0]],[p[1],q[1]])
r = 1/3*p+2/3*q
R.set_data(r[0],r[1])
ax.plot(r[0],r[1],color="skyblue",marker=".")
#解説を表示するための関数
def show_obj(i,attach):
alpha = min(i/50,1)
attach.set_alpha(alpha)
if hasattr(attach,"set_bbox"):
attach.set_bbox(dict(fc="white",pad=0,linewidth=0,alpha=alpha))
#動画の台本
def update(t):
if t<100:
i = t
k = i/100
p = k*a+(1-k)*b
q = c
show_R(p,q)
elif t<200:
i = t-100
k = i/100
p = a
q = (1-k)*c+k*d
show_R(p,q)
elif t<300:
i = t-200
k = i/100
p = (1-k)*a+k*b
q = d
show_R(p,q)
elif t<400:
i = t-300
k = i/100
p = b
q = k*c+(1-k)*d
show_R(p,q)
elif t<1000:
i = t-400
k = i/600
kp= np.sin(31*k*np.pi/2)**2
kq= k
p = kp*a+(1-kp)*b
q = (1-kq)*c+kq*d
show_R(p,q)
elif t<1060:
i = t-1000
alpha = max((50-i)/50,0)
PQ.set_alpha(alpha)
R .set_alpha(alpha)
elif t<1120:
i = t-1060
show_obj(i,attach1)
elif t<1180:
i = t-1120
show_obj(i,attach2)
elif t<1240:
i = t-1180
show_obj(i,attach3)
elif t<1300:
i = t-1240
show_obj(i,attach4)
elif t<1360:
i = t-1300
show_obj(i,attach5)
elif t<1420:
i = t-1360
show_obj(i,attach6)
elif t<1480:
i = t-1420
show_obj(i,attach7)
elif t<1540:
i = t-1480
show_obj(i,attach8)
elif t<1600:
i = t-1540
show_obj(i,attach9)
mov = ani.FuncAnimation(fig,update,1800,interval=50)
plt.show()