裏 RjpWiki

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

算額(その988)

2024年05月22日 | Julia

算額(その988)

一〇一 大宮市高鼻町 氷川神社 明治31年(1898)

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

外円の中に水平な弦を引き,弦の上に甲円 1 個,乙円 2 個,弦の下に甲円 4 個を入れる。甲円の直径が 1 寸のとき,乙円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
甲円の半径と中心座標を r1, (0, R - r1), (r1, R - 3r1), (r1, R - 5r1)
乙円の半径と中心座標を r2, (x2, R - 2r1 + r2)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy

@syms R::poitive, r1::positive, r2::positive, x2::positive
eq1 = x2^2 + (R - 2r1 + r2)^2 - (R - r2)^2
eq2 = x2^2 + (r1 - r2)^2 - (r1 + r2)^2
eq3 = r1^2 + (R - 5r1)^2 - (R - r1)^2
res = solve([eq1, eq2, eq3], (R, r2, x2))

   1-element Vector{Tuple{Sym{PyCall.PyObject}, Sym{PyCall.PyObject}, Sym{PyCall.PyObject}}}:
    (25*r1/8, 17*r1/25, 2*sqrt(17)*r1/5)

乙円の半径は,甲円の半径の 17/25 倍である。
甲円の直径が 1 寸のとき,乙円の直径は 17/25 = 0.68 寸である。

その他のパラメータは以下のとおりである。

   R = 2.91421;  r1 = 1.45711;  r2 = 0.5;  x2 = 1.70711

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r1 = 1/2
   (R, r2, x2) = (25*r1/8, 17*r1/25, 2*sqrt(17)*r1/5)
   @printf("甲円の直径が %g 寸のとき,乙円の直径は %g 寸である。\n", 2r1, 2r2)
   @printf("R = %g;  r1 = %g;  r2 = %g;  x2 = %g\n", R, r1, r2, x2)
   plot()
   circle(0, 0, R)
   circle2(r1, R - 3r1, r1, :blue)
   circle2(r1, R - 5r1, r1, :blue)
   circle(0, R - r1, r1, :blue)
   circle2(x2, R - 2r1 + r2, r2, :magenta)
   y = R - 2r1
   x = sqrt(R^2 - y^2)
   segment(-x, y, x, y, :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 - r1, "甲円:r1,(0,R-r1)", :blue, :center, delta=-delta/2)
       point(r1, R - 3r1, "甲円:r1,(r1,R-3r1)", :blue, :center, delta=-delta/2)
       point(r1, R - 5r1, "甲円:r1,(r1,R-5r1)", :blue, :center, delta=-delta/2)
       point(x2, R - 2r1 + r2, "小円:r2\n(x2,R-2r1+r2)", :magenta, :center, :bottom, delta=delta/2)
       point(0, R, " R", :red, :left, :bottom, delta=delta/2)
       point(R, 0, " R", :red, :left, :bottom, delta=delta/2)
   end
end;

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

算額(その987)

2024年05月22日 | Julia

算額(その987)

一〇一 大宮市高鼻町 氷川神社 明治31年(1898)

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

外円の中に正方形 1 個,大円 2 個,小円 4 個を入れる。小円の直径が 1 寸のとき,大円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
大円の半径と中心座標を r1
小円の半径と中心座標を r2, (x2, r2)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy

@syms R::positive, r1::positive, r2::positive, x2::positive

eq1 = x2^2 + (R - r1 - r2)^2 - (r1 + r2)^2
eq2 = r1/R - 1//2
eq3 = dist2(R, 0, 0, R, x2, r2, r2)
res = solve([eq1, eq2, eq3], (R, r1, x2))[3]

   (r2*(2*sqrt(2) + 3), r2*(2*sqrt(2) + 3)/2, r2*(sqrt(2) + 2))

大円の半径は,小円の半径の (2√2 + 3)/2 倍である。
小円の直径が 1 寸のとき,大円の直径は 2.914213562373095 寸である。

