裏 RjpWiki

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

算額(その1159)

2024年07月20日 | Julia

算額(その1159)

九八 鴻巣市三ツ木山王 三木神社 明治28年(1895)
埼玉県立図書館:埼玉県史料集 第二集『埼玉の算額』,昭和44年,誠美堂印刷所,埼玉県与野市.
キーワード:円3個,接線,直線上

直線上に 2 個の等円が互いに接して載っている。左側の等円と直線の接点から右側の等円に接線を引く。左側の等円にできる円弧に小円を容れる。等円の直径が 1 寸のとき,小円の直径はいかほどか。

等円の半径と中心座標を r1, (0, r1), (2r1, r1)
小円の半径と中心座標を r2, (x2, y2)
左の等円と小円と接線の接点座標を (x0, y0)
とおき,以下の連立方程式を解く。

include("julia-source.txt")

using SymPy

@syms r1::positive, r2::positive, x2::positive, y2::positive,
     x0::positive, y0::positive
eq1 = x0^2 + (y0 -r1)^2 - r1^2
eq2 = (x0 - x2)^2 + (y0 -y2)^2 - r2^2
eq3 = y0/x0 - 1//2
eq4 = x2^2 + (r1 - y2)^2 - (r1 -r2)^2
eq5 = x0/2r1 - 2r2/r1
res = solve([eq1, eq2, eq3, eq4, eq5], (r2, x2, y2, x0, y0))[1]

   (r1/5, 16*r1/25, 13*r1/25, 4*r1/5, 2*r1/5)

小円の半径 r2 は,等円の半径 r1 の 1/5 である。
等円の直径が 1 寸のとき,小円の直径は 0.2 寸である。

その他のパラメータは以下の通りである。

  r1 = 0.5;  r2 = 0.1;  x2 = 0.32;  y2 = 0.26;  x0 = 0.4;  y0 = 0.2

function draw(r1, more=false)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r2, x2, y2, x0, y0) = r1 .* (1/5, 16/25, 13/25, 4/5, 2/5)
   @printf("等円の半径が %g のとき,小円の半径は %g である。\n", 2r1, 2r2)
   @printf("r1 = %g;  r2 = %g;  x2 = %g;  y2 = %g;  x0 = %g;  y0 = %g\n", r1, r2, x2, y2, x0, y0)
   plot()
   circle(0, r1, r1)
   circle(2r1, r1, r1)
   circle(x2, y2, r2, :blue)
   x01 = 2x2 - x0
   y01 = 2y2 - y0
   abline(0, 0, y01/x01, 0, 1.6r1, :green)
   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(2r1, r1, "等円:r1,(0,r1)", :red, :center, delta=-delta/2)
       point(x2, y2, "小円:r2,(x2,y2)", :blue, :right, :vcenter, deltax=-8delta)
       point(x0, y0, "(x0,y0)", :red, :left, delta=-delta/2)
       segment(0, 0, 2r1, r1, :gray70)
   end
end;

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

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

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