算額(その384)
埼玉県北埼玉郡根古屋 氷川神社
https://gunmawasan.web.fc2.com/kongetu-no-mondai.html
外円の中に甲円 2 個,乙円 6 個を入れる。乙円の直径が 1 寸のとき,甲円の直径はいくらか。
外円の半径と中心座標を r0,(0, 0)
甲円の半径と中心座標を r1, (0, r1)
乙円の半径と中心座標を r2, (x1, 0) および (x2, y2)
とおき,以下の連立方程式を解く。
include("julia-source.txt");
using SymPy
@syms x::positive, y::positive, x1::positive, x2::positive,
y2::positive, r1::positive, r2::positive, r0::positive;
r0 = 2r1
eq1 = x1^2 + r1^2 - (r1 + r2)^2
eq2 = x2^2 + (r1 - y2)^2 - (r1 + r2)^2
eq3 = x2^2 + y2^2 - (r0 - r2)^2
eq4 = (x2 - x1)^2 + y2^2 - 4r2^2
res = solve([eq1, eq2, eq3, eq4], (r1, x1, x2, y2))
1-element Vector{NTuple{4, Sym}}:
(r2*(1 + sqrt(73))/4, 4*sqrt(2)*r2/sqrt(-3 + sqrt(73)), r2*sqrt(-6 + 2*sqrt(73)), r2*(-5/2 + sqrt(73)/2))
r2 = 1 のとき r1 = 2.386; x1 = 2.4025; x2 = 3.32987; y2 = 1.772; r0 = 4.772
甲円の直径は 乙円の直径の (1 + √73)/4 = 2.3860009363293826 倍である。
using Plots
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
r2 = 1
(r1, x1, x2, y2) = (r2*(1 + sqrt(73))/4, 4*sqrt(2)*r2/sqrt(-3 + sqrt(73)), r2*sqrt(-6 + 2*sqrt(73)), r2*(-5/2 + sqrt(73)/2))
r0 = 2r1
@printf("r1 = %g; x1 = %g; x2 = %g; y2 = %g; r0 = %g\n", r1, x1, x2, y2, r0)
plot()
circle(0, 0, r0, :black)
circle(0, r1, r1)
circle(0, -r1, r1)
circle(x1, 0, r2, :blue)
circle(-x1, 0, r2, :blue)
circle4(x2, y2, r2, :blue)
if more
delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) / 3 # size[2] * fontsize * 2
point(0, 2r1, " r0", delta=-delta/2)
point(0, r1, " r1 甲円")
point(x1, 0, " x1\n 乙円", :green, :center, delta=-delta/2)
point(x2, y2, " (x2,y2)\n 乙円", :green, :center, delta=-delta/2)
vline!([0], color=:black, lw=0.5)
hline!([0], color=:black, lw=0.5)
else
plot!(showaxis=false)
end
end;