裏 RjpWiki

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

算額(その888)

2024年04月28日 | Julia

算額(その888)

六十四 加須市不動岡 総願寺 慶応二丙寅(1866)

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

楕円の中に正方形 2 個と全円 1 個を入れる。正方形の一辺の長さが 1 寸のとき,全円の直径はいかほどか。
ちなみに,以下の図は正方形の一辺の長さが 123.45 のときの図である。

楕円の長半径と短半径,中心座標を a, b, (0, 0) とする。全円の半径は短半径と同じである。
正方形の一辺の長さを c とおき,以下の連立方程式を解く。

include("julia-source.txt");

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

   (c*(1 + sqrt(2)), c)

b すなわち全円の半径は,正方形の一辺の長さ c である。
正方形の一辺の長さが c のとき,全円の直径は 2c である。
正方形の一辺の長さが 1 寸のとき,全円の直径は 2 寸である。

function diamond(a, c)
   plot!([a, a - c/√2, a - √2c, a - c/√2, a], [0, c/√2, 0, -c/√2, 0], color=:green, lw=0.5)
end;

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   c = 123.45
   b = c
   a = b + c√2
   plot()
   ellipse(0, 0, a, b, color=:red)
   circle(0, 0, b, :blue)
   diamond(a, c)
   diamond(-b, c)
   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, b, " b", :blue, :left, :bottom, delta=delta/2)
       point(a, 0, " a", :red, :left, :bottom, delta=delta/2)
       point(b + √2c/2, 0, "b+√2c/2", :green, :center, :bottom, delta=delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事