算額(その1628)
~落書き帳「○△□」~ 923. 『算法天生法指南』巻之二(その1)
http://streetwasan.web.fc2.com/math20.04.22.2.html
キーワード:円3個,直線上,高さ
#Julia, #Julia, #SymPy, #算額, #和算, #数学
直線上に甲円,乙円,その上に丙円が載っている。甲円,乙円の直径が 18 寸,15 寸,高さが 30 寸のとき,丙円の直径はいかほどか。
甲円の半径と中心座標を r1, (x1, r1)
乙円の半径と中心座標を r2, (0, r2)
丙円の半径と中心座標を r3, (x3, y3)
高さを h; h = y3 + r3
とおき,以下の連立方程式を解く。
include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf
using SymPy
@syms r1::positive, x1::positive, r2::positive,
r3::positive, x3::positive, y3::positive,
h::positive
y3 = h - r3
eq1 = (x1 - x3)^2 + (y3 - r1)^2 - (r1 + r3)^2
eq2 = x1^2 + (r1 - r2)^2 - (r1 + r2)^2
eq3 = x3^2 + (y3 - r2)^2 - (r2 + r3)^2;
res = solve([eq1, eq2, eq3], (x1, r3, x3))[1]
(2*sqrt(r1)*sqrt(r2), (-h*r1 - h*r2 + 2*r1*r2)^2/(8*h*r1*r2), (-h*r1 + h*r2 + 2*r1*r2)/(2*sqrt(r1)*sqrt(r2)))
res[2] |> simplify |> println
(h*r1 + h*r2 - 2*r1*r2)^2/(8*h*r1*r2)
丙円の半径は (h*(r1 + r2) - 2r1*r2)^2/(8h*r1*r2) である。
甲円,乙円の直径が 18 寸,15 寸,高さが 30 寸のとき,丙円の直径は 16 寸である。
r1 = 18/2; r2=15/2; h=30
2(h*(r1 + r2) - 2r1*r2)^2/(8h*r1*r2)
16.0
function draw(r1, r2, h, more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(x1, r3, x3) = (2*sqrt(r1)*sqrt(r2), (-h*r1 - h*r2 + 2*r1*r2)^2/(8*h*r1*r2), (-h*r1 + h*r2 + 2*r1*r2)/(2*sqrt(r1)*sqrt(r2)))
y3 = h - r3
plot()
circle(x1, r1, r1)
circle(0, r2, r2, :blue)
circle(x3, y3, r3, :green)
segment(-r2, 0, x1 + r1, 0, lw=1)
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(x1, r1, "甲円:r1,(x1,r1)", :red, :center, delta=-delta/2)
point(0, r2, "乙円:r2,(0,r2)", :blue, :center, delta=-delta/2)
point(x3, y3, "丙円:r3,(x3,y3)", :green, :center, delta=-delta/2)
point(x3, h, "高", :green, :center, :bottom, delta=delta/2)
end
end;
draw(18/2, 15/2, 30, true)