算額(その807)
藤田貞資:精要算法(下巻),天明元年(1781)
http://www.wasan.jp/seiyou/seiyou.html
二等辺三角形内に隔線を入れ,3 個の等円を入れる。底辺が 120 寸,斜辺が 87 寸のとき,等円の直径はいかほどか。
二等辺三角形の底辺の長さを 2a, 高さを h
3 本の隔線の交点座標を (0, b)
等円の半径と中心座標を r, (0, r), (r, y)
とおき,以下の連立方程式を解く。
include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf
using SymPy
@syms a::positive, b, h::positive, r::positive, y::positive, d
a = 120//2
eq1 = a^2 + h^2 - 87^2
eq2 = dist(0, h, a, 0, r, y) - r^2
eq3 = (b - r)*a/sqrt(a^2 + b^2)- r
eq4 = dist(0, b, a, 0, r, y) - r^2
res = solve([eq1, eq2, eq3, eq4], (r, y, b, h))
2-element Vector{NTuple{4, Sym{PyCall.PyObject}}}:
(12, 33, 25, 63)
(180/7, 513/7, 63, 63)
2 組の解が得られるが,最初のものが適解である。
底辺が 120 寸,斜辺が 87 寸のとき,等円の直径は 24 寸である。
その他のパラメータは以下のとおりである。
r = 12; y = 33; b = 25; h = 63
function draw(more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
a = 120//2
(r, y, b, h) = (12, 33, 25, 63)
@printf("等円の直径 = %.9g\n", 2r)
@printf("r = %g; y = %g; b = %g; h = %g\n", r, y, b, h)
plot([a, 0, -a, a], [0, h, 0, 0], color=:black, lw=0.5)
circle(0, r, r)
circle2(r, y, r)
segment(-a, 0, 0, b, :blue)
segment(a, 0, 0, b, :blue)
segment(0, b, 0, h, :blue)
if more == true
delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3 # size[2] * fontsize * 2
hline!([0], color=:gray80, lw=0.5)
vline!([0], color=:gray80, lw=0.5)
point(r, y, "等円:r\n(r,y)", :red, :center, delta=-delta)
point(0, r, "等円:r\n(0,r)", :red, :center, delta=-delta)
point(a, 0, " a", :blue, :center, :bottom, delta=delta)
point(0, b, " b", :blue, :center, delta=-2delta)
point(0, h, " h", :black, :left, :bottom, delta=delta/2)
end
end;