裏 RjpWiki

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

算額(その716)

2024年02月22日 | Julia

算額(その716)

埼玉県秩父市大宮 秩父神社 明治20年

山口正義(2015): やまぶき, 第27号
https://yamabukiwasan.sakura.ne.jp/ymbk27.pdf

楕円の中に大円4個,小円3個が入っている。小円の直径が 1 寸のとき,楕円の長径はいかほどか。

楕円の長半径,短半径を a, b,中心座標を (0, 0); b = 3r2
大円の半径と中心座標を r1, (x1, 0), (0, r2); r1 = 2r2
楕円と大円の接点座標を (x0, y0)
小円の半径を r2
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms r1::positive, x1::positive, r2::positive,
     a::positive, b::positive,
     x0::positive, y0::positive
r1 = 2r2
b = 3r2
eq1 = x1^2 + r2^2 - 4r1^2
eq2 = (x0 - x1)^2 + y0^2 - r1^2
eq3 = x0^2/a^2 + y0^2/b^2 - 1
eq4 = -b^2*x0/(a^2*y0) - (x1 - x0)/y0
res = solve([eq1, eq2, eq3, eq4], (a, x1, x0, y0))

   1-element Vector{NTuple{4, Sym{PyCall.PyObject}}}:
    (6*r2, sqrt(15)*r2, 4*sqrt(15)*r2/3, sqrt(21)*r2/3)

楕円の長半径は小円の半径の 6 倍である。
小円の半径が 1/2 寸のとき,長半径は 3 寸(長径は 6 寸)である。

r2 = 1//2
(6.0*r2, sqrt(15)*r2, 4*sqrt(15)*r2/3, sqrt(21)*r2/3)

   (3.0, 1.9364916731037085, 2.581988897471611, 0.7637626158259733)

楕円の長径 = 6;  a = 3;  x1 = 1.93649;  x0 = 2.58199;  y0 = 0.763763

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 1//2
   r1 = 2r2
   b = 3r2
   (a, x1, x0, y0) = (6*r2, sqrt(15)*r2, 4*sqrt(15)*r2/3, sqrt(21)*r2/3)
   @printf("楕円の長径 = %g;  a = %g;  x1 = %g;  x0 = %g;  y0 = %g\n", 2a, a, x1, x0, y0)
   plot()
   circle(x1, 0, r1)
   circle(-x1, 0, r1)
   circle.(0, [0, 2r2, -2r2], r2)
   circle(0, r2, r1, :green)
   circle(0, -r2, r1, :green)
   ellipse(0, 0, a, b, 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(x0, y0, "(x0,y0)", :blue, :left, :bottom, delta=delta/2)
       point(x1, 0, "x1", :magenta, :center, :bottom, delta=delta/2)
       point(0, r2, " r2", :green, :center, delta=-delta/2)
       point(0, b, " b", :blue, :left, :bottom, delta=delta/2)
       point(a, 0, " a", :blue, :left, :bottom, delta=delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事