裏 RjpWiki

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

算額(その1629)

2025年02月21日 | Julia

算額(その1629)

~落書き帳「○△□」~ 9.三円の縁
http://streetwasan.web.fc2.com/math15.5.16.html
キーワード:円3個,直線上
#Julia, #Julia, #SymPy, #算額, #和算, #数学

甲円の平行な2接線の隙間に,乙,丙二円を図のように容れる。三円は互いに外接し,乙円と丙円は,甲円の2接線の1本ずつにそれぞれ接している。
甲円,乙円の直径が 12 寸,9 寸のとき,丙円の直径はいかほどか。

甲円の半径と中心座標を r1, (x1, r1)
乙円の半径と中心座標を r2, (0, r2)
丙円の半径と中心座標を r3, (x3, 3r1 - r3)
とおき,以下の連立方程式を解く。

include("julia-source.txt");
# julia-source.txt ソース https://blog.goo.ne.jp/r-de-r/e/ad3a427b84bb416c4f5b73089ae813cf

using SymPy
@syms r1::positive, x1::positive, r2::positive,
      r3::positive, x3::positive, y3::positive,
      h::positive
y3 = 2r1 - r3
eq1 = (x1 - x3)^2 + (y3 - r1)^2 - (r1 + r3)^2
eq2 = x1^2 + (r1 - r2)^2 - (r1 + r2)^2
eq3 = x3^2 + (y3 - r2)^2 - (r2 + r3)^2;
res = solve([eq1, eq2, eq3], (x1, r3, x3))[1]

    (2*sqrt(r1)*sqrt(r2), r1^2/(4*r2), -sqrt(r1)*(r1 - 2*r2)/sqrt(r2))

res[2] |> simplify |> println

    r1^2/(4*r2)

丙円の半径は r1^2/4r2 である。
甲円,乙円の直径が 12 寸,9 寸のとき,丙円の直径は 4 寸である。

r1 = 12/2; r2=9/2
2(r1^2/4r2)

    4.0

function draw(r1, r2, more)
    pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
    (x1, r3, x3) = (2*sqrt(r1)*sqrt(r2), r1^2/(4*r2), -sqrt(r1)*(r1 - 2*r2)/sqrt(r2))
    y3 = 2r1 - r3
    @printf("甲円の直径が %g,乙円の直径が %g のとき,丙円の直径は %g である。\n", 2r1, 2r2, 2r3)
    plot()
    circle(x1, r1, r1)
    circle(0, r2, r2, :blue)
    circle(x3, y3, r3, :green)
    segment(-r2, 0, x1 + r1, 0, lw=1)
    segment(-r2, 2r1, x1 + r1, 2r1, lw=1)
    if more
        delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /3  # size[2] * fontsize * 2
        hline!([0], color=:gray80, lw=0.5)
        vline!([0], color=:gray80, lw=0.5)
        point(x1, r1, "甲円:r1,(x1,r1)", :red, :center, delta=-delta/2)
        point(0, r2, "乙円:r2,(0,r2)", :blue, :center, delta=-delta/2)
        point(x3, 2r1 - r3, "丙円:r3,(x3,2r1-r3)", :green, :center, delta=-delta/2)
    end
end;

draw(12/2, 9/2, true)


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

コメントを投稿

ブログ作成者から承認されるまでコメントは反映されません。

Julia」カテゴリの最新記事