算額(その688)
和算問題あれこれ 2 令和5年10月の問題-No.3(『五明算法』34問)
https://gunmawasan.web.fc2.com/k-n-mondai.html
扇面に 6 この円が入っている,甲円,乙円の直径が 1.75 寸,2.25 寸のとき,丁円の直径はいかほどか。
扇の長さ(半径)と中心座標を R, (0, 0)
甲円の半径と中心座標を r1, (0, R - r1)
乙円の半径と中心座標を r2, (x2, y2)
丙円の半径と中心座標を r3, (x3, y3); r3 = r1 + r4
丁円の半径と中心座標を r4, (0, R - 2r1 - r4)
とおき,以下の連立方程式を解く。
include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf
using SymPy
@syms R, r1, r2, x2::positive, y2, r3, x3, y3, r4, x0, y0
(r1, r2) = (175, 225) .// 200
r3 = r1 + r4
eq1 = x2^2 + (R - r1 - y2)^2 - (r1 + r2)^2
eq2 = (x3 - x2)^2 + (y3 - y2)^2 - (r3 + r2)^2
eq3 = x3^2 + (R -2r1 - r4 - y3)^2 - (r3 + r4)^2
eq4 = x3^2 + y3^2 - (R - r3)^2
eq5 = x2^2 + (y2 -R + 2r1 + r4)^2 - (r2 + r4)^2
eq6 = x2^2 + y2^2 - (R - r2)^2
res1 = solve([eq1, eq2, eq3, eq4, eq5, eq6], (R, x2, y2, x3, y3, r4))
1-element Vector{NTuple{6, Sym}}:
(63/8, 9*sqrt(47)/32, 207/32, 189*sqrt(47)/320, 5607/1600, 329/200)
丁円の直径は 329/100 = 3.29 寸である。
その他のパラメータは以下の通りである。
r1 = 0.875; r2 = 1.125; R = 7.875; x2 = 1.92815; y2 = 6.46875; x3 = 4.04912; y3 = 3.50438; r4 = 1.645; x0 = 7.67922; y0 = 1.74504
問の答えはここまででよいが,図を描くために追加の計算をする。
扇の角の座標 (x0, y0) を求める。
@syms R, r1, r2, x2::positive, y2, r3, x3, y3, r4, x0::positive, y0::positive
(r1, r2) = (175, 225) .// 200
(R, x2, y2, x3, y3, r4) = res1[1]
r3 = r1 + r4
eq11 = x0^2 + y0^2 - R^2
eq12 = distance(0, 0, x0, y0, x3, y3) - r3^2
res2 = solve([eq11, eq12], (x0, y0))
2-element Vector{Tuple{Sym, Sym}}:
(-5607/2312 + 14175*sqrt(47)/18496, 945*sqrt(47)/2312 + 84105/18496)
(5607/2312 + 14175*sqrt(47)/18496, 84105/18496 - 945*sqrt(47)/2312)
2 組の解が得られるが,2 番目のものが適解である。
using Plots
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(r1, r2) = (175, 225) .// 200
(R, x2, y2, x3, y3, r4) = (63/8, 9*sqrt(47)/32, 207/32, 189*sqrt(47)/320, 5607/1600, 329/200)
r3 = r1 + r4
(x0, y0) = (5607/2312 + 14175*sqrt(47)/18496, 84105/18496 - 945*sqrt(47)/2312)
θ = atand(y0/x0)
println("丁円の直径 = $(2r4)")
@printf("r1 = %g; r2 = %g; R = %g; x2 = %g; y2 = %g; x3 = %g; y3 = %g; r4 = %g; x0 = %g; y0 = %g\n", r1, r2, R, x2, y2, x3, y3, r4, x0, y0)
plot()
circle(0, 0, R, beginangle=θ, endangle=180-θ, n=1500)
circle(0, 0, R - 2r3, :orange, beginangle=θ, endangle=180-θ, n=1500)
segment(0, 0, x0, y0)
segment(0, 0, -x0, y0)
circle(0, R - r1, r1, :blue)
circle(x2, y2, r2, :magenta)
circle(-x2, y2, r2, :magenta)
circle(x3, y3, r3, :green)
circle(-x3, y3, r3, :green)
circle(0, R - 2r1 - r4, r4, :tomato)
if more
delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3 # size[2] * fontsize * 2
vline!([0], color=:black, lw=0.5)
hline!([0], color=:black, lw=0.5)
point(0, R - r1, " 甲円:r1,(0,R-r1)", :black, :left, :vcenter)
point(x2, y2, " 乙円:r2,(x2,y2)", :black, :left, :vcenter)
point(x3, y3, " 丙円:r3\n (x3,y3)", :green, :left, :vcenter)
point(0, R-2r1-r4, " 丁円:r4\n (0,R-2r1-r4)", :black, :left, :vcenter)
point(0, R, " R", :black, :left, :bottom, delta=delta)
point(0, R - 2r3, " R-2r3", :black, :left, delta=-delta)
point(x0, y0, "(x0,y0) ", :red, :right, :bottom, delta=delta/2)
end
end;