裏 RjpWiki

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

算額(その88)

2023年01月05日 | Julia

算額(その88)

福島県三春町 津島神社 明治16年(1883)1月
http://www.wasan.jp/fukusima/tusima.html

3 種類の円が図のように配置されている。それぞれの円の径を求めよ。

算額の図を左右反転させて以下の図のように,大円の半径を r1 = 1,中円,小円の半径を r2, r3,小円の中心座標を (x3, y3) とする。


それぞれの円が外接していることに基づく方程式が 3 本立つが,未知数の個数が 4 個ある。
算額の問題文が不鮮明であるが,中円か小円の半径が既知としなければ方程式が解けないので,r2 を決めて(以下では 5//10 として)解く。

using SymPy

@syms y1::positive, r1::positive, x2::positive, r2::positive, x3::positive, y3::positive, r3::positive;
r1 = 1
r2 = 5//10
x2 = r2
x3 = 2x2
eq1 = x2^2 + y1^2 - (r2 + r1)^2
eq2 = x3^2 + (y1 - y3)^2 - (r1 + r3)^2
eq3 = (x3 - x2)^2 + y3^2 - (r2 + r3)^2
solve([eq1, eq2, eq3], (y1, y3, r3))

   1-element Vector{Tuple{Sym, Sym, Sym}}:
    (sqrt(2), 3*sqrt(2)/7, 2/7)

大円,中円の半径を 1, 5/10 とすると,小円の半径は 2/7 である。

using Plots

function circle(ox, oy, r, color=:red; beginangle=0, endangle=360)
 θ = beginangle:0.1:endangle
 x = r.*cosd.(θ)
 y = r.*sind.(θ)
 plot!(ox .+ x, oy .+ y, color=color, linewidth=0.5)
end;

function point(x, y, string="", color=:green, position=:left, vertical=:top; fontsize=10, mark=true)
  mark && scatter!([x], [y], color=color, markerstrokewidth=0)
  annotate!(x, y, text(string, fontsize, vertical, position, color))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (y1, y3, r3) = (sqrt(2), 3*sqrt(2)/7, 2/7)
   r1 = 1
   r2 = 5//10
   x2 = r2
   x3 = 2x2
   println("大円,中円の半径が $(2r1), $(2r2) のとき,小円の半径は $(2Rational(2, 7)) = $(2r3)")
   plot()
   circle(0, y1, r1, :green)
   circle(-x2, 0, r2)
   circle(x2, 0, r2)
   circle(3x2, 0, r2)
   circle(x3, y3, r3, :blue)
   if more
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(0, y1, "y1 ", :green, :bottom, :right)
       point(x2, 0, "x2", :red, :top)
       point(-x2, 0, "-x2", :red, :top)
       point(3x2, 0, "3x2", :red, :top)
       point(x3, y3, "(x3,y3)", :blue, :top)
   end
end;

   大円,中円の半径が 2, 1//1 のとき,小円の半径は 4//7 = 0.5714285714285714

 


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

コメントを投稿

Julia」カテゴリの最新記事