裏 RjpWiki

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

算額(その993)

2024年05月24日 | Julia

算額(その993)

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

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

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

楕円の長半径,短半径,中心を a, b, (0, 0)
大円の半径と中心座標を r1, (0, r2), (x1, r1)
小円の半径と中心座標を r2, (0, 0), (0, 2r2)
とおき,以下の連立方程式を解く。

eq2 は「算法助術」の公式84による。

include("julia-source.txt");

using SymPy

@syms a::poitive, b::positive, r1::positive,
     x1::positive, r2::positive
b = 3r2
r1 = 2r2
eq1 = x1^2 + r2^2 - 4r1^2
eq2 = (a^2 - b^2)*(b^2 - r1^2)/b^2 - x1^2
res = solve([eq1, eq2], (a, x1))[2]  # 2 of 2

   (6*r2, sqrt(15)*r2)

楕円の長半径 a は小円の半径 r2 の 6 倍である。
小円の直径が 1 寸のとき,楕円の長径は 6 寸である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 1/2
   (a , x1) = r2 .* (6, √15)
    b = 3r2
   r1 = 2r2
   @printf("小円の直径が %g 寸のとき,楕円の長径は %g 寸である。\n", 2r2, 2a)
   plot()
   ellipse(0, 0, a, b, color=:blue)
   circle22(0, 2r2, r2, :green)
   circle(0, 0, r2, :green)
   circle22(0, r2, r1, :red)
   circle2(x1, 0, r1, :red)
   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(a, 0, " a", :blue, :left, :bottom, delta=delta/2)
       point(0, b, " b", :blue, :left, :bottom, delta=delta/2)
       point(x1, 0, "大円:r1,(x1,r1)", :red, :center, delta=-delta/2)
       point(0, 2r2, "小円:r1\n(0,2r2)", :green, :center, delta=-delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事