裏 RjpWiki

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

算額(その938)

2024年05月10日 | Julia

算額(その938)

福岡県朝倉市上秋月(旧甘木市秋月町) 秋月八幡宮 明治4年(1871)
「算額」第三集 全国調査,香川県算額研究会

外円の中に大円,中円,小円が入っている。外円の直径が 5 寸のとき,中円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
大円の半径と中心座標を r1, (0, R - r1)
中円の半径と中心座標を r2, (0, R - r2)
小円の半径と中心座標を r3, (x3, r3)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, r2::positive,
     r3::positive, x3::positive
eq1 = x3^2 + r3^2 - (R - r3)^2
eq2 = x3^2 + (R - r1 - r3)^2 - (r1 + r3)^2
eq3 = 2r2 + r3 - R
eq4 = 2r1 -r3 - R
solve([eq1, eq2, eq3, eq4], (r1, r2, r3, x3))

   1-element Vector{NTuple{4, Sym{PyCall.PyObject}}}:
    (3*R/5, 2*R/5, R/5, sqrt(15)*R/5)

中円の半径 r2 は,外円の半径 R の 2/5 倍である。
外円の直径が 5 寸のとき,中円の直径は 2 寸である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 5/2
   (r1, r2, r3, x3) = R .* (3/5, 2/5, 1/5, √15/5)
   @printf("外円の直径が %g 寸のとき,中円の直径は %g 寸である。\n", 2R, 2r2)
   plot()
   circle(0, 0, R, :blue)
   circle22(0, R - r1, r1)
   circle22(0, R - r2, r2, :green)
   circle(0, 0, r3, :brown)
   circle4(x3, r3, r3, :brown)
   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)", :red, :center, delta=-delta/2)
       point(0, R - r2, "中円:r2,(0,R-r2)", :green, :center, delta=-delta/2)
       point(x3, r3, "小円:r3\n(x3,r3)", :brown, :center, delta=-delta/2)
       point(0, R, " R", :blue, :left, :bottom, delta=delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事