裏 RjpWiki

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

算額(その945)

2024年05月12日 | Julia

算額(その945)

一〇六 神川村新里 光明寺 大正3年(1914)

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

半円(外円)内に小円 5 個を入れる。外円の直径が与えられたとき,小円の直径を求めよ。

外円の半径と中心座標を R, (0, 0)
小円の半径と中心座標を r, (0, r), (x1, y1),(x2,r)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

@syms R::positive, r::positive,
     x1::positive, x2::positive, y1::positive
eq1 = x1^2 + y1^2 - (R - r)^2
eq2 = x2^2 + r^2 - (R - r)^2
eq3 = x1^2 + (y1 - r)^2 - 4r^2
eq4 = (x2 - x1)^2 + (y1 - r)^2 - 4r^2
res = solve([eq1, eq2, eq3, eq4], (r, x1, x2, y1))

   1-element Vector{NTuple{4, Sym{PyCall.PyObject}}}:
    (R*(-1 + 2*sqrt(2))/7, R*sqrt(63 - 28*sqrt(2))/14, R*sqrt(9/7 - 4*sqrt(2)/7), R*(-5/14 + 5*sqrt(2)/7))

小円の半径は外円の半径の (2√2 - 1)/7 倍である。
外円の直径が 1 寸のとき,小円の直径は 0.2612038749637415 寸である。

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

R = 0.5;  r = 0.130602;  x1 = 0.17277;  x2 = 0.34554;  y1 = 0.326505

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 1/2
   (r, x1, x2, y1) = (R*(-1 + 2*sqrt(2))/7, R*sqrt(63 - 28*sqrt(2))/14, R*sqrt(9/7 - 4*sqrt(2)/7), R*(-5/14 + 5*sqrt(2)/7))
   @printf("外円の直径が %g 寸のとき,小円の直径は %g 寸である。\n", 2R, 2r)
   @printf("R = %g;  r = %g;  x1 = %g;  x2 = %g;  y1 = %g\n", R, r, x1, x2, y1)
   plot()
   circle(0, 0, R, beginangle=0, endangle=180)
   circle2(x1, y1, r, :blue)
   circle2(x2, r, r, :blue)
   circle(0, r, r, :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(R, 0, " R", :red, :left, :bottom, delta=delta/2)
       point(0, r, "小円:r,(0,r)", :blue, :center, delta=-delta/2)
       point(x1, y1, "小円:r,(x1,y1)", :blue, :center, delta=-delta/2)
       point(x2, r, "小円:r,(x2,r)", :blue, :center, delta=-delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事