裏 RjpWiki

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

算額(その877)

2024年04月25日 | Julia

算額(その877)

七 川越市石田本郷折戸 地蔵堂 文化元甲子歳

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

外円の中に甲方(正方形)と乙円が入っている。正方形の一辺の長さは乙円の直径より 25 寸短く,正方形の下辺が作る円弧の矢が 5 寸である。このとき,外円の直径はいかほどか。

正方形の一辺の長さを 2a
乙円の半径と中心座標を r, (0, R - r)
乙円と正方形の一辺の長さとの差をそのまま「差」
矢をそのまま「矢」
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, 差::positive, 矢::positive, r::positive,
     a::positive
r  = a + 差//2
eq1 = (矢 - R)^2 + a^2 - R^2
eq2 = 2r + 2a + 矢 - 2R;
res = solve([eq1, eq2], (R, a));
res[2]  # 2 of 2

   (差/2 + 2*sqrt(矢)*sqrt(差 + 4*矢) + 9*矢/2, sqrt(矢)*sqrt(差 + 4*矢) + 2*矢)

2 組の解が得られるが,2 番目のものが適解である。

与えられた条件のもとでは,外円の直径は 130 寸である。

ちなみに,乙円の直径は 75 寸,正方形の一辺の長さは 50 寸である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   差 = 25
   矢 = 5
   (R, a) = (差/2 + 2sqrt(矢*差 + 4矢^2) + 9矢/2, sqrt(矢*差 + 4矢^2) + 2矢)
   r  = a + 差/2
   @printf("乙円の直径 = %g;  矢 = %g;  外円の直径 = %g;  正方形の一辺の長さ = %g\n", 2r, 矢, 2R, 2a)
   plot()
   circle(0, 0, R)
   plot!([a, a, -a, -a, a], (矢 - R) .+ [0, 2a, 2a, 0, 0], color=:blue, lw=0.5)
   circle(0, R - r, r, :green)
   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 - r, "乙円:r,(0,R-r)", :green, :center, delta=-delta/2)
       point(0, R - 2r, "R-2r=2a+矢-R", :blue, :center, delta=-delta/2)
       point(0, 矢-R, "矢-R", :blue, :center, :bottom, delta=delta/2)
   end
end;


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

コメントを投稿

Julia」カテゴリの最新記事