算額(その17)
円の内部に大きい円が 6 個,小さい円が 3 個ある。それぞれの円の半径を求めよ。
千葉県木更津市 高柳不動
http://www.wasan.jp/chiba/takayanagi.html
右上の大きな円の半径と中心座標を r2, (r2, y2) とする。
一番上の小さな円の半径と中心座標を r1, (0, y1) とする。
using SymPy
@syms r1::positive, y1::positive, r2::positive, y2::positive;
r2, y2 は方程式を立てなくてもわかるが一応形式的に。
eq1 = y2 - (1 - r2)*sind(Sym(60));
eq2 = r2 - (1 - r2)*cosd(Sym(60));
先の円と接する小さな塩の関係から以下の式を得る。
eq3 = (y2 - y1)^2 + r2^2 - (r1 + r2)^2;
一番上にある小さな円の半径を 1,中心座標を (0, y1) とすると,
eq4 = y1 * sind(Sym(60)) - r1;
方程式を解き,解を求める。
res = solve([eq1, eq2, eq3, eq4], (r1, y1, r2, y2))
2-element Vector{NTuple{4, Sym}}:
(3 - 2*sqrt(2), -4*sqrt(6)/3 + 2*sqrt(3), 1/3, sqrt(3)/3)
(2*sqrt(2) + 3, 4*sqrt(6)/3 + 2*sqrt(3), 1/3, sqrt(3)/3)
r1 = 2*sqrt(2) + 3 は外円より大きいので不適切解である。
回答:
大きな円の半径 1/3
小さな円の半径 3 - 2√2
using Plots
function circle(ox, oy, r, color=:red; beginangle=0, endangle=360)
θ = beginangle:0.1:endangle
x = r.*cosd.(θ)
y = r.*sind.(θ)
plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end;
function point(x, y, string="", color=:green, position=:left, vertical=:top)
scatter!([x], [y], color=color, markerstrokewidth=0)
annotate!(x, y, text(string, 10, position, color, vertical))
end;
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(r1, y1, r2, y2) = (3 - 2*sqrt(2), -4*sqrt(6)/3 + 2*sqrt(3), 1/3, sqrt(3)/3)
println("r1 = $r1, y1 = $y1, r2 = $r2, y2 = $y2")
plot()
circle(0, 0, 1)
circle(r2, y2, r2, :blue)
circle(-r2, y2, r2, :blue)
circle(r2, -y2, r2, :blue)
circle(-r2, -y2, r2, :blue)
circle(1-r2, 0, r2, :blue)
circle(r2-1, 0, r2, :blue)
circle(0, y1, r1, :magenta)
circle(r1, y1 - 2r1*sind(60), r1, :magenta)
circle(-r1, y1 - 2r1*sind(60), r1, :magenta)
if more
point(r2, y2, " (r2,y2)", :blue)
plot!([0, r2], [y2, y2])
point(0, y2, "y2 ", :magenta, :right)
point(0, y1, "y1 ", :magenta, :right)
point(r1, 0, " r1", :magenta, :left, :top)
plot!([0, r1], [y1 - 2r1*sind(60), y1 - 2r1*sind(60)])
hline!([0])
vline!([0])
end
end;