算額(その151)
岐阜県大垣市西外側町 大垣八幡神社 天保年間
http://ryugen3.sakura.ne.jp/kadai13/kadai410.htm
第2問: 直角三角形の中に同じ大きさの8小の正方形を入れる。斜辺とそれら正方形に内接する円の直径を求めよ。
正方形の一辺の長さを a,円の半径を r とする。
⊿ABC の斜辺の長さ AC は 5a である。
⊿ABC の面積は 2 通りの方法で求めることができる。
(1) BC*AB/2 = 4a * 3a / 2 = 6a^2
(2) (AB*r + BC*r + CA*r)/2 = (3a + 4a + 5a)r/2 = 6a*r
(1), (2) は等しいので,r について解き 2 倍して直径を得る。
using SymPy
@syms a::positive, r::positive;
solve(6a^2 - 6a*r, r)[1] * 2
2a
すなわち,円の直径は,正方形の一辺の長さの 2 倍である。
using Plots
using Printf
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, linewidth=0.5, seriestype=:shape, linecolor=color, fillcolor=color)
else
plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end
end;
function rect(x1, y1, x2, y2, color=:pink)
plot!([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], color=color, linewidth=0.5, seriestype=:shape, fillcolor=color)
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(a, more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(x, y) = (19a/3, 19a/4)
plot()
circle(2a, 2a, a, :pink, fill=true)
plot!([0, x, 0, 0], [0, 0, y, 0], color=:black, lw=0.5)
for i = 0:a:4a
rect(i, 0, i+a, a, :slategray1)
end
for j = 0:a:3a
rect(0, j, a, j+a, :slategray1)
end
if more == true
point(a, 4a, " A", :black, :left, :bottom)
point(a, a, " B", :black, :left, :bottom)
point(5a, a, " C", :black, :left, :bottom)
vline!([0], color=:black, lw=0.5)
hline!([0], color=:black, lw=0.5)
xticks!(0:5, ["0"; "a"; string.(2:5) .* "a"], tickfontsize=12)
yticks!(0:4, ["0"; "a"; string.(2:4) .* "a"])
else
plot!(showaxis=false)
end
end;