算額(その428)
長野県諏訪市中洲 諏訪大社上社 明治12年(1897)
中村信弥(1999):算額への招待
http://www.wasan.jp/syotai/syotai.html
外円の中に長方形が内接している。一辺の長さが 41.86 寸の正方形が 6個,大円が 2 個,小円が 4 個入っている。小円の直径を求めよ。
正方形の一辺の長さを a
大円の半径と中心座標を r1, (r0 - r1)
小円の半径と中心座標を r2, (r0 - 2r1 + r2, y)
として,以下の連立方程式を解く。
include("julia-source.txt");
using SymPy
@syms a::positive, r0::positive, r1::positive,
r2::positive, y::positive;
@syms a, r0, r1, r2, y
eq1 = (sqrt(Sym(2))a/2 + a)^2 + (r0 - sqrt(Sym(2))a + a)^2 - r0^2
eq2 = (r0 - 2r1)^2 + (r0 - sqrt(Sym(2))a)^2 - r0^2
eq3 = (r0 - 2r1 + r2)^2 + y^2 - (r0 - r2)^2
eq4 = (r1 - r2)^2 + y^2 - (r1 + r2)^2
res = solve([eq1, eq2, eq3, eq4], (r0, r1, r2, y));
2 組の解が得られるが,2 番目のものが適解である。
names = ["r0", "r1", "r2", "y"]
for (i, name) in enumerate(names)
println("\n", name)
println(simplify(res[2][i]))
println(res[1][i](a => 4186).evalf())
end
r0
a*(5 + 7*sqrt(2))/4
15592.3214511641
r1
(-23922439916777731675282139353831061069516954103552970349841905*a^2 + 16915719487681281681493317896073504500369711065425523483418778*sqrt(2)*a^2 - 6986054008647705185868918429789392*sqrt(5)*sqrt(1144573653449326586061314076037948929840593626875394274 - 809335791921480250432937095033206217367486276799679753*sqrt(2))*sqrt(a^4) + 4939886163250256057660601952272630*sqrt(10)*sqrt(1144573653449326586061314076037948929840593626875394274 - 809335791921480250432937095033206217367486276799679753*sqrt(2))*sqrt(a^4))/(8*a*(4882633868649679478319412976906635182914530485393454527631129 - 3452543518573294933348514588454588356006400466465731641999825*sqrt(2)))
1681.32809749726
r2
a*(205 + 151*sqrt(2))/1168
1500.02961796760
y
-sqrt(-6848627247131292427665721780*sqrt(2)*a^2 + 9685421536530988262785792422*a^2 - 4*sqrt(10)*sqrt(1144573653449326586061314076037948929840593626875394274 - 809335791921480250432937095033206217367486276799679753*sqrt(2))*sqrt(a^4))/(8*sqrt(8442762866313367764895228377 - 5969934874720155329318365400*sqrt(2)))
3176.18761647798
小円の半径は a*(205 + 151*√2)/1168 なので,直径は a*(205 + 151*√2)/584 である。
a = 41.86 を代入すると,小円の直径は 30 寸あまりあり。
41.86*(205 + 151*√2)/584
30.00059235935206
res2 = Float64.([res[2][i](a => 4186).evalf()/100 for i in 1:4])
4-element Vector{Float64}:
155.92321451164108
16.81328097497264
15.00029617967603
31.761876164779796
r0 = 155.923; r1 = 16.8133; r2 = 15.0003; y = 31.7619
小円の直径 = 30.0006
using Plots
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
(r0, r1, r2, y) = res2
@printf("r0 = %g; r1 = %g; r2 = %g; y = %g\n", r0, r1, r2, y)
@printf("小円の直径 = %g\n", 2r2)
a = 41.86
(x0 , y0) = (r0 - 2r1, r0 - √2a)
plot([x0, x0, -x0, -x0, x0], [-y0, y0, y0, -y0, -y0], color=:orange, lw=0.5)
plot!([0, √2a/2, 0, -√2a/2, 0], [r0 - √2a, r0 - √2a + √2a/2, r0, r0 - √2a + √2a/2, r0 - √2a], color=:red, lw=0.5)
rect(√2a/2, r0 - √2a, √2a/2 + a, r0 - √2a + a, :red)
rect(-√2a/2, r0 - √2a, -√2a/2 - a, r0 - √2a + a, :red)
plot!([0, √2a/2, 0, -√2a/2, 0], -[r0 - √2a, r0 - √2a + √2a/2, r0, r0 - √2a + √2a/2, r0 - √2a], color=:red, lw=0.5)
rect(√2a/2, -r0 + √2a, √2a/2 + a, -r0 + √2a - a, :red)
rect(-√2a/2, -r0 + √2a, -√2a/2 - a, -r0 + √2a - a, :red)
circle(0, 0, r0, :black)
circle(r0 - r1, 0, r1, :blue)
circle(-r0 + r1, 0, r1, :blue)
circle4(r0 - 2r1 + r2, y, r2, :green)
if more
delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) / 3 # size[2] * fontsize * 2
point(r0, 0, " r0", :black, :left, :bottom, delta=delta)
point(r0 - r1, 0, "r0-r1", :blue, :center, delta=-delta/2)
point(r0 - 2r1 + r2, y, "(r0-2r1+r2,y) ", :green, :right, :vcenter)
point(0, r0 - √2a, "r0-√2a ", :orange, :right, :top, delta=-delta/2)
point(a/√2, r0-√2a, "(a/√2,r0-√2a)", :red, :center, delta=-3delta)
point(a/√2 + a, r0-√2a, "(a/√2+a,r0-√2a)", :red, :center, delta=-delta/2)
point(a/√2 + a, r0 - √2a + a, "(a/√2+a,r0-√2a+a)", :red, :left, :bottom)
vline!([0], color=:black, lw=0.5)
hline!([0], color=:black, lw=0.5)
else
plot!(showaxis=false)
end
end;