その他のパラメータは以下のとおりである。

   R = 2.91421;  r1 = 1.45711;  r2 = 0.5;  x2 = 1.70711

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 1/2
   (R, r1, x2) = (r2*(2*sqrt(2) + 3), r2*(2*sqrt(2) + 3)/2, r2*(sqrt(2) + 2))
   @printf("小円の直径が %g 寸のとき,大円の直径は %g 寸である。\n", 2r2, 2r1)
   @printf("R = %g;  r1 = %g;  r2 = %g;  x2 = %g\n", R, r1, r2, x2)
   plot([0, R, 0, -R, 0], [-R, 0, R, 0, -R], color=:black, lw=0.5)
   circle(0, 0, R)
   circle4(x2, r2, r2, :blue)
   circle22(0,r1, r1, :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, r1, "大円:r1,(0,r1)", :green, :center, delta=-delta/2)
       point(x2, r2, "小円:r2\n(x2,r2)", :blue, :center, delta=-delta/2)
       point(0, R, " R", :red, :left, :bottom, delta=delta/2)
       point(R, 0, " R", :red, :left, :bottom, delta=delta/2)
   end
end;

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

算額(その986)

2024年05月22日 | Julia

算額(その986)

一八 大里郡岡部村岡 稲荷社 文化14年(1817)

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

正三角形の中に菱形と,甲円,乙円,丙円を入れる。正三角形の一辺の長さが 69 寸のとき,丙円の直径はいかほどか。

正三角形の一辺の長さを a
甲円の半径と中心座標を r1, x1; r1 = √3a/8, x1 = 3a/8
乙円の半径と中心座標を r2, x2
丙円の半径と中心座標を r3, x3, y3
とおき以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms a::positive, r1::positive, x1::positive,
     r2::positive, x2::positive,
     r3::positive, x3::positive, y3::positive
r1 = √Sym(3)*a/8
x1 = 3a/8  # √Sym(3)*r1
eq1 = (x1 - x2)^2 + (r1 - r2)^2 - (r1 + r2)^2
eq2 = (x3 - x2)^2 + (y3 - r2)^2 - (r2 + r3)^2
eq3 = (x1 - x3)^2 + (r1 - y3)^2 - (r1 + r3)^2
eq4 = x2 - √Sym(3)*r2
eq5 = dist2(0, 0, a/2, √Sym(3)*a/2, x3, y3, r3)
res = solve([eq1, eq2, eq3, eq4, eq5], (r2, x2, r3, x3, y3))[1]  # 1 of 2

   (sqrt(3)*a/24, a/8, a*(-3 + 2*sqrt(3))/16, a*(6 - sqrt(3))/32, -69*sqrt(3)*a*(32/69 - 16*sqrt(3)/23)/512)

丙円の半径は正三角形の一辺の長さの (2√3 - 3)/16 倍である。

正三角形の一辺の長さが 69 のとき,丙円の直径は 4.0028764305631315 である。

その他のパラメータは以下のとおりである。

a = 69;  r1 = 14.9389;  x1 = 25.875;  r2 = 4.97965;  x2 = 8.625;  r3 = 2.00144;  x3 = 9.20277;  y3 = 11.9368

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   a = 69
   r1 = √3a/8
   x1 = √3r1
   (r2, x2, r3, x3, y3) = (√3*a/24, a/8, a*(2√3 - 3)/16, a*(6 - √3)/32, 69√3*a*(16√3/23 - 32/69)/512)
   @printf("正三角形の一辺の長さが %g のとき,丙円の直径は %g である。\n", a, 2r3)
   @printf("a = %g;  r1 = %g;  x1 = %g;  r2 = %g;  x2 = %g;  r3 = %g;  x3 = %g;  y3 = %g\n", a, r1, x1, r2, x2, r3, x3, y3)
   plot([0, a, a/2, 0], [0, 0, √3a/2, 0], color=:green, lw=0.5)
   plot!([a/2, 3a/4, a/4], [0, √3a/4, √3a/4], color=:green, lw=0.5)
   circle(x1, r1, r1)
   circle(x2, r2, r2, :blue)
   circle(x3, y3, r3, :magenta)
   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(a, 0, "a", :green, :left, :bottom, delta=delta/2)
       point(a/2, √3a/2, "(a/2,√3a/2) ", :green, :right, :vcenter)
       point(a/4, √3a/4, "(a/4,√3a/4) ", :green, :right, :vcenter)
       point(x1, r1, "甲円:r1,(x1,r1)", :red, :center, :bottom, delta=delta)
       point(x2, r2, " 乙円:r2,(x2,r2)", :blue, :left, :vcenter)
       point(x3, y3, "  丙円:r3,(x3,y3)", :magenta, :left, :vcenter)
   end
end;

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

PVアクセスランキング にほんブログ村

PVアクセスランキング にほんブログ村