裏 RjpWiki

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

算額(その29)

2022年11月19日 | Julia

算額(その29)

京都府東山区 安井金比羅宮 平成 7 年
http://www.wasan.jp/kyoto/yasuikonpira3.html

(2) 大阪府豊中市服部元町 服部天神社 天保14年(1843)
近畿数学史学会:近畿の算額「数学の絵馬を訪ねて」,平成4年5月16日 初版第一刷,大阪教育図書株式会社,大阪市.

図のように,円の中に大円が 5 個,小円が 1 個ある。それぞれの円の径を求めよ。

外円のないものは「算額(その682)

服部天神社のものは「答」の誤差が大きすぎる。

外円の半径を 1 とし,以下のように記号を定め,方程式を立てる。

using SymPy

@syms r1::positive, r2::positive, x2::positive, y2::positive, k, m;

以下の 4 方程式を立て,解く。

eq1 = x2 - (r1 + r2)cos(PI/10);
eq2 = y2 - (r1 + r2)sin(PI/10);
eq3 = r1 + 2r2 - 1;
eq4 = x2^2 + (r1 + r2 - y2)^2 - 4r2^2;

res = solve([eq1, eq2, eq3, eq4], (r1, r2, x2, y2));

name = ["r1", "r2", "x2", "y2"]
for i in 1:4
   println("$(name[i]) = $(simplify(res[1][i])) = $(res[1][i].evalf())")
end

   r1 = -4*sqrt(5) - 3*sqrt(10 - 2*sqrt(5)) + sqrt(50 - 10*sqrt(5)) + 11 = 0.259616183682500
   r2 = -5 - sqrt(50 - 10*sqrt(5))/2 + 3*sqrt(10 - 2*sqrt(5))/2 + 2*sqrt(5) = 0.370191908158750
   x2 = -sqrt(10*sqrt(5) + 50)/2 - 3*sqrt(5)/2 + 5/2 + 3*sqrt(2*sqrt(5) + 10)/2 = 0.598983089761037
   y2 = -4 - sqrt(5)*sqrt(10 - 2*sqrt(5))/2 + sqrt(10 - 2*sqrt(5)) + 2*sqrt(5) = 0.194621403573804

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; mark=true)
   mark && scatter!([x], [y], color=color, markerstrokewidth=0)
   annotate!(x, y, text(string, 10, position, color, vertical))
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = -4*sqrt(5) - 3*sqrt(10 - 2*sqrt(5)) + sqrt(50 - 10*sqrt(5)) + 11
   r2 = -5 - sqrt(50 - 10*sqrt(5))/2 + 3*sqrt(10 - 2*sqrt(5))/2 + 2*sqrt(5)
   x2 = -sqrt(10*sqrt(5) + 50)/2 - 3*sqrt(5)/2 + 5/2 + 3*sqrt(2*sqrt(5) + 10)/2
   y2 = -4 - sqrt(5)*sqrt(10 - 2*sqrt(5))/2 + sqrt(10 - 2*sqrt(5)) + 2*sqrt(5)
   println("r1 = $r1;  r2 = $r2")
   println("x2 = $x2;  y2 = $y2")
   plot()
   r0 = r1 + r2
   circle(0, 0, r1 + 2r2, :black)
   circle(0, 0, r1, :green)
   circle(0, r0, r2)
   circle(r0*cos(pi/10), r0*sin(pi/10), r2)
   circle(-r0*cos(pi/10), r0*sin(pi/10), r2)
   circle(r0*cos(17pi/10), r0*sin(17pi/10), r2)
   circle(-r0*cos(17pi/10), r0*sin(17pi/10), r2)
   if more
       point(0, 0, "0 ", :black, :right)
       point(0, r1 + r2, "r1+r2 ", :red, :right)
       point(0, r1, "r1 ", :green, :right, :bottom)
       point(x2, y2, "(x2,y2)", :magenta, :center)
       vline!([0], color=:black, linewidth=0.25)
       hline!([0], color=:black, linewidth=0.25)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事