裏 RjpWiki

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

算額(その522)

2023年11月30日 | Julia

算額(その522)

岩手県山田町 武内大明神 文政3年(1820)
一関市博物館>>和算に挑戦>>平成28年度出題問題&解答例>>平成28年度出題問題(2)[中級問題] https://www.city.ichinoseki.iwate.jp/museum/wasan/h28/normal.html

外円内に長方形,甲円,乙円が入っている,乙円の直径が 1,長方形の短辺の長さが 6 のとき,外円の直径を求めよ。

長方形の長辺と短辺の長さをそれぞれ 2b, 2a とする。b = r0 - 2r1 である。
外円の半径と中心座標を r0, (0,  0)
甲円の半径と中心座標を r1, (b + r1, 0)
乙円の半径と中心座標を r2, (b + r2, y2)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms r0::positive, r1::positive, r2::positive, y2::positive, b::positive;
a = r0 - 2r1
eq1 = (a + r2)^2 + y2^2 - (r0 - r2)^2
eq2 = (r1 - r2)^2 + y2^2 - (r1 + r2)^2
eq3 = a^2 - (r0^2 - b^2)
res = solve([eq1, eq2, eq3], (r0, r1, y2))

   2-element Vector{Tuple{Sym, Sym, Sym}}:
    (b^2/(4*r2), b*(b - sqrt(b^2 - 16*r2^2))/(8*r2), sqrt(2)*sqrt(b)*sqrt(b - sqrt(b - 4*r2)*sqrt(b + 4*r2))/2)
    (b^2/(4*r2), b*(b + sqrt(b^2 - 16*r2^2))/(8*r2), sqrt(2)*sqrt(b)*sqrt(b + sqrt(b - 4*r2)*sqrt(b + 4*r2))/2)

2 組の解が得られるが,2 番目の解が適解である。

   外円の直径 = 9;  r0 = 4.5;  r1 = 0.572949;  y2 = 1.07047

外円の直径は,長方形の短辺の長さの二乗を乙円の直径の 4 倍で割って得られる。

乙円の直径が 1,長方形の短辺の長さが 6 のとき,外円の直径は 36/4 = 9 である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r2, b) = (1//2, 6//2)
   (r0, r1, y2) = (b^2/(4*r2), b*(b - sqrt(b^2 - 16*r2^2))/(8*r2), sqrt(2)*sqrt(b)*sqrt(b - sqrt(b - 4*r2)*sqrt(b + 4*r2))/2)
   @printf("外円の直径 = %g;  r0 = %g;  r1 = %g;  y2 = %g\n", 2r0, r0, r1, y2)
   (r2, b) = (1//2, 6//2)
   a = r0 - 2r1
   plot([a, a, -a, -a, a], [-b, b, b, -b, -b], color=:black, lw=0.5)
   circle(0, 0, r0)
   circle(a + r1, 0, r1, :blue)
   circle(-a - r1, 0, r1, :blue)
   circle4(a+r2, y2, r2, :magenta)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
       hline!([0], color=:black, lw=0.5)
       vline!([0], color=:black, lw=0.5)
       point(a, 0, "a ", :black, :right, :bottom, delta=delta/2)
       point(0, b, " b", :black, :left, :bottom, delta=delta/2)
       point(a + r1, 0, "a+r1", :blue, :center, :bottom, delta=delta/2)
       point(a + r2, y2, "乙円:r2,(a+r2,y2) ", :magenta, :right, :vcenter)
   end
end;

 


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

コメントを投稿

Julia」カテゴリの最新記事