算額(その165)
岐阜県大垣市西外側町 大垣八幡神社 天保年間
http://ryugen3.sakura.ne.jp/toukou3/wasankibousya.PDF
第16問: 黄円内に紫正方形と青円,赤円 4 個ずつを入れる。赤円径を知って黃円径を求めよ。
図のように記号を定め,連立方程式を解く。
using SymPy
@syms r1::positive, r2::positive;
eq1 = (1 - r1 - (1 - r2)/sqrt(Sym(2)))^2 + (1 - r2)^2/2 - (r1 + r2)^2
eq2 = (1 - 2r1) / sqrt(Sym(2)) + 2r2 - 1;
res = solve([eq1, eq2])
res |> println
Dict{Any, Any}[Dict(r1 => -sqrt(2)/2 + sqrt(2)*(-1/4 + sqrt(2)/8 + sqrt(2)*sqrt(19 - 10*sqrt(2))/8) + 1/2, r2 => -1/4 + sqrt(2)/8 + sqrt(2)*sqrt(19 - 10*sqrt(2))/8)]
赤円の半径
res[1][r1] |> simplify |> println
res[1][r1].evalf() |> println
-3*sqrt(2)/4 + sqrt(19 - 10*sqrt(2))/4 + 3/4
0.240353914715992
青円の半径
res[1][r2] |> simplify |> println
res[1][r2].evalf() |> println
-1/4 + sqrt(2)/8 + sqrt(38 - 20*sqrt(2))/8
0.316402492387137
赤円の半径を知って黃円の半径を知るための係数
1 / res[1][r1] |> simplify |> println
(1 / res[1][r1]).evalf() |> println
4/(-3*sqrt(2) + sqrt(19 - 10*sqrt(2)) + 3)
4.16053136135363
赤円の半径を知って青円の半径を知るための係数
res[1][r2] / res[1][r1] |> simplify |> println
(res[1][r2] / res[1][r1]).evalf() |> println
(-1 + sqrt(2)/2 + sqrt(38 - 20*sqrt(2))/2)/(-3*sqrt(2) + sqrt(19 - 10*sqrt(2)) + 3)
1.31640249238714
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(more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
r1 = -3*sqrt(2)/4 + sqrt(19 - 10*sqrt(2))/4 + 3/4
r2 = -1/4 + sqrt(2)/8 + sqrt(38 - 20*sqrt(2))/8
println("r1 = $r1; r2 = $r2")
plot()
circle(0, 0, 1, :yellow, fill=true)
circle(0, 1 - r1, r1, :tomato1, fill=true)
circle(0, r1 - 1, r1, :tomato1, fill=true)
circle(1 - r1, 0, r1, :tomato1, fill=true)
circle(r1 - 1, 0, r1, :tomato1, fill=true)
circle((1 - r2)/√2, (1 - r2)/√2, r2, :steelblue1, fill=true)
circle((1 - r2)/√2, (r2 - 1)/√2, r2, :steelblue1, fill=true)
circle((r2 - 1)/√2, (1 - r2)/√2, r2, :steelblue1, fill=true)
circle((r2 - 1)/√2, (r2 - 1)/√2, r2, :steelblue1, fill=true)
plot!([1-2r1, 0, 2r1-1, 0, 1-2r1], [0, 1-2r1, 0, 2r1-1, 0],
linecolor=:violet, linewidth=0.5, seriestype=:shape, fillcolor=:violet)
if more == true
point(1 - r1, 0, " 1-r1", :black, :left, :bottom)
point((1-r2)/√2, (1-r2)/√2, "((1-r2)/√2,(1-r2)/√2)", :black, :center, :bottom)
hline!([0], color=:black, lw=0.5)
vline!([0], color=:black, lw=0.5)
else
plot!(showaxis=false)
end
end;
draw(false)
r1 = 0.24035391471599188; r2 = 0.31640249238713725