和算図形問題あれこれ
令和4年9月の問題-No.1
https://gunmawasan.web.fc2.com/kongetu-no-mondai.html
キーワード:四辺形,正方形,斜線
#Julia #SymPy #算額 #和算 #数学
左右対称の四角形の中に,正方形と 2 斜線がある。赤,黃,黒の面積が 12 平方寸, 24 平方寸,16 平方寸のとき,正方形の一辺の長さはいかほどか。

頂点などの座標を図のように定義する。直線の上にある(ように見える)点はまさに直線上にある(傾きの同じ直線上にある)という 4 条件と,赤,黃,黒の面積の 3 条件についての連立方程式を解く。
SymPy での計算は分数式で行われるので,誤差が含まれるおそれはない。
include("julia-source.txt"); # julia-source.txt ソース
using SymPy
@syms a::positive, b::positive, c::positive,
d::positive, e::positive,
x::positive, y::positive
R::positive, Y::positive, K::positive
(R, Y, K) = (12, 24, 16)
eq1 = (y - c)/x - ( (d + 2a) - c)/a
eq2 = (y - b)/x - (y - e)/(x - a)
eq3 = (y - e)/(x - a) - (y - (d + 2a))/(x + a)
eq4 = y/x - (y - d)/(x - a)
eq5 = ( (d + 2a) - e)a - R
eq6 = (e - d) * (x - a) - Y
eq7 = (c - (d + 2a))a - K;
res = solve([eq1, eq2, eq3, eq4, eq5, eq6, eq7])[1]
Dict(x => 44/5, y => 88/15, b => 55/6, d => 8/3, e => 23/3, c => 44/3, a => 4)
\(a = 4\) になるので,正方形の一辺の長さは \(2a = 8\) である。
その他のパラメータは以下の通り。
\(a = 4//1;\ b = 55//6;\ c = 44//3;\ d = 8//3;\ e = 23//3;\ x = 44//5;\ y = 44//5\)
描画関数プログラムのソースを見る
function draw(more=false)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
x = 44//5; y = 88//15; b = 55//6; d = 8//3; e = 23//3; c = 44//3; a = 4//1
@printf("a = %.15g; b = %.15g; c = %.15g; d = %.15g; e = %.15g; x = %.15g; y = %.15g\n", a, b, c, d, e, x, y)
println("赤: ", (d + 2a - e)a)
println("黃: ", (e - d)*(x - a))
println("黒: ", (c - (d + 2a))a)
plot([x, 0, -x, 0, x], [y, c, y, 0, y], color=:black, lw=0.5)
plot!([a, a, -a, -a, a], [d, d + 2a, d + 2a, d, d], color=:black, lw=0.5)
plot!([0, a, a, 0], [b, d + 2a, e, b], color=:red, seriestype=:shape, alpha=0.4)
plot!([0, -a, -a, 0], [b, d + 2a, e, b], color=:red, seriestype=:shape, alpha=0.4)
plot!([a, x, a, a], [e, y, d, e], color=:yellow, seriestype=:shape, alpha=0.4)
plot!([-a, -x, -a, -a], [e, y, d, e], color=:yellow, seriestype=:shape, alpha=0.4)
plot!([0, a, -a, 0], [c, d + 2a, d + 2a, c], color=:black, seriestype=:shape, alpha=0.2)
segment(x, y, -a, d + 2a)
segment(-x, y, a, d + 2a)
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)
point(a, d + 2a, " (a,d+2a)", :black, :left, :vcenter)
point(a, e, " (a,e)", :black, :left, :bottom, delta=delta/2)
point(x, y, " (x,y)", :black, :left, :vcenter)
point(a, d, " (a,d)", :black, :left, delta=-delta/2)
point(0, b, " b", :black, :left, delta=-delta)
point(0, c, " c", :black, :left, :vcenter)
point(0, d, " d", :black, :left, delta=-delta)
end
end;
以下のアイコンをクリックして応援してください