算額(その576)
群馬の算額 25-1 木部村鎮守社
http://takasakiwasan.web.fc2.com/gunnsann/g025-1.html
大円と小円が交わっている。大円と小円の直径の和が 21 寸 6 分,大小の矢の和が 3 寸 6 分,共通弦の長さが 8 寸のとき,大円の直径はいかほどか。
大円の半径と中心座標を r1, (0, 0)
小円の半径と中心座標を r2, (0, y2)
大円と小円の交点座標を (x, y)
とおき,以下の連立方程式を解く。
大矢と小矢は (r1 - y), (y - y2 + r2),共通弦の長さは 2x である。
include("julia-source.txt");
using SymPy
@syms r1::positive, r2::positive, y2::positive, x::positive, y::positive
x = 8//2
eq1 = r1 + r2 - 216/20
eq2 = (r1 - y) + (y - (y2 - r2)) - 36/10
eq3 = (r1^2 - y^2) - x^2
eq4 = (r2^2 - (y2 - y)^2) - x^2
res = solve([eq1, eq2, eq3, eq4], (r1, r2, y2, y))
2-element Vector{NTuple{4, Sym}}:
(5.00000000000000, 5.80000000000000, 7.20000000000000, 3.00000000000000)
(5.80000000000000, 5.00000000000000, 7.20000000000000, 4.20000000000000)
r1 > r2 なので,2 番目の解が適解である。
r1 = 5.8; r2 = 5; y2 = 7.2; x = 4; y = 4.2
大円の直径は 11 寸 6 分である。
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
x = 8//2
(r1, r2, y2, y) = res[2]
@printf("大円の直径 = %g; r1 = %g; r2 = %g; y2 = %g; x = %g; y = %g\n", 2r1, r1, r2, y2, x, y)
plot()
circle(0, 0, r1)
circle(0, y2, r2, :blue)
segment(-x, y, x, y, :magenta)
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, 0, "大円:r1,(r1,0) r1 ", :red, :right, :bottom, delta=delta/2)
point(0, y2, " y2\n 小円:r2,(0,y2)", :blue, :left, :vcenter)
point(x, y, " (x,y)", :black, :left, :vcenter)
point(0, y2 - r2, " y2-r2", :blue, :left, :top, delta=-delta/2)
point(0, r1, " r1", :red, :left, :top, delta=-delta/2)
end
end;