裏 RjpWiki

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

算額(その902)

2024年05月01日 | Julia

算額(その902)

七六 加須市騎西町中種足 雷神社 明治8年(1875)

埼玉県立図書館:埼玉県史料集 第二集『埼玉の算額』,昭和44年,誠美堂印刷所,埼玉県与野市.

外円内に,長径が 3 寸,短径が 2 寸の楕円が 3 個入っている。外円の直径はいかほどか。

外円の半径を R
楕円の長半径,短半径を a, b
上の楕円と右下の楕円の接点を (x, y)
とおいて,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms a::positive, b::positive, x::positive, y::positive,
     R::positive
@syms a, b, x, y, R
eq1 = x^2/a^2 + (y - R + b)^2/b^2 - 1
eq2 = -b^2*x/(a^2*(y - R +b)) - 1/√Sym(3)
eq3 = y/x - 1/√Sym(3)
res = solve([eq1, eq2, eq3], (R, x, y))[2]  # 2 of 2

   (sqrt(3)*a^2*sqrt(1/(a^2 + 3*b^2))/3 + sqrt(3)*b^2*sqrt(1/(a^2 + 3*b^2)) + b, a^2*sqrt(1/(a^2 + 3*b^2)), sqrt(3)*a^2*sqrt(1/(a^2 + 3*b^2))/3)

外円の直径は sqrt(3)*a^2*sqrt(1/(a^2 + 3*b^2))/3 + sqrt(3)*b^2*sqrt(1/(a^2 + 3*b^2)) + b である。
長径が 3 寸,短径が 2 寸 のとき,6.21455025366432 寸である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   (a, b) = (2, 3) .// 2
   t = sqrt(1/(a^2 + 3*b^2))
   R = √3t*(a^2/3 + b^2) + b
   x = a^2*t
   y = x/√3
   @printf("外円の直径 = %.15g\n", 2R)
   @printf("a = %g;  b = %g;  R = %g;  x = %g;  y = %g\n", a, b, R, x, y)
   r = R - b
   plot()
   circle(0, 0, R)
   ellipse(0, r, a, b, color=:blue)
   ellipse(r*cosd(210), r*sind(210), a, b, φ = 120, color=:blue)
   ellipse(r*cosd(330), r*sind(330), a, b, φ = 240, color=:blue)
   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(0, R, "R", :red, :center, :bottom, delta=delta/2)
       point(0, R - b, " R-b", :blue, :left, :vcenter)
       point(a, R - b, " (a,R-b)", :blue, :left, :vcenter)
       point(x, y, "(x, y)", :blue, :left, delta=-delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事