裏 RjpWiki

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

算額(その2011)

2024年08月12日 | Julia

算額(その2011)

(22) 兵庫県養父町左近山 地蔵堂 明治21年(1888)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.
キーワード:円8個,直線

直線の上に甲円 1 個と乙円 2 個,直線の下に乙円 5 個が互いに接するように描かれている。乙円の直径が 1 寸のとき,甲円の直径はいかほどか。

甲円の半径と中心座標を r1, (0, r1)
乙円の半径と中心座標を r2, (4r2, r2)
とおき,以下の方程式を解く。

include("julia-source.txt");

using SymPy

@syms r1, r2

eq = (4r2)^2 + (r1 - r2)^2 - (r1 + r2)^2
res = solve(eq, r1)[1]
res |> println
2res(r2 => 1/2) |> println

   4*r2
   4.00000000000000

甲円の半径 r1 は,乙円の半径 r2 の 4 倍である。
乙円の直径が 1 寸のとき,甲円の半径は 4 寸である。

function draw(r2, more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = 4r2
   @printf("乙円の直径が %g のとき,甲円の直径は %g である。\n", 2r2, 2r1)
   plot()
   circle(0, r1, r1)
   circle4(4r2, r2, r2, :blue)
   circle2(2r2, -r2, r2, :blue)
   circle(0, -r2, r2, :blue)
   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, r1, "甲:r1,(0,r1)", :red, :center, delta=-delta/2)
       point(4r2, r2, "乙円:r2\n(4r2,r2)", :blue, :center, delta=-delta/2)
   end
end;

draw(1/2, true)

 

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

PVアクセスランキング にほんブログ村

PVアクセスランキング にほんブログ村