裏 RjpWiki

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

算額(その63)

2022年12月16日 | Julia

算額(その63)

飯山市常磐柳新田 瀧澤治夫宅所蔵 天保11年(1840)7月
http://www.wasan.jp/nagano/takizawa2.html

半円の中に,3 種類の円が収まっている。各円の径を求めよ。

半円の半径を1として,図のように記号を定め,方程式を解く。

using SymPy
@syms x1::positive, r1::positive, x2::positive, r2::positive;
eq1 = x1^2 + r1^2 - (1 - r1)^2;
eq2 = x2^2 + r2^2 - (1 - r2)^2;
eq3 = x1^2 + (1//2 - r1)^2 - (1//2 + r1)^2;
eq4 = (x2 - x1)^2 + (r1 - r2)^2 - (r1 + r2)^2;

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

   1-element Vector{NTuple{4, Sym}}:
    (sqrt(2)/2, 1/4, 2*sqrt(2)/3, 1/18)

算額では,甲円は1尺2寸(12寸),乙円は8寸,丙円は結果として 3 寸としている。しかし,算額の図はこの比率になっていない(図のほうが正しい)。

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")
   plot()
   (x1, r1, x2, r2) = (sqrt(2)/2, 1/4, 2*sqrt(2)/3, 1/18)
   println("x1 = $x1, r1 = $r1\nx2 = $x2, r2 = $r2")
   circle(0, 0, 1, :black)
   circle(0, 1/2, 1/2)
   circle(x1, r1, r1, :brown)
   circle(-x1, r1, r1, :brown)
   circle(x2, r2, r2, :green)
   circle(-x2, r2, r2, :green)
   hline!([0], color=:black, lw=0.5)
   if more
       point(0, 0, "0 ", :black, :right)
       point(0, 1/2, "1/2 ", :black, :right)
       point(x1, r1, "(x1,r1)", :brown, :center)
       point(x2, r2, "\n    (x2,r2)", :green, :center)
       vline!([0], color=:black, lw=0.5)
   end
end;

   x1 = 0.7071067811865476, r1 = 0.25
   x2 = 0.9428090415820635, r2 = 0.05555555555555555

 


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

コメントを投稿

Julia」カテゴリの最新記事