算額(その1578)
『算法續淺問答 巻之七』
terasima3.pdf
http://www.wasan.jp/terasima/terasima.html
http://www.wasan.jp/terasima/terasima3.pdf
キーワード:円環,外円
#Julia, #SymPy, #算額, #和算
図のように 8 個の等円が互いに外接し,外円に内接している。外円の直径が 10 寸のとき,等円の直径を求めよ。
外円の半径と中心座標を R, (0, 0)
等円の半径と中心座標を r, (R - r, 0)
等円の個数を n
とおき,以下の方程式を解く。
include("julia-source.txt")
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf
using SymPy
@syms R::positive, r::positive, n::positive
eq = (R - r)*sind(180/n) - r
res = solve(eq, r)[1]
res |> println
R*sin(pi/n)/(sin(pi/n) + 1)
n = 8, R = 10/2 を代入し,得られた半径を 2 倍すれば直径は 2.76768653914155 である。
2*res(n => 8, R => Sym(10)/2) |> println
2*res(n => 8, R => Sym(10)/2).evalf() |> println
10*sqrt(1/2 - sqrt(2)/4)/(sqrt(1/2 - sqrt(2)/4) + 1)
2.76768653914155
function draw(R, n, more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
r = R*sin(pi/n)/(sin(pi/n) + 1)
p = plot()
circle(0, 0, R, :green)
circle(0, 0, R - r, :gray80)
rotate(0, R - r, r, angle=360/n)
if more
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(0, R, "R", :green, :center, :bottom, delta=delta/2)
point(0, R - r, "R-r", :gray, :center, :bottom, delta=delta/2)
end
return p
end;
draw(10, 8, true)