裏 RjpWiki

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

算額(その1017)

2024年05月31日 | Julia

算額(その1017)

四 岩手県花巻市南笹間 東光寺 慶応2年(1866)
山村善夫:現存 岩手の算額,昭和52年1月30日,熊谷印刷,盛岡市.

http://www.wasan.jp/yamamura/yamamura.html

外円の中に交差する大円 2 個,中円 2 個,小円 6 個を入れる。外円の直径が与えられたとき,小円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
大円の半径と中心座標を r1, (0, R - r1)
中円の半径と中心座標を r2, (0, R - r2)
小円の半径と中心座標を r3, (x3, y3), (R - r3, 0)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, r2::positive,
     r3::positive, x3::positive, y3::positive
eq1 = 2r1 + 2r2 - 2R
eq2 = x3^2 + (R - r1 - y3)^2 - (r1 - r3)^2
eq3 = x3^2 + (y3 - r1 + R)^2 - (r1 + r3)^2
eq4 = x3^2 + (R - r2 - y3)^2 - (r2 + r3)^2
eq5 = (R - r3)^2 + (R - r1)^2 - (r1 + r3)^2
solve([eq1, eq2, eq3, eq4, eq5], (r1, r2, r3, x3, y3))

   1-element Vector{NTuple{5, Sym{PyCall.PyObject}}}:
    (2*R/3, R/3, R/5, 4*sqrt(3)*R/15, 2*R/5)

外円の半径を R とすれば,大円,中円,小円の半径はその 2/3, 1/3, 1/5 である。
例えば,外円の直径が 15 寸のとき,大円,中円,小円の直径は 10 寸,5 寸,3 寸である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   R = 15/2
   (r1, r2, r3, x3, y3) = (2*R/3, R/3, R/5, 4*sqrt(3)*R/15, 2*R/5)
   @printf("R = %g;  r1 = %g;  r2 = %g;  r3 = %g;  x3 = %g;  y3 = %g\n", R, r1, r2, r3, x3, y3)
   plot()
   circle(0, 0, R)
   circle(0,0, r2, :gray90)
   circle22(0, R - r1, r1, :magenta)
   circle22(0, R - r2, r2, :blue)
   circle4(x3, y3, r3, :green)
   circle2(R - r3, 0, r3, :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, R - r1, "大円:r1\n(0,R-r1)", :red, :center, delta=-delta/2)
       point(0, R - r2, "中円:r2\n(0,R-r2)", :blue, :center, delta=-delta/2)
       point(x3, y3, "小円:r3\n(x3,y3)", :green, :center, delta=-delta/2)
       point(R-r3, 0, "小円:r3\n(R-r3,0)", :green, :center, delta=-delta/2)
       point(R, 0, " R", :red, :left, :bottom, delta=delta/2)
       point(0, R, " R", :red, :left, :bottom, delta=delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事