算額(その578)
群馬の算額 17-5 八幡宮
http://takasakiwasan.web.fc2.com/gunnsann/g017-5.html
直線,垂線と斜線に大円,中円,小円が接している。大円,中円の直径が 5 寸,3 寸のとき,小円の直径を求めよ。
斜線の x 切片,y 切片を x, y とする。
大円の半径と中心座標を r1, (r1, r1)
中円の半径と中心座標を r2, (-r2, r2)
小円の半径と中心座標を r3, (r3, y3)
として,以下の連立方程式を解く。
include("julia-source.txt");
using SymPy
@syms r1::positive, r2::positive, r3::positive, x::positive, y::positive
eq1 = distance(x, 0, 0, y, r1, r1) - r1^2
eq2 = distance(x, 0, 0, y, -r2, r2) - r2^2
eq3 = distance(x, 0, 0, y, r3, r3) - r3^2
res = solve([eq1, eq2, eq3], (r3, x, y))
4-element Vector{Tuple{Sym, Sym, Sym}}:
(r1, -2*r1*r2/(r1 - r2), r1 + r2)
(r1, r1 - r2, 2*r1*r2/(r1 + r2))
(-r2*(r1 + r2)/(r1 - r2), -2*r1*r2/(r1 - r2), r1 + r2)
(r2*(r1 - r2)/(r1 + r2), r1 - r2, 2*r1*r2/(r1 + r2))
4 番目の解が適解である。
小円の直径は r2*(r1 - r2)/(r1 + r2) で,r1 = 5//2, r2 = 3//2 のときは,3/4 = 0.75 = 7 分 5 厘である。
その他のパラメータは以下の通り。
小円の直径 = 0.75; r1 = 2.5; r2 = 1.5; r3 = 0.375; x = 1; y = 1.875
(r1, r2) = (5, 3) .// 2
r2*(r1 - r2)/(r1 + r2)
3//8
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(r1, r2) = (5, 3) .// 2
(r3, x, y) = (r2*(r1 - r2)/(r1 + r2), r1 - r2, 2*r1*r2/(r1 + r2))
@printf("小円の直径 = %g; r1 = %g; r2 = %g; r3 = %g; x = %g; y = %g\n", 2r3, r1, r2, r3, x, y)
plot()
circle(r1, r1, r1)
circle(-r2, r2, r2, :blue)
circle(r3, r3, r3, :magenta)
abline(0, y, -y/x, -5, 5)
plot!(xlims=(-3.5, 5.2), ylims=(-0.5, 5))
if more
delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3 # size[2] * fontsize * 2
hline!([0], color=:black, lw=0.5)
vline!([0], color=:black, lw=0.5)
point(r1, r1, "大円:r1,(r1,r1)", :red, :center, :top, delta=-delta)
point(-r2, r2, "中円:r2,(-r2,r2)", :blue, :center, :top, delta=-delta)
point(r3, r3, " 小円:r3,(r3,r3)", :magenta, :left, :bottom, delta=5delta)
point(x, 0, " x", :black, :left, :bottom, delta=delta/2)
point(0, y, " y", :black, :left, :vcenter)
end
end;
※コメント投稿者のブログIDはブログ作成者のみに通知されます