裏 RjpWiki

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

算額(その594)

2023年12月27日 | Julia

算額(その594)

長崎市 鎮西大社諏訪神社 明治20年(1887)
米光丁: 長崎県の和算の概説

http://hyonemitsu.web.fc2.com/Nagasakiwasan.pdf

問題 19. 大円の中に中円を 2 個入れる。大円の直径が 40 寸,矢の長さが 10 寸のとき,中円の直径はいかほどか。

大円の半径と中心座標を R, (0, 0)
中円の半径と中心座標を r, (r, R - 矢 - r)
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy

@syms R::positive, 矢::positive, r::positive
eq1 = r^2 + (R - 矢 -r)^2 - (R -r)^2
res = solve(eq1, r)[1] |> println

   sqrt(2)*sqrt(R)*sqrt(矢) - 矢

中円の直径は「大円の直径と矢の積の平方根から矢を引いて 2 倍する」

大円の直径が 40 寸,矢の長さが 10 寸のとき,中円の直径は 20 寸である。

(sqrt(40*10) - 10)*2 |> println

   20.0

function draw(R, 矢, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   # (R, 矢) = (40//2, 10)
   r = sqrt(2R*矢) - 矢
   @printf("大円の直径 = %g;  矢 = %g;  中円の直径 = %g\n",  2R, 矢, 2r)
   plot()
   segment(0, R, 0, R - 矢, lw=2)
   x1 = sqrt(R^2 - (R - 矢)^2)
   segment(-x1, R - 矢, x1, R - 矢, :red)
   x2 = sqrt(R^2 - (R - 矢 - 2r)^2)
   segment(-x2, R - 矢 - 2r, x2, R - 矢 - 2r, :red)
   circle(0, 0, R, :blue)
   circle(r, R - 矢 - r, r, :orange)
   circle(-r, R - 矢 - r, r, :orange)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(r, R - 矢 - r, "中円:r,(r,R-矢-r)", :orange, :center, delta=-delta)
       point(0, R - 矢/2, " 矢", :black, :left, :vcenter, mark=false)
       point(0, R, " R", :blue, :left, :bottom, delta=delta/2)
   end
end;

 


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

コメントを投稿

Julia」カテゴリの最新記事