裏 RjpWiki

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

算額(その409)

2023年08月31日 | Julia

算額(その409)

兵庫県高砂市 生石神社 明治9年(1876)
兵庫県高砂市 高砂神社

算額(その8) : 高砂神社への算額奉納
https://toyo.repo.nii.ac.jp/?action=repository_action_common_download&item_id=2486&item_no=1&attribute_id=18&file_no=1

第3問 図のように,外円に甲円が内接している。その接点を通る任意の点を引き,外円,甲円,弦に接する乙円を描く。さらに,弦に関して乙円と反対側で,甲円と乙円に接する丙円を描く(すなわち,弦と乙円と丙円は,共通の接点を持つ)。
ここで,外円,甲円,乙円の直径が与えられたときに,丙円の径を求めよ。

「弦と乙円と丙円は,共通の接点を持つ」ということは,乙円と丙円の中心を結ぶ線分は弦と垂直に交わるということである。
また,甲円と丙円の中心を結ぶ線分と甲円と丙円の共通接線も直角に交わるのであるから,甲円と丙円の中心を結ぶ直線と,乙円と丙円の中心を結ぶ直線も直行するので,3つの円の中心を結んでできる三角形は直角三角形である(間違えてないですよね)。ということで,普通の4つの円の内外接問題 eq2~eq4 に,中心間の距離におけるピタゴラスの定理を適用する eq1 を加えて連立方程式を解けばよいはず。ただし,これによる解はちゃんと図に描けるが,数値が術と一致しない。

外円の中心を原点に置く。
外円の半径と中心座標を r0, (0, 0)
甲円の半径と中心座標を r1, (0, r0 - r1)
乙円の半径と中心座標を r2, (x2, y2)
丙円の半径と中心座標を r3, (x3, y3)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy

@syms r0::positive, r1::positive,
     r2::positive, x2::positive, y2::negative,
     r3::positive, x3::positive, y3::negative;

(r0, r1, r2) = (10, 6, 3)
eq1 = (r1 + r3)^2 + (r2 + r3)^2 - (r1 + r2)^2
eq2 = x2^2 + (r0 - r1 - y2)^2 - (r1 + r2)^2
eq3 = (x2 - x3)^2 + (y2 - y3)^2 - (r2 + r3)^2
eq4 = x3^2 + (r0 - r1 - y3)^2 - (r1 + r3)^2
eq5 = x2^2 + y2^2 - (r0 - r2)^2
res = solve([eq1, eq2, eq3, eq4, eq5], (r3, x3, y3, x2, y2))

   1-element Vector{NTuple{5, Sym}}:
    (-17*sqrt(8*sqrt(85) + 97)/42 - 9/2 + 2*sqrt(680*sqrt(85) + 8245)/21, -3*sqrt(40*sqrt(85) + 485)/14 + 3*sqrt(5)/2 + 2*sqrt(136*sqrt(85) + 1649)/21, 1 - sqrt(8*sqrt(85) + 97)/3, 3*sqrt(5), -2)

   r3 = 1.68466;  x3 = 2.22403;  y3 = -3.35579;  x2 = 6.7082;  y2 = -2

using Plots

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (r0, r1, r2) = (10, 6, 3)
   (r3, x3, y3, x2, y2) = res[1]
   @printf("r3 = %g;  x3 = %g;  y3 = %g;  x2 = %g;  y2 = %g\n", r3, x3, y3, x2, y2)
   plot()
   circle(0, 0, r0, :black)
   circle(0, r0 - r1, r1)
   circle(x2, y2, r2, :blue)
   circle(x3, y3, r3, :green)
   plot!([0, x2, x3, 0], [r0 - r1, y2, y3, r0 - r1], color=:black, lw=0.5)
   if more
       delta = (fontheight = (ylims()[2]- ylims()[1]) / 500 * 10 * 2) /  3  # size[2] * fontsize * 2
       point(0, r0, "r0 ", :red, :right, :bottom)
       point(0, r0 - r1, "甲円 \nr0-r1 ", :red, :right, :vcenter)
       point(x2, y2, "乙円:r2\n(x2,y2)", :blue)
       point(x3, y3, "丙円:r3\n(x3,y3)", :green, :center, delta=-delta)
       segment(0, r0, (r3*x2 + r2*x3)/(r2 + r3), (r3*y2 + r2*y3)/(r2 + r3), :orange)
       point((r3*x2 + r2*x3)/(r2 + r3), (r3*y2 + r2*y3)/(r2 + r3), "")
       vline!([0], color=:black, lw=0.5)
       hline!([0], color=:black, lw=0.5)
   else
       plot!(showaxis=false)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事