算額(その169)
岐阜県大垣市西外側町 大垣八幡神社 天保年間
http://ryugen3.sakura.ne.jp/toukou3/wasankibousya.PDF
第28問: 互いに中心を通る 2 等円(黃)に 3 個の等円(青)を入れ,更に赤円 2 個,黒円 4 個を入れる。青円径を知って黒円径を求めよ。
算額(その85)を一段階複雑にしたものである。
青円,赤円,黒円の半径を r1, r2, r3,黒円の中心座標を (x3, y3) とする。黃円の半径は 2r1 である。未知数 5 個に対して方程式は 4 本なので,r2, r3, x3, y3 が r1 を含む解が求まる。
using SymPy
@syms r1::positive, r2::positive, r3::positive, x3::positive, y3::positive;
eq1 = x3^2 + y3^2 - (r1 + r3)^2 # 青円と黒円が外接
eq2 = x3^2 + (r1 + r2 - y3)^2 - (r2 + r3)^2 # 赤円と黒円が外接
eq3 = r1^2 + (r1 + r2)^2 - (2r1 - r2)^2 # 赤円が黃円に内接
eq4 = (r1 + x3)^2 + y3^2 - (2r1 - r3)^2 # 黒円が黃円に内接
res = solve([eq1, eq2, eq3, eq4], (r2, r3, x3, y3))
1-element Vector{NTuple{4, Sym}}:
(r1/3, 2*r1/11, 5*r1/11, 12*r1/11)
黒円の半径は青円の半径の 2/11 である。
赤円の半径は青円の半径の 1/3 である。
黒円の中心座標は青円の半径の (5/11, 12/11) である。
using Plots
function circle(ox, oy, r, color=:red; beginangle=0, endangle=360, fill=false)
θ = beginangle:0.1:endangle
x = r.*cosd.(θ)
y = r.*sind.(θ)
if fill
plot!(ox .+ x, oy .+ y, linecolor=color, linewidth=0.5, seriestype=:shape, fillcolor=color)
else
plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end
end;
function point(x, y, string="", color=:green, position=:left, vertical=:top; mark=true)
mark && scatter!([x], [y], color=color, markerstrokewidth=0)
annotate!(x, y, text(string, 10, position, color, vertical))
end;
function draw(R, more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
r1 = 1 # 青円の半径を 1 として図を描く
(r2, r3, x3, y3) = (r1/3, 2*r1/11, 5*r1/11, 12*r1/11)
plot()
circle(r1, 0, 2r1, :yellow1, fill=true)
circle(-r1, 0, 2r1, :yellow1, fill=true)
circle(r1, 0, 2r1, :snow4)
circle(-r1, 0, 2r1, :snow4)
circle(0, 0, r1, :steelblue1, fill=true)
circle(2r1, 0, r1, :steelblue1, fill=true)
circle(-2r1, 0, r1, :steelblue1, fill=true)
circle(0, r1 + r2, r2, :indianred1, fill=true)
circle(0, -r1 - r2, r2, :indianred1, fill=true)
circle(x3, y3, r3, :snow4, fill=true)
circle(-x3, y3, r3, :snow4, fill=true)
circle(x3, -y3, r3, :snow4, fill=true)
circle(-x3, -y3, r3, :snow4, fill=true)
if more == true
point(0, r1, " r1", :black)
point(0, r1+r2, " r1+r2", :black, :left, :bottom)
point(x3, y3, "(x3,y3,r3)", :black, :left, :bottom)
hline!([0], color=:black, lw=0.5)
vline!([0], color=:black, lw=0.5)
else
plot!(showaxis=false)
end
end;