裏 RjpWiki

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

算額(その1195)

2024年08月08日 | Julia

算額(その1195)

(16) 京都府京都市右京区山ノ内宮脇町 山王神社 明治23年(1890)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円,矢,弦

外円の中に矢,弦,内円を容れる。矢が 1 寸,弦が 8 寸のとき,内円の直径はいかほどか。

注:原文には「弧」とあるが,図に示されているのは「弦」である。

矢,弦をそのまま「矢」,「弦」
外円の半径と中心座標を R, (0, 0)
弦と外円の交点座標を (弦/2, sqrt(R^2 - (R - 矢)^2))
とおき,以下の方程式を解く。

内円の直径は r = 2R - 矢 である。

include("julia-source.txt");

using SymPy
@syms 矢::positiveb, 弦::positive, R::positive
eq1 = (弦/2)^2 + (R - 矢)^2 - R^2
res = solve(eq1, R)[1]
res |> println

   弦^2/(8*矢) + 矢/2

矢が 1 寸,弦が 8 寸のとき,外円の半径は 弦^2/(8*矢) + 矢/2 = 8.5 寸である。
内円の半径は 2*8.5 - 矢 = 16 寸である。

res(矢 => 1, 弦 => 8).evalf() |> println

   8.50000000000000

function draw(矢, 弦, more)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 弦^2/(8*矢) + 矢/2
   x = 弦/2
   r = (2R - 矢)/2
   @printf("矢,弦が %g, %g のとき,外円の直径は %g,内円の直径は %g である。\n", 矢, 弦, 2R, 2r)
   plot()
   circle(0, 0, R)
   circle(0, r - R, r, :blue)
   segment(-x, R - 矢, x, R - 矢, :green)
   segment(0, R, 0, R - 矢, :magenta)
   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, "R", :red, :center, :bottom, delta=delta/2)
       point(弦/2, R - 矢, " (弦/2,R-矢)", :green, :left, :vcenter)
       point(0, r - R, "内円:r,(0,r-R)", :blue, :center, delta=-delta/2)
   end
end;

draw(1, 8, true)


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

コメントを投稿

Julia」カテゴリの最新記事