算額(その42)
山形県鶴岡市羽黒町 出羽三山神社 文政6年
http://www.wasan.jp/yamagata/haguro.html
外円内に大円 3 個と小円 4 個が収まっている。それぞれの径を求めよ。
下図のように記号を定め,方程式を解く。
using SymPy
@syms r1::real, r2::real, x1::positive, y1::negative, x2::positive, y2::negative;
x1 = (1 - r1)sqrt(Sym(3))/2
y1 = (r1 - 1)/2
x2 = (r2 - r1)sqrt(Sym(3))/2
y2 = (r1 - r2)/2
eq1 = x1^2 + (1 - r2 - y1)^2 - (r1 + r2)^2
eq2 = x2^2 + (1 - r1 - y2)^2 - (r1 + r2)^2
res = solve([eq1, eq2], (r1, r2))
3-element Vector{Tuple{Sym, Sym}}:
(1, 0)
(-2*sqrt(7)/3 - 2*(-2 + sqrt(7))^2/3 + 7/3, -2 + sqrt(7))
(-2*(-sqrt(7) - 2)^2/3 + 2*sqrt(7)/3 + 7/3, -sqrt(7) - 2)
2 番目の解が適。
(-2*sqrt(7)/3 - 2*(-2 + sqrt(7))^2/3 + 7/3, -2 + sqrt(7))
簡約化すると
(2*sqrt(7) - 5, sqrt(7) - 2)
(0.291502622129181, 0.6457513110645907)
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; mark=true)
mark && 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, r2) = (2*sqrt(7) - 5, sqrt(7) - 2)
x1 = (1 - r1)sqrt(3)/2
y1 = (r1 - 1)/2
println("r1 = $r1; r2 = $r2; x1 = $x1; y1 = $y1")
plot()
circle(0, 0, 1, :black)
circle(0, 0, r1, :blue)
circle(0, 1-r1, r1, :blue)
circle((1-r1)sqrt(3)/2, -(1-r1)/2, r1, :blue)
circle(-(1-r1)sqrt(3)/2, -(1-r1)/2, r1, :blue)
x2 = (r2 - r1)sqrt(Sym(3))/2
y2 = (r1 - r2)/2
circle(x2, y2, r2, :magenta)
circle(-x2, y2, r2, :magenta)
circle(0, 1-r2, r2, :magenta)
if more
point(0, 1-r1, "1-r1 ", :blue)
point(0, 1-r2, "1-r2 ", :magenta)
point((1-r2)sqrt(3)/2, -(1-r2)/2, " (x2,y2)", :magenta)
point(x1, y1, "(x1,y1)", :blue, :center)
point(0, 0, "0 ", :magenta)
vline!([0], color=:black, linewidth=0.25)
hline!([0], color=:black, linewidth=0.25)
end
end;
※コメント投稿者のブログIDはブログ作成者のみに通知されます