算額(その115)
和算に挑戦 -平成 24 年度中級解答例-
埼玉県桶川市 氷川天満神社に明治 43 年(1910)に奉納された算額の問 題をもとにしました
https://www.city.ichinoseki.iwate.jp/museum/wasan/h24/images/normal.pdf
新潟県三島郡出雲崎町 滝谷薬師堂 明治2年(1869)4月
http://www.wasan.jp/niigata/izumozakiyakusi.html
一辺の長さが 2尺5寸 の正三角形の中に大円と小円 3 個が内接している。それぞれの径を求めよ。
正三角形の一辺の長さを 25 寸として,以下のように記号を定め方程式を解く。SymPy なしでも解けるが,横着して円の中心から右斜辺への距離に関しての方程式を作る。
using SymPy
function distance(x1, y1, x2, y2, x0, y0)
p1, p2 = sympy.Point(x1, y1), sympy.Point(x2, y2)
l = sympy.Line(p1, p2)
l.distance(sympy.Point(x0, y0))^2 # 二乗距離を返す!!
end;
@syms r1, r2, x;
eq1 = distance(25//2, 0, 0, 25sqrt(Sym(3))/2, 0, r1) - r1^2;
eq2 = distance(25//2, 0, 0, 25sqrt(Sym(3))/2, 0, 2r1 + r2) - r2^2;
eq3 = distance(25//2, 0, 0, 25sqrt(Sym(3))/2, x, r2) - r2^2;
res = solve([eq1, eq2, eq3], (r1, r2, x));
for i = 1:8
(r1, r2, x) = res[i]
if r1 > 0 && r2 > 0 && x < 25/2
println("i = $i")
println("r1 = $r1 = $(r1.evalf())")
println("r2 = $r2 = $(r2.evalf())")
println("x = $x = $(x.evalf())")
end
end
i = 7
r1 = 25*sqrt(3)/6 = 7.21687836487032
r2 = 25*sqrt(3)/18 = 2.40562612162344
x = 25/3 = 8.33333333333333
大円,小円の直径は元の単位では 7.21687836487032 * 2/10 尺,2.40562612162344 * 2/10 尺である。
println("$(7.21687836487032 * 2/10) 尺, $(2.40562612162344 * 2/10) 尺")
1.443375672974064 尺, 0.481125224324688 尺
using Plots
using Printf
function circle(ox, oy, r, color=:red; beginangle=0, endangle=360)
θ = beginangle:0.1:endangle
x = r.*cosd.(θ)
y = r.*sind.(θ)
plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end;
function point(x, y, string="", color=:green, position=:left, vertical=:top; mark=true)
mark && scatter!([x], [y], color=color, markerstrokewidth=0)
annotate!(x, y, text(string, 10, position, color, vertical))
end;
function draw(more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(r1, r2, x) = res[7]
plot([25/2, 0, -25/2, 25/2], [0, 25sqrt(3)/2, 0, 0], color=:black, lw=0.5)
circle(0, r1, r1)
circle(0, 2r1+r2, r2, :blue)
circle(x, r2, r2, :blue)
circle(-x, r2, r2, :blue)
if more == true
@printf("r1 = %.5f, r2 = %.5f, x = %.5f\n", r1, r2, x)
@printf("大円の径 = %.5f 尺, 小円の径 = %.5f 尺\n", 2r1/10, 2r2/10)
point(0, r1, " r1", :red)
point(0, 2r1+r2, "2r1+r2", :blue)
point(x, r2, "(x,r2)", :blue)
hline!([0], color=:black, lw=0.5)
vline!([0], color=:black, lw=0.5)
else
plot!(showaxis=false)
end
end;
r1 = 7.21688, r2 = 2.40563, x = 8.33333
大円の径 = 1.44338 尺, 小円の径 = 0.48113 尺