裏 RjpWiki

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

算額(その94)

2023年01月09日 | Julia

算額(その94)

東京都武蔵野市 西窪稲荷神社 嘉永5年(1852)
http://www.wasan.jp/tokyo/nisikubo.html

別サイトのPDF で見る
https://www.city.musashino.lg.jp/_res/projects/default_project/_page_/001/021/965/202103_bunkazai_omote-s10.pdf

径が 1 丈(= 10 尺)の 2 つの甲円の上に径 8 尺の乙円があり,丙円が図のように配置されている。乙円の弦と弧,丙円の径を求めよ。

甲円の半径を 10,丙円の半径を r として,以下のように記号を定め,方程式を解く。
乙円の弦は ab, 弧は arb である。

using SymPy
@syms r::positive, x::positive;
eq1 = 10^2 + (r + 8)^2 - (8 + 10)^2;
eq2 = x^2 +(r+8-10)^2 - 8^2;
solve([eq1, eq2], (r, x)) |> println

   Tuple{Sym, Sym}[(-8 + 4*sqrt(14), 2*sqrt(-65 + 20*sqrt(14)))]

(-8 + 4*sqrt(14), 2*sqrt(-65 + 20*sqrt(14)))

   (6.966629547095765, 6.271570053974948)

乙円の径は算額では丙円の径を 6 尺 9 寸 6 分余としているが 6.96663。
弦は算額で 6 尺 2 寸 7 分であるが 6.27157。

2*8*pi * asin(6.271570053974948/8)/2pi

   7.20797588918886

弧は算額で 7 尺 2 寸 5 分余であるが 7.20798 であった。

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 segment(x1, y1, x2, y2, color=:black; linestyle=:solid, linewidth=0.5)
plot!([x1, x2], [y1, y2], color=color, linestyle=linestyle, linewidth=linewidth)
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r1, r2, r3, x2, x3, x, y) = [0.13839876084731936, 0.17954306798152128, 0.3287706665765487,
       0.45366714256276236, 0.9395827489780465, 1.2683534155545952, 1.268353415554595]
   (r, x) = (-8 + 4*sqrt(14), 2*sqrt(-65 + 20*sqrt(14)))
   println("径 = $r;  弦 = $(x);  弧 = $(2*8*pi * asin(x/8)/2pi)")
   plot()
   circle(0, r + 8, 8)
   circle(10, 0, 10, :green)
   circle(-10, 0, 10, :green)
   circle(0, 0, r, :blue)
   if more
       point(0, 0, "0 ", :black, :right)
       point(0, r, "r ", :red, :right)
       point(0, r + 8, "r+8 ", :red, :right)
       point(10, 0, " 10", :green)
       point(x, 10, "a\n(x,10)", :black, :center)
       point(-x, 10, "b\n(-x,10)", :black, :center)
       segment(-10, 10, 10, 10, :magenta)
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
   end
end;

   径 = 6.966629547095765;  弦 = 6.271570053974948;  弧 = 7.20797588918886


コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 算額について中間報告 | トップ | Julia v1.8.5 出ました »
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事