裏 RjpWiki

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

算額(その884)

2024年04月26日 | Julia

算額(その884)

六十四 加須市不動岡 総願寺 慶応二丙寅(1866)

埼玉県立図書館:埼玉県史料集 第二集『埼玉の算額』,昭和44年,誠美堂印刷所,埼玉県与野市.

外円内に二等辺三角形と,大円を 2 個,小円を 2 個入れる。小円の直径が 1 寸のとき,大円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
大円の半径と中心座標を r1, (0, -r1), (0, r1); r1 = R/2
小円の半径と中心座標を r2, (x2, y2); y2 < 0
二等辺三角形の底辺と外円の接点座標を (x0, y0); y0 < 0
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, x0::positive, y0::negative, r1::positive,
     r2::positive, x2::positive, y2::negative
R = 2r1
y0 = y2 + r2
L = sqrt(x0^2 + (2r1 - y0)^2)
eq1 = x0^2 + y0^2 - R^2
eq2 = r1/3r1 - x0/L
eq3 = x2^2 + (r1 + y2)^2 - (r1 + r2)^2
eq4 = x2^2 + y2^2 - (R - r2)^2;
res = solve([eq1, eq2, eq3, eq4], (r1, x2, y2, x0))

   1-element Vector{NTuple{4, Sym{PyCall.PyObject}}}:
    (9*r2, 8*r2, -15*r2, 8*sqrt(2)*r2)

大円の半径は小円の半径の 9 倍である。
小円の直径が 1 寸のとき,大円の直径は 9 寸である。

その他のパラメータは以下のとおりである。
r2 = 0.5;  r1 = 4.5;  x2 = 4;  y2 = -7.5;  R = 9;  x0 = 5.65685;  y0 = -7

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 1/2
   (r1, x2, y2, x0) = r2 .* (9, 8, -15, 8√2)
   R = 2r1
   y0 = y2 + r2
   @printf("小円の直径が %g のとき,大円の直径は %g である\n", 2r2, 2r1)
   @printf("r2 = %g;  r1 = %g;  x2 = %g;  y2 = %g;  R = %g;  x0 = %g;  y0 = %g\n", r2, r1, x2, y2, R, x0, y0)
   plot()
   circle(0, 0, R, :blue)
   circle22(0, r1, r1)
   plot!([x0, 0, -x0, x0], [y0, R, y0, y0], color=:green, lw=0.5)
   circle2(x2, y2, r2, :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", :blue, :left, :bottom, delta=delta/2)
       point(R, 0, " R", :blue, :left, :bottom, delta=delta/2)
       point(0, r1, "大円:r1\n(0,r1)", :red, :center, delta=-delta/2)
       point(0, -r1, "大円:r1\n(0,-r1)", :red, :center, delta=-delta/2)
       point(0, 0, "", :blue)
       point(x0, y0, " (x0,y0)", :blue, :left, :vcenter)
       point(x2, y2, "  小円:r2,(x2,y2)", :magenta, :left, delta=-delta)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事