算額(その786)
福島県白河市南湖 南湖神社 昭和58年(1983)
http://www.wasan.jp/fukusima/nanko.html
外円の中に大小の正方形と甲乙丙の 3 円が入っている(甲円ははみ出すが)。丙円の直径がわかっているとき,外円の直径を求めよ。
それぞれの図形が独立なので,上から順に図形を構成していく。
外円の半径と中心座標を R, (0, 0),大正方形の一辺の長さを a とする。
右にある大正方形の右上の頂点座標から,以下の方程式を解くことにより a が決定される。
include("julia-source.txt");
@syms R, a
eq = sqrt(R^2 - (R - a)^2) - 2a;
solve(eq, a)
2-element Vector{Sym{PyCall.PyObject}}:
0
2*R/5
斜線と外円の交点座標 (x02, y02) を求める。傾きは -1 である。
@syms x02, y02
a = 2R/5
eq1 = (R - a - y02)/x02 + 1
eq2 = x02^2 + y02^2 - R^2;
solve([eq1, eq2], (x02, y02))
2-element Vector{Tuple{Sym{PyCall.PyObject}, Sym{PyCall.PyObject}}}:
(R*(-3 + sqrt(41))/10, R*(3 + sqrt(41))/10)
(R*(-sqrt(41) - 3)/10, R*(3 - sqrt(41))/10)
@syms r1, r2, r3
(x02, y02) = (R*(sqrt(Sym(41)) + 3)/10, R*(3 - sqrt(Sym(41)))/10)
eq3 = distance(0, R - a, x02, y02, r2, R - 2a - r2) - r2^2
eq4 = distance(0, R - a, x02, y02, 2r1, R - 2a - 2r2 - r1) - r1^2
eq5 = r1^2 + (r1 - r3)^2 - (r1 + r3)^2
solve([eq3, eq4, eq5], (r1, r2, r3))
4-element Vector{Tuple{Sym{PyCall.PyObject}, Sym{PyCall.PyObject}, Sym{PyCall.PyObject}}}:
(2*R/5, -sqrt(2)*R/5, R/10)
(2*R/5, sqrt(2)*R/5, R/10)
(2*R*(-3 - 2*sqrt(2))/5, sqrt(2)*R/5, R*(-3/10 - sqrt(2)/5))
(2*R*(-3 + 2*sqrt(2))/5, -sqrt(2)*R/5, R*(-3/10 + sqrt(2)/5))
2番目のものが適解である。
甲円,乙円,丙円の半径はそれぞれ,外円の半径の,2/5, √2/5, 1/10 倍である。
例えば,外円の直径が 10 寸のとき,乙円の半径は 1 寸である。
function draw(more)
pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
R = 5
(a, r1, r2, r3) = R .* (2/5, 2/5, √2/5, 1/10)
@printf("丙円の直径 = %g; 外円の直径 = %g; 甲円の直径 = %g; 乙円の直径 = %g\n", 2r3, 2R, 2r1, 2r2)
@printf("R = %g; r1 = %g; r2 = %g; r3 = %g\n", R, r1, r2, r3)
y01 = R - a
x01 = sqrt(R^2 - y01^2)
plot([0, a/2, 0, -a/2, 0, 0, a/2, 0, -a/2, 0],
[R - a, R - a/2, R, R - a/2, R - a, R - 2a, R - 3a/2, R - a, R - 3a/2, R - 2a],
color=:black, lw=0.5)
rect(x01, y01, x01 - a, y01 - a, :black)
rect(x01 - 2a, y01, x01 - a, y01 - a, :black)
rect(-x01, y01, -x01 + a, y01 - a, :black)
rect(-x01 + 2a, y01, -x01 + a, y01 - a, :black)
circle(0, 0, R)
circle2(r2, R - 2a - r2, r2, :blue)
circle(0, R - 2a - 2r2 - r1, r1, :green)
circle2(2r1, R - 2a - 2r2 - r1, r1, :green)
circle2(r1, R - 2a - 2r2 - r3, r3)
factor = 5R/4
segment(-factor, R - 2a - 2r2, factor, R - 2a - 2r2, :orange)
segment(0, R - a, factor, R - a - factor, :orange)
segment(0, R - a, -factor, R - a - factor, :orange)
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(2r1, R - 2a - 2r2 - r1, "甲円:r1,(r2,R-2a-r1)", :black, :center, delta=-delta/2)
point(r2, R - 2a - r2, "乙円:r2,(r2,R-2a-r2)", :black, :center, delta=-delta/2)
point(r1, R - 2a - 2r2 - r3, "丙円:r3,(r2,R-2a-2r2-r3)", :red, :center, delta=-delta/2)
point(0, R, " R", :green, :left, :bottom, delta=delta/2)
point(0, R - a, " R-a", :green, :left, :bottom, delta=delta/2)
point(0, R - 2a, " R-2a", :green, :left, :bottom, delta=delta/2)
point(2a, R - a, "(2a,R-a) ", :black, :right, :bottom, delta=delta/2)
end
end;