裏 RjpWiki

Julia ときどき R, Python によるコンピュータプログラム,コンピュータ・サイエンス,統計学

算額(その628)

2024年01月11日 | Julia

算額(その628)

和算図形問題あれこれ
令和3年12月の問題2

https://gunmawasan.web.fc2.com/kongetu-no-mondai.html

二等辺三角形の内外に甲円 2 個を置き,その間に乙円,丙円,丁円を入れる。甲円の直径が 6寸のとき,乙円,丙円,丁円の直径と三角形の底辺の長さを求めよ。

三角形の底辺の長さを 2a とする。
甲円の半径と中心座標を r1, (0, r1), (0, 3r1)
乙円の半径と中心座標を r2, (x2, y2)
丙円の半径と中心座標を r3, (0, 2r1 + r3)
丁円の半径と中心座標を r4, (x4, y4)
とおき,以下の連立方程式を解く。

SymPy の能力上,まとめて解くことができないようなので,最初に独立な 3 変数の解を求め,続いてそれらが既知として残りのパラメータを求める。

include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf

using SymPy

@syms r1::positive, r2::positive, x2::positive, y2::positive, a::positive, r3::positive, r4::positive, x4::positive, y4::positive

sinθ = r1/3r1
eq1 = (4r1 - (2r1 + r3))sinθ - r3
eq2 = a/sqrt((4r1)^2 + a^2) - sinθ
eq3 = r1*sinθ - (r1 - 2r2);

res1 = solve([eq1, eq2, eq3], (a, r2, r3))

   Dict{Any, Any} with 3 entries:
     r3 => r1/2
     a  => sqrt(2)*r1
     r2 => r1/3

乙円,丙円の直径,底辺の長さは甲円の直径の 1/3,1/2, √2 倍である。
甲円の直径が 6 寸のとき,乙円,丙円の直径は 2 寸,3 寸である。底辺の長さは 6√2 ≒ 8.48528 寸である。

@syms r1::positive, r2::positive, x2::positive, y2::positive, a::positive, r3::positive, r4::positive, x4::positive, y4::positive

(a, r2, r3) = r1 .* (sqrt(Sym(2)), 1//3, 1//2)
eq4 = x4^2 + (3r1 - y4)^2 - (r1 + r4)^2
eq5 = x4^2 + (y4 - r1)^2 - (r1 + r4)^2
eq6 = distance(0, 4r1, a, 0, x4, y4) - r4^2
eq7 = x2^2 + (y2 - 3r1)^2 - (r1 - r2)^2
eq8 = (y2 - 3r1)/x2 *(-4r1)/a + 1
res2 = solve([eq4, eq5, eq6, eq7, eq8], (x2, y2, r4, x4, y4))

   2-element Vector{NTuple{5, Sym}}:
    (4*sqrt(2)*r1/9, 29*r1/9, 2*r1, 2*sqrt(2)*r1, 2*r1)
    (4*sqrt(2)*r1/9, 29*r1/9, 2*r1*(7 - 4*sqrt(3)), -2*sqrt(2)*r1*(35 - 21*sqrt(3))/7, 2*r1)

2 番目のものが適解である。

丁円の直径は甲円の直径の 2(7-4√3) 倍である。
甲円の直径が 6 寸のとき,丁円の直径は 6*2(7-4√3) ≒ 0.861561 である。

乙円の直径 = 2;  丙円の直径 = 3; 丁円の直径(12(7-4√3)) = 0.861561;  底辺(6√2) = 8.48528

その他のパラメータは以下の通り。
a = 4.24264;  r1 = 3;  r2 = 1;  r3 = 1.5;  r4 = 0.430781;  x2 = 1.88562;  y2 = 9.66667; x4 = 1.66441;  y4 = 6

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = 6//2
   (a, r2, r3) = r1 .* (sqrt(Sym(2)), 1//3, 1//2)
   (x2, y2, r4, x4, y4) = r1 .* (4*sqrt(2)/9, 29/9, 2(7 - 4*sqrt(3)), -2*sqrt(2)*(35 - 21*sqrt(3))/7, 2)
   @printf("乙円の直径 = %g;  丙円の直径 = %g; 丁円の直径 = %g;  底辺 = %g\n", 2r2, 2r3, 2r4, 2a)
   @printf("a = %g;  r1 = %g;  r2 = %g;  r3 = %g;  r4 = %g;  x2 = %g;  y2 = %g; x4 = %g;  y4 = %g\n", a, r1, r2, r3, r4, x2, y2, x4, y4)
   plot([a, 0, -a, 0], [0, 4r1, 0, 0], color=:orange, lw=0.5)
   circle(0, r1, r1)
   circle(0, 3r1, r1)
   circle(0, 2r1 + r3, r3, :blue)
   circle(x2, y2, r2, :green)
   circle(-x2, y2, r2, :green)
   circle(x4, y4, r4, :black)
   circle(-x4, y4, r4, :black)
   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(0, r1, " 甲円:r1,(0,r1)", :red, :left, :vcenter)
       point(0, 3r1, " 3r1", :red, :left, :vcenter)
       point(x2, y2, "乙円:r2\n(x2,y2)", :green, :center, :top, delta=-delta/2)
       point(0, 2r1 + r3, " 丙円:r3\n (0,2r1+r3)", :blue, :left, :vcenter)
       point(x4, y4, " 丁円:r4,(x4,y4)", :black, :left, :vcenter)
       point(a, 0, "a", :black, :left, :bottom, delta=delta)
       point(0, 4r1, " 4r1", :black, :left, :bottom)
   end
end;


コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 算額(その627) | トップ | 算額(その630) »
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事