算額(その666)
長野市元善町 善光寺 寛政8年(1796)
中村信弥「改訂増補 長野県の算額」(p.52)
http://www.wasan.jp/zoho/zoho.html
三角形の中に全,大,中,小の正方形が入っている。底辺の長さが 48 寸,中正方形,小正方形の一辺の長さがそれぞれ,6寸,3寸のとき,大正方形の一辺の長さはいかほどか。
図のように記号を定め,相似比,正方形の一辺の長さについての連立方程式を解く。
include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf
using SymPy
@syms x1::positive, x2::positive, x3::positive, x4::positive, x5::positive, x6::positive,
y1::positive, y2::positive, y3::positive, y4::positive,
a::positive, b::positive, h::positive
a = 48
y1 = 6
eq1 = y1/x1 - h/b
eq2 = (y2 - y1)/(x2 - x1) - h/b
eq3 = (y3 - y2)/(x3 - x2) - h/b
eq4 = (h - y3)/(b - x3) - h/b # 従属
eq5 = (h - y3)/(x4 - b) - h/(a - b)
eq6 = (y3 - y2)/(x5 - x4) - h/(a - b)
eq7 = (y2 - y4)/(x6 - x5) - h/(a - b)
eq8 = y4/(a - x6) - h/(a - b) # 従属
eq9 = x2 - x1 - 6
eq10 = x5 - x2 - y2
eq11 = x6 - x5 - y4
eq12 = x4 - x3 - 3
eq13 = y3 - y2 - 3
res = solve([eq1, eq2, eq3, eq5, eq6, eq7, eq9, eq10, eq11, eq12, eq13],
(x1, x2, x3, x4, x5, x6, y2, y3, y4, b, h))
1-element Vector{NTuple{11, Sym}}:
(6, 12, 15, 18, 24, 32, 12, 15, 8, 16, 16)
x1 = 6; x2 = 12; x3 = 15; x4 = 18; x5 = 24; x6 = 32
y1 = 6; y2 = 12; y3 = 15; y4 = 8; a = 48; b = 16; h = 16
大正方形の一辺の長さ =x6-x5 = y4 = 8 である。
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
a = 48
y1 = 6
(x1, x2, x3, x4, x5, x6, y2, y3, y4, b, h) = (6, 12, 15, 18, 24, 32, 12, 15, 8, 16, 16)
@printf("x1 = %g; x2 = %g; x3 = %g; x4 = %g; x5 = %g; x6 = %g\n",
x1, x2, x3, x4, x5, x6)
@printf("y1 = %g; y2 = %g; y3 = %g; y4 = %g; a = %g; b = %g; h = %g\n",
y1, y2, y3, y4, a, b, h)
@printf("大正方形の一辺の長さ(x6-x5 = y4) = %g\n", y4)
plot([0, a, b, 0], [0, 0, h, 0], color=:black, lw=0.5)
rect(x1, 0, x2, y1, :blue)
rect(x2, 0, x5, y2, :blue)
rect(x3, y2, x4, y3, :blue)
rect(x5, 0, x6, y4, :blue)
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)
vline!([x1, x2, x3, x4, x5, x6, b], color=:gray20, lw=0.1)
hline!([y1, y2, y3, y4], color=:gray20, lw=0.1)
point.([x1, x2, x3, x4, x5, x6, b], 0,
["x1", "x2", "x3", "x4", "x5", "x6", "b"],
:blue, :center, delta=-2delta)
point.(0, [y1, y2, y3, y4],
["y1 ", "y2 ", "y3 ", "y4 "],
:blue, :right, :vcenter)
point((x2 + x5)/2, y2/2, "全", :red, :center, :vcenter, mark=false)
point((x5 + x6)/2, y4/2, "大", :red, :center, :vcenter, mark=false)
point((x1 + x2)/2, y1/2, "中", :red, :center, :vcenter, mark=false)
point((x3 + x4)/2, (y2 + y3)/2, "小", :red, :center, :vcenter, mark=false)
point(a, 0, "a", :black, delta=-2delta)
point(b, h, "(b,h)", :black, :center, :bottom, delta=2delta)
plot!(xlims=(-3, 50), ylims=(-3, 19))
end
end;
※コメント投稿者のブログIDはブログ作成者のみに通知されます