裏 RjpWiki

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

算額(その911)

2024年05月04日 | Julia

算額(その911)

一一三 熊谷市熊谷 大神宮 昭和辛丑(昭和36年,1961年)

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

楕円内に正方形 2 個,等円 2 個を入れる。等円の直径が与えられたとき,正方形の一辺の長さを求めよ。

楕円の長半径,短半径,中心座標を a, b, (0, 0)
等円の半径と中心座標を r, (0, b - r)
とおき,以下の連立方程式を解く。

なお,正方形の一辺の長さは楕円の長半径の 1/√2 倍である。

include("julia-source.txt");

using SymPy
@syms a::positive, b::positive, r::positive
eq1 = (b - r)/√Sym(2) - r
eq2 = (a/2)^2/a^2 + (a/2)^2/b^2 - 1
res = solve([eq1, eq2], (a, b))[1]

   (r*sqrt(6*sqrt(2) + 9), r*(1 + sqrt(2)))

res[1] |> sympy.sqrtdenest |> factor |> println

   r*(sqrt(3) + sqrt(6))

楕円の長半径は等円の半径の √3 + √6 倍,楕円の短半径は等円の半径の 1 + √2 倍である。
等円の直径が 1 のとき,楕円の長径,短径はそれぞれ 4.18154055035206,2.41421356237309 である。

正方形の一辺の長さは楕円の長半径の 1/√2 倍であるから,等円の半径の √2(√3 + √6)/2 倍である。
等円の直径が 1 のとき,正方形の一辺の長さは 2.9567956789604666 である。

√2(√3 + √6)/2

   2.9567956789604666

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 1/2
   (sq, a, b) = r .* (√2(√3 + √6), √3(1 + √2) , 1 + √2)
   @printf("正方形の一辺の長さ = %g;  楕円の長径 = %g,楕円の短径 = %g\n", sq, 2a, 2b)
   plot(a .* [1, 1/2, 0, -1/2, -1, -1/2, 0, 1/2, 1],
        a/2 .* [0, 1, 0, -1, 0, 1, 0, -1, 0], color=:blue, lw=0.5)
   ellipse(0, 0, a, b, color=:red)
   circle22(0, b - r, r, :green)
   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=:gray80, lw=0.5)
       point(a, 0, " a", :red, :left, :bottom, delta=delta/2)
       point(0, b, " b", :red, :left, :bottom, delta=delta/2)
       point(0, b - r, "等円:r\n(0,b-r)", :green, :center, delta=-2delta)
       point(a/2, a/2, "(a/2,a/2))", :blue, :left, :bottom, delta=delta)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事