裏 RjpWiki

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

算額(その992)

2024年05月24日 | Julia

算額(その992)

一〇一 大宮市高鼻町 氷川神社 明治31年(1898)

埼玉県立図書館:埼玉県史料集 第二集『埼玉の算額』,昭和44年,誠美堂印刷所,埼玉県与野市.

外円の中に,甲円 1 個,乙円 2 個,丙円 4 個,丁円 2 個が入っている。丁円の直径が 1 寸のとき,丙円の半径はいかほどか。

外円の半径と中心座標を R, (0, 0); R = 4r3
甲円の半径と中心座標を r1, (0, r3); r1 = 3r3
乙円の半径と中心座標を r2, (0, -r2); r2 = 2r3
丙円の半径と中心座標を r3, (0, ±r3), (0, ±3r3)
丁円の半径と中心座標を r4, (x4, y4)
とおき,以下の連立方程式を解く。

なお,本件は条件不足であり,丁円の直径が与えられただけでは解けない。
「乙円の直径が 2.5 寸」という条件を加えると,「答」,「術」のとおり「甲円の直径は 3.75 寸」になる。
多分,条件を書き漏らしたのであろう。

include("julia-source.txt");

using SymPy

@syms R::poitive, r1::positive, r2::positive,
     r3::positive, x3::positive,
     r4::positive, x4::positive, y4::negative
R = 2r2
eq1 = x4^2 + (R - r1 - y4)^2 - (r1 + r4)^2
eq2 = x4^2 + (r2 + y4)^2 - (r2 + r4)^2
eq3 = x4^2 + y4^2 - (R - r4)^2
eq4 = x3^2 + r2^2 - (r2 + r3)^2
eq5 = x3^2 + (R - r1)^2 - (r1 - r3)^2
res = solve([eq1, eq2, eq3, eq4, eq5], (r1, r3, x3, x4, y4))[1]  # 1 of 2

   (4*r2*(r2 - r4)/(2*r2 - r4), 2*r2*(2*r2 - 3*r4)/(6*r2 - 5*r4), -4*sqrt(2)*r2*sqrt((r2 - r4)*(2*r2 - 3*r4))/(6*r2 - 5*r4), 2*sqrt(2)*sqrt(r4)*sqrt(r2 - r4), -2*r2 + 3*r4)

丙円の直径は,「乙円と丁円の直径径の差に丙円の直径を掛け,4倍したものを,丙円の直径の2倍と丁円の直径の差で割る」 4r2*(r2 - r4)/(2r2 - r4)
丁円の直径が 1 寸,乙円の直径が 2.5 寸のとき,丙円の直径は 4*2.5*(2.5 - 1)/(2*2.5 - 1) = 3.75 寸になる。

(4*2.5*(2.5 - 1))/(2*2.5 - 1)

   3.75

function draw(r4, r2, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r1, r3, x3, x4, y4) = (4*r2*(r2 - r4)/(2*r2 - r4), 2*r2*(2*r2 - 3*r4)/(6*r2 - 5*r4), -4*sqrt(2)*r2*sqrt((r2 - r4)*(2*r2 - 3*r4))/(6*r2 - 5*r4), 2*sqrt(2)*sqrt(r4)*sqrt(r2 - r4), -2*r2 + 3*r4)
   R = 2r2
   @printf("丁円の直径が %g,乙円の直径が %g のとき,甲円の直径は %g\n", 2r4, 2r2, 2r1)
   string = @sprintf("丁円の直径 = %g\n乙円の直径 = %g\n甲円の直径 = %g\n", 2r4, 2r2, 2r1)
   plot()
   circle(0, 0, R, :blue)
   circle(0, R - r1, r1, :green)
   circle22(0, r2, r2)
   circle2(x3, 0, r3, :magenta)
   circle2(x4, y4, r4, :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(0, R - r1, "甲円:r1,(0,R-r1)", :green, :center, delta=-delta/2)
       point(0, -r2, "乙円:r2,(0,-r2)", :red, :center, delta=-delta/2)
       point(x3, 0, "丙円:r3,(x3,0)", :magenta, :center, delta=-delta/2)
       point(x4, y4, "丁円:r4,(x4,y4)", :orange, :center, delta=-delta/2)
       point(0, R - r1/2, string, :black, mark=false, deltax=-11.5delta)
   end
end;

draw(0.5, 1.25, true)

   丁円の直径が 1,乙円の直径が 2.5 のとき,甲円の直径は 3.75

draw(0.5, 1, true)

   丁円の直径が 1,乙円の直径が 2 のとき,甲円の直径は 2.66667

draw(0.5, 1.5, true)

   丁円の直径が 1,乙円の直径が 3 のとき,甲円の直径は 4.8


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

コメントを投稿

Julia」カテゴリの最新記事