裏 RjpWiki

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

算額(その939)

2024年05月10日 | Julia

算額(その939)

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

半円の中に大円,大円の中に 8 個の小円を入れる。半円の直径が 2 寸のとき,小円の直径はいかほどか。

半円は重要ではない。

大円と小円の半径を r1, r2 とおくと,(r1 - r2)sin(π/8) = r2 という関係が成り立つ。
方程式を解いて,小円の半径は大円の半径の sqrt(2 - √2)/(sqrt(2 - √2) + 2) 倍である。
大円の直径が 1 寸のとき,小円の直径は 0.2767686539141552 

include("julia-source.txt");

using SymPy
@syms r1::positive, r2::positive
eq1 = (r1 - r2)sin(PI/8) - r2
r2 = solve(eq1, r2)[1]
r2 |> println

   r1*sqrt(2 - sqrt(2))/(sqrt(2 - sqrt(2)) + 2)

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = 1/2
   r2 = r1*sqrt(2 - √2)/(sqrt(2 - √2) + 2)
   @printf("半円の直径が %g 寸のとき小円の直径は %g 寸である。\n", 4r1, 2r2)
   plot()
   circle(0, 0, 2r1, :blue, beginangle=0, endangle=180)
   circle(0, r1, r1)
   for i = 1:8
       theta = pi*(i/4 - 1/8)
       circle((r1 - r2)cos(theta), r1 + (r1 - r2)sin(theta), r2, :green)
   end
   plot!((r1 - r2) .* [0, cos(pi/8), cos(pi/8), 0], r1 .+ (r1 - r2) .* [0, 0, sin(pi/8), 0], color=:black, lw=0.5)
   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 ", :blue, :right, :bottom, delta=delta/2)
       point(0, r1, "大円:r1,(0,r1)", :red, :center, delta=-delta/2)
       
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事