裏 RjpWiki

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

算額(その1157)

2024年07月19日 | Julia

算額(その1157)

十七 大里郡岡部村岡 稲荷社 文化13年(1816)
埼玉県立図書館:埼玉県史料集 第二集『埼玉の算額』,昭和44年,誠美堂印刷所,埼玉県与野市.
キーワード:円11個,半円2個,長方形

長方形の中に甲円,乙円,丙円の 11 個,半円 2 個を容れる。甲円の直径が 5 寸 5 分のとき,乙円の直径はいかほどか。

長方形の長辺,短辺を 2r1, r1
甲円の半径と中心座標を r1, (0, 0)
乙円の半径と中心座標を r2, (r1 + r2, 0), (x2, r1 - r2)
丙円の半径と中心座標を r3, (x3, y3)
とおき,以下の連立方程式を解く。

include("julia-source.txt")

using SymPy

@syms r1::positive, r2::positive, x2::positive,
     r3::positive, x3::positive, y3::positive
eq1 = (r1 + r2)^2 + r1^2 - (2r1 - r2)^2
eq2 = x2^2 + (2r1 - r2)^2 - (2r1 + r2)^2
eq3 = x3^2 + (y3 + r1)^2 - (2r1 - r3)^2
eq4 = (r1 + r2 - x3)^2 + y3^2 - (r2 + r3)^2
eq5 = x3^2 + y3^2 - (r1 + r3)^2;
res = solve([eq1, eq2, eq3, eq4, eq5], (r2, x2, r3, x3, y3))[1]

   (r1/3, 2*sqrt(6)*r1/3, 2*r1/11, 12*r1/11, 5*r1/11)

丙円の半径 r3 は,甲円の半径 r1 の 2/11 倍である。
甲円の直径が 5.5 寸のとき,丙円の直径は 1 寸である。

その他のパラメータは以下の通りである。

  r1 = 2.75;  r2 = 0.916667;  x2 = 4.49073;  r3 = 0.5;  x3 = 3;  y3 = 1.25

function draw(r1, more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r2, x2, r3, x3, y3) = (r1/3, 2*sqrt(6)*r1/3, 2*r1/11, 12*r1/11, 5*r1/11)
   @printf("甲円の直径が %g のとき,丙円の直径は %g である。\n", 2r1, 2r3)
   @printf("r1 = %g;  r2 = %g;  x2 = %g;  r3 = %g;  x3 = %g;  y3 = %g\n", r1, r2, x2, r3, x3, y3)
   plot(r1 .* [2, 2, -2, -2, 2], r1*[-1, 1, 1, -1, -1], color=:green, lw=0.5)
   circle(0, -r1, 2r1, :magenta, beginangle=0, endangle=180)
   circle(0, r1, 2r1, :magenta, beginangle=180, endangle=360)
   circle(0, 0, r1)
   circle2(r1 + r2, 0, r2, :green)
   circle4(x2, r1 - r2, r2, :green)
   circle4(x3, y3, r3, :blue)
   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, 0, " 2r1", :magenta, :left, :bottom, delta=delta/2)
       point(0, r1, " r1", :magenta, :left, :bottom, delta=delta/2)
       point(0, 0, "甲円:r1,(0,0)", :red, :center, delta=-delta)
       point(r1 + r2, 0, "乙円:r2\n(r1+r2,0)", :green, :center, :bottom, delta=delta)
       point(x2, r1 - r2, "乙円:r2\n(x2,r1-r2)", :green, :center, :bottom, delta=delta)
       point(x3, y3, "丙円:r3,(x3,y3)   ", :blue, :right, :vcenter)
       xlims!(-2r1 - 3delta, 2r1 + 8delta)
   end
end;


コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 2024/07/19 | トップ |   
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事