裏 RjpWiki

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

算額(その918)

2024年05月05日 | Julia

算額(その918)

一一〇 久喜市菖蒲町小林 小林神社 大正5年(1916)

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

外円の中に正三角形 1 個と等円 3 個を入れる。等円の直径が 1 寸のとき,外円の直径はいかほどか。

これは方程式を立てるまでもなく答えを得ることができる。円に内接する正三角形の高さは外円の半径の 1.5 倍であり,正三角形の一辺と外円によりできる弓形に入る円の直径は外円の直径の 1/4 である。したがって,円の直径が 1 寸ならば,外円の直径は 4 寸である。

include("julia-source.txt");
function draw(more=false)
   pyplot(size=(600, 600), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r = 1/2
   R = 4r
   @printf("等円の直径が %g 寸のとき,外円の直径は %g 寸である。\n", 2r, 2R)
   plot([R√3/2, 0, -R√3/2, R√3/2], [-R/2, R, -R/2, -R/2], color=:blue, lw=0.5)
   circle(0, 0, R)
   rotate(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", :green, :left, :bottom, delta=delta/2)
       point(R, 0, " R", :green, :left, :bottom, delta=delta/2)
       point(0, r - R, "等円:r,(0,r-R)", :green, :center, delta=-delta/2)
   end
end;

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

算額(その917)

2024年05月05日 | Julia

算額(その917)

一〇八 加須市騎西町 玉敷神社 大正4年(1915)

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

外円の中に甲円 2 個,乙円 4 個,丙円 2 個を入れる。丙円の直径が 1 寸のとき,乙円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
甲円の半径と中心座標を r1, (0, r1); r1 = R/2
乙円の半径と中心座標を r2, (x2, r2)
丙円の半径と中心座標を r3, (x3, 0)
とおき以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive,
     r2::positive, x2::positive,
     r3::positive, x3::positive
R = 2r1
eq1 = x2^2 + r2^2 - (R - r2)^2
eq2 = x2^2 + (r1 - r2)^2 - (r1 + r2)^2
eq3 = x3^2 + r1^2 - (r1 + r3)^2
eq4 = (x2 - x3)^2 + r2^2 - (r2 + r3)^2
(r1, r2, x2, x3) = solve([eq1, eq2, eq3, eq4], (r1, r2, x2, x3))[1]

   (7*r3/2, 7*r3/4, 7*sqrt(2)*r3/2, 2*sqrt(2)*r3)

乙円の半径 r2 は,丙円の半径 r3 の 7/4 倍である。
丙円の直径が 1 寸のとき,乙円の直径は 7/4 = 1.75 寸である。

その他のパラメータは以下のとおりである。
r3 = 0.5;  r1 = 1.75;  r2 = 0.875;  x2 = 2.47487;  x3 = 1.41421

function draw(more=false)
   pyplot(size=(600, 600), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r3 = 1//2
   (r1, r2, x2, x3) = r3 .* (7/2, 7/4, 7√2/2, 2√2)
   R = 2r1
   @printf("丙円の直径が %g 寸のとき,乙円の直径は %g 寸である。\n", 2r3, 2r2)
   @printf("r3 = %g;  r1 = %g;  r2 = %g;  x2 = %g;  x3 = %g\n", r3, r1, r2, x2, x3)
   plot()
   circle(0, 0, R, :magenta)
   circle22(0, r1, r1)
   circle4(x2, r2, r2, :green)
   circle2(x3, 0, r3, :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(0, R, " R", :green, :left, :bottom, delta=delta/2)
       point(R, 0, " R", :green, :left, :bottom, delta=delta/2)
       point(0, r1, "甲円:r1,(0,r1)", :red, :center, delta=-delta/2)
       point(x2, r2, "乙円:r2,(x2,r2)", :magenta, :center, delta=-delta/2)
       point(x3, 0, "丙円:r3\n(x3,0)", :blue, :center, delta=-delta/2)
   end
end;

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

算額(その916)

2024年05月05日 | Julia

算額(その916)

一〇八 加須市騎西町 玉敷神社 大正4年(1915)

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

外円内に 2 本の円弧と甲円 2 個,乙円 2 個,丙円 4 個を入れる。乙円の直径が 3 寸のとき,丙円の直径はいかほどか。

外円の半径と中心座標を R, (0, 0)
円弧の半径と中心座標を R, (0, R), (0, -R)
甲円の半径と中心座標を r1, (0, r1); r1 = R/2
乙円の半径と中心座標を r2, (R - r2, 0)
丙円の半径と中心座標を r3, (r1 + r3, r1)
とおき以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms R::positive, r1::positive, r2::positive,
     r3::positive
R = 2r1
eq1 = (r1 + r3)^2 + r1^2 - (R - r3)^2
eq2 = (R - r2)^2 + R^2 - (R + r2)^2
(r1, r3) = solve([eq1, eq2], (r1, r3))[1]

   (2*r2, 2*r2/3)

丙円の半径 r3 は,乙円の半径 r2 の 2/3 倍である。
乙円の直径が 3 寸のとき,丙円の直径は 2 寸である。

その他のパラメータは以下のとおりである。
r2 = 1.5;  r1 = 3;  r3 = 1;  R = 6

function draw(more=false)
   pyplot(size=(600, 600), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   r2 = 3//2
   (r1, r3) = (2*r2, 2*r2/3)
   R = 2r1
   @printf("乙円の直径が %g 寸のとき,丙円の直径は %g 寸\n", 2r2, 2r3)
   @printf("r2 = %g;  r1 = %g;  r3 = %g;  R = %g\n", r2, r1, r3, R)
   plot()
   circle(0, 0, R, :green)
   circle(0, R, R, :green, beginangle=210, endangle=330)
   circle(0, -R, R, :green, beginangle=30, endangle=150)
   circle22(0, r1, r1)
   circle2(R - r2, 0, r2, :magenta)
   circle4(r1 + r3, r1, r3, :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(0, R, " R", :green, :left, :bottom, delta=delta/2)
       point(R, 0, " R", :green, :left, :bottom, delta=delta/2)
       point(0, r1, "甲円:r1,(0, r1)", :red, :center, delta=-delta/2)
       point(R - r2, 0, "乙円:r2,(R-r2,0)", :magenta, :center, delta=-delta/2)
       point(r1 + r3, r1, "丙円:r3\n(r1+r3,r1)", :blue, :center, :bottom, delta=delta/2)
   end
end;

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

算額(その915)

2024年05月05日 | Julia

算額(その915)

一〇八 加須市騎西町 玉敷神社 大正4年(1915)

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

正方形の中に2本の平行な斜線を引き,小円を 4 個入れる。正方形の一辺の長さが 1 寸のとき,小円の直径はいかほどか。

正方形の一辺の長さを a
小円の半径と中心座標を r, (r, r), (a - r, r)
斜線と正方形の辺との交点座標を (b, 0), (a, a - b)
とおき,以下の連立方程式を解く。

include("julia-source.txt");

using SymPy
@syms a::positive, b::positive, r::positive
eq1 = dist2(b, 0, a, a - b, r, r, r)
eq2 = dist2(b, 0, a, a - b, a - r, r, r)
(r, b) = solve([eq1, eq2], (r, b))[2]  # 2 of 3

   ((1 - sqrt(2)/2)*(-2*a^2*(1 - sqrt(2)/2)^2 + 2*a^2*(1 - sqrt(2)/2) + a^2)/(2*a), a*(1 - sqrt(2)/2))

式は簡約化できる。

r |> simplify |> println
b |>  simplify |> println

   a*(-1 + sqrt(2))/2
   a*(2 - sqrt(2))/2

等円の半径は正方形の一辺の長さの (√2 - 1)/2 倍
正方形の一辺の長さが 1 寸のとき,等円の直径は √2 - 1 = 0.41421356237309515 寸である。

function draw(more=false)
   pyplot(size=(500, 500), grid=false, aspectratio=1, label="", fontfamily="IPAMincho")
   a = 1
   (r, b) = a .* ((√2 - 1)/2, 1 - √2/2)
   @printf("正方形の一辺の長さが %g 寸のとき,小円の直径は %g 寸\n", a, 2r)
   @printf("a = %g;  r = %g;  b = %g\n", a, r, b)
   plot([0, a, a, 0, 0], [0, 0, a, a, 0], color=:blue, lw=0.5,
       xlims=(-0.05a, 1.17a), ylims=(-0.05a, 1.05a))
   circle(r, r, r)
   circle(a - r, r, r)
   circle(r, a - r, r)
   circle(a - r, a - r, r)
   segment(b, 0, a, a - b, :green)
   segment(0, b, a - b, a, :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, a, "a ", :green, :right, :vcenter)
       point(a, 0, "a", :green, :center, delta=-delta/2)
       point(a, a - b, " (a,a-b)", :green, :left, :vcenter)
       point(b, 0, "b", :green, :center, delta=-delta/2)
       point(r, r, "小円:r,(r,r)", :red, :center, delta=-delta/2)
       point(a - r, r, "小円:r,(a - r,r)", :red, :center, delta=-delta/2)
   end
end;

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

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

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