裏 RjpWiki

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

算額(その2054)

2024年08月30日 | Julia

算額(その2054)

百八 群馬県邑楽郡板倉町板倉 雷電神社 慶応3年(1867)
群馬県和算研究会:群馬の算額,上武印刷株式会社,高崎市,1987年3月31日.
キーワード:円4個,半円2個,長方形

長方形の中に等円 4 個,半円 2 個を容れる。長方形の短辺が 3 寸,長辺が 6 寸のとき,等円の直径はいかほどか。

長方形の短辺,長辺を a, b; b = 2a, b = r1
半円の半径と中心座標を r1, (0, 0), (0, r1)
等円の半径と中心座標を r2, (x2, r2)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms r1::positive, r2::positive, x2::positive;
eq1 = x2^2 + (r1 - r2)^2 - (r1 + r2)^2
eq2 = x2^2 + r2^2 - (r1 - r2)^2
res = solve([eq1, eq2], (r2, x2))[1]
res |> println

   (r1/6, sqrt(6)*r1/3)

等円の半径 r2 は,半円の半径 r1(長方形の短辺) の 1/6 である。
長方形の長辺が 6 寸のとき,等円の直径は 1 寸である。

function draw(a, b, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = a
   (r2, x2) = (r1/6, sqrt(6)*r1/3)
   @printf("長方形の長辺,短辺が %g, %g のとき,等円の直径は %g である。\n", b, a, 2r2)
   plot([a, a, -a, -a, a], [0, a, a, 0, 0], color=:blue, lw=0.5)
   circle2(x2, r1 - r2, r2)
   circle2(x2, r2, r2)
   circle(0, 0, r1, :green, beginangle=0, endangle=180)
   circle(0, r1, r1, :green, beginangle=180, endangle=360)
   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(x2, r2, "等円:r2\n(x2,r2)", :red, :center, delta=-delta/2)
       point(r1, r1, "(r1,r1)", :blue, :right, :bottom, delta=delta/2)
   end
end;

draw(3, 6, true)


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

コメントを投稿

Julia」カテゴリの最新記